-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Which package(s) are affected?
Other/unknown (please mention in description)
Description
$ lit labs gen --framework=react
file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/lib/generate/generate.js:83
throw new Error(errors);
^
Error: Error generating 'react' wrapper for package './': Error: No Lit components were found in this package.
at generateReactWrapper (file:///Users/augustinekim/testing/cli-test2/node_modules/@lit-labs/gen-wrapper-react/index.js:40:15)
at Object.generate (file:///Users/augustinekim/testing/cli-test2/node_modules/@lit-labs/gen-wrapper-react/index.js:20:26)
at file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/lib/generate/generate.js:70:54
at Array.map (<anonymous>)
at Module.run (file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/lib/generate/generate.js:67:61)
at async Object.run (file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/lib/commands/labs.js:36:21)
at async file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/bin/lit.js:24:16
at Module.run (file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/lib/generate/generate.js:83:19)
at async Object.run (file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/lib/commands/labs.js:36:21)
at async file:///Users/augustinekim/.nvm/versions/node/v16.16.0/lib/node_modules/@lit-labs/cli/bin/lit.js:24:16
This affects all frameworks though example above shows react.
The culprit is the instanceof check here.
lit/packages/labs/analyzer/src/lib/model.ts
Line 172 in 9aa002d
| dec instanceof ClassDeclaration && |
It ends up returning false there because the @lit-labs/analyzer module used by the CLI is different than the one used by @lit-labs/gen-wrapper-* packages.
Reproduction
TODO
Workaround
Installing the cli as dev dependency of the project and running the project instance of the cli makes it share the same @lit-labs/analyzer package.
If we want the cli to work globally we may need to either:
- Remove the
instanceofcheck Move the analysis to each(That would be a singlegen-wrapper-*code so we just use a singleanalzyeranalyzerpergen-wrapperand this would cause unnecessary multiple analyses to happen if generating multiple wrappers so not good)
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
0.1.0
Browser/OS/Node environment
Node version: 16.16.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done