open-wc / create Goto Github PK
View Code? Open in Web Editor NEWRepository for `npm init @open-wc`
Repository for `npm init @open-wc`
The generator adds the following for lint-staged
in the package.json
"lint-staged": {
"*.js": [
"eslint --fix",
"prettier --write",
"git add"
]
}
However, git add is no longer needed and produces a warning in the console.
Warning produced:
husky > pre-commit (node v14.15.1)
⚠ Some of your tasks use `git add` command. Please remove it from the config since all modifications made by tasks will be automatically added to the git commit index.
Issue on Github:
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@babel/cli
, @babel/core
)These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
@storybook/addon-a11y
, @storybook/addon-essentials
, @storybook/addon-links
, @storybook/web-components
, storybook
).github/workflows/release.yml
actions/checkout v4
actions/setup-node v4
actions/cache v4
.github/workflows/verify-node.yml
actions/checkout v4
actions/setup-node v4
.github/workflows/verify-windows.yml
actions/checkout v4
actions/setup-node v4
package.json
chalk ^4.1.2
command-line-args ^5.2.1
command-line-usage ^7.0.1
dedent ^1.5.3
deepmerge ^4.3.1
ejs ^3.1.10
glob ^8.1.0
prompts ^2.4.2
semver ^7.6.2
@babel/cli ^7.24.6
@babel/core ^7.24.6
@babel/register ^7.24.6
@custom-elements-manifest/analyzer ^0.10.2
@open-wc/eslint-config ^12.0.3
@open-wc/testing ^4.0.0
@rollup/plugin-babel ^6.0.4
@rollup/plugin-node-resolve ^15.2.3
@web/rollup-plugin-html ^2.3.0
@web/rollup-plugin-import-meta-assets ^2.2.1
babel-plugin-transform-dynamic-import ^2.1.0
chai ^4.4.1
chai-fs ^2.0.0
eslint ^8.57.0
eslint-config-prettier ^9.1.0
eslint-plugin-import ^2.29.1
eslint-plugin-lit ^1.14.0
eslint-plugin-lit-a11y ^4.1.2
eslint-plugin-wc ^2.1.0
lit ^3.1.4
lit-element ^4.0.6
mocha ^10.4.0
onchange ^7.1.0
prettier ^3.3.2
rollup-plugin-esbuild ^6.1.1
rollup-plugin-workbox ^8.1.0
commit-and-tag-version ^12.4.1
node >=18.20.3
src/generators/app-lit-element-ts/templates/package.json
lit ^3.1.4
@web/dev-server ^0.4.5
concurrently ^8.2.2
typescript ^5.4.5
tslib ^2.6.3
src/generators/app-lit-element/templates/package.json
lit ^3.1.4
@web/dev-server ^0.4.5
src/generators/building-rollup-ts/templates/package.json
@rollup/plugin-babel ^6.0.4
@rollup/plugin-node-resolve ^15.2.3
@web/rollup-plugin-html ^2.3.0
@web/rollup-plugin-import-meta-assets ^2.2.1
babel-plugin-template-html-minifier ^4.1.0
deepmerge ^4.3.1
rimraf ^5.0.7
rollup-plugin-esbuild ^6.1.1
rollup-plugin-workbox ^8.1.0
rollup ^4.18.0
src/generators/building-rollup/templates/package.json
@rollup/plugin-babel ^6.0.4
@rollup/plugin-node-resolve ^15.2.3
@web/rollup-plugin-html ^2.3.0
@web/rollup-plugin-import-meta-assets ^2.2.1
babel-plugin-template-html-minifier ^4.1.0
deepmerge ^4.3.1
rimraf ^5.0.7
rollup-plugin-esbuild ^6.1.1
rollup-plugin-workbox ^8.1.0
rollup ^4.18.0
src/generators/common-repo/templates/package.json
@custom-elements-manifest/analyzer ^0.10.2
src/generators/demoing-storybook-ts/templates/package.json
@storybook/addon-a11y ^7.6.19
@storybook/addon-essentials ^7.6.19
@storybook/addon-links ^7.6.19
@storybook/web-components ^7.6.19
@web/storybook-builder ^0.1.16
@web/storybook-framework-web-components ^0.1.2
storybook ^7.6.19
src/generators/demoing-storybook/templates/package.json
@storybook/addon-a11y ^7.6.19
@storybook/addon-essentials ^7.6.19
@storybook/addon-links ^7.6.19
@storybook/web-components ^7.6.19
@web/storybook-builder ^0.1.16
@web/storybook-framework-web-components ^0.1.2
storybook ^7.6.19
src/generators/linting-commitlint/templates/package.json
@commitlint/cli ^19.3.0
@commitlint/config-conventional ^19.2.2
src/generators/linting-eslint-ts/templates/package.json
eslint ^8.57.0
@open-wc/eslint-config ^12.0.3
@typescript-eslint/parser ^7.13.0
@typescript-eslint/eslint-plugin ^7.13.0
src/generators/linting-eslint/templates/package.json
eslint ^8.57.0
@open-wc/eslint-config ^12.0.3
src/generators/linting-prettier-ts/templates/package.json
prettier ^3.3.2
eslint-config-prettier ^9.1.0
src/generators/linting-prettier/templates/package.json
prettier ^3.3.2
eslint-config-prettier ^9.1.0
src/generators/linting-ts/templates/package.json
husky ^9.0.11
lint-staged ^15.2.6
src/generators/linting-types-js/templates/package.json
typescript ^5.4.5
src/generators/linting/templates/package.json
husky ^9.0.11
lint-staged ^15.2.6
src/generators/testing-ts/templates/package.json
@open-wc/testing ^4.0.0
@types/mocha ^10.0.6
src/generators/testing-wtr-ts/templates/package.json
@web/test-runner ^0.18.2
src/generators/testing-wtr/templates/package.json
@web/test-runner ^0.18.2
src/generators/testing/templates/package.json
@open-wc/testing ^4.0.0
src/generators/wc-lit-element-ts/templates/package.json
lit ^3.1.4
@web/dev-server ^0.4.5
concurrently ^8.2.2
typescript ^5.4.5
tslib ^2.6.3
src/generators/wc-lit-element/templates/package.json
lit ^3.1.4
@web/dev-server ^0.4.5
.nvmrc
node 18.20.3
Ok
The docs here imply that it should be possible to configure rollup for building through the generator, but I am not seeing any such option. https://open-wc.org/docs/building/rollup/
There is some scaffolding here, but it doesn't seem to be used https://github.com/open-wc/create/tree/master/src/generators/building-rollup-ts
Am I missing something?
Feedback when typing a wrong name says two words separated by a dash. I saw someone type Hello-World
and not know that the spec has to be lowercase. This can especially be true of friends who have used React / other component approaches which CamelCase things.
PR for the quick fix to add word lowercase
Hello!
I'm trying to use the tool to init a lit / typescript project, but it fails with different errors. This is the full log:
→ npm init @open-wc
_.,,,,,,,,,._
.d'' ``b. Open Web Components Recommendations
.p' Open `q.
.d' Web Components `b. Start or upgrade your web component project with
.d' `b. ease. All our recommendations at your fingertips.
:: ................. ::
`p. .q'
`p. open-wc.org .q'
`b. @openWc .d'
`q.. ..,' See more details at https://open-wc.org/init/
'',,,,,,,,,,''
Note: you can exit any time with Ctrl+C or Esc
✔ What would you like to do today? › Scaffold a new project
✔ What would you like to scaffold? › Application
✔ What would you like to add? › Linting (eslint & prettier), Testing (web-test-runner), Demoing (storybook), Building (rollup)
✔ Would you like to use typescript? › Yes
✔ What is the tag name of your app shell element? … un-copy-art
./
├── un-copy-art/
│ ├── .storybook/
│ │ ├── main.js
│ │ └── server.mjs
│ ├── .vscode/
│ │ └── extensions.json
│ ├── assets/
│ │ └── open-wc-logo.svg
│ ├── src/
│ │ └── un-copy-art.ts
│ ├── stories/
│ │ └── un-copy-art.stories.ts
│ ├── test/
│ │ └── un-copy-art.test.ts
│ ├── .editorconfig
│ ├── .gitignore
│ ├── custom-elements.json
│ ├── index.html
│ ├── LICENSE
│ ├── package.json
│ ├── README.md
│ ├── rollup.config.js
│ ├── tsconfig.json
│ ├── web-dev-server.config.mjs
│ └── web-test-runner.config.mjs
✔ Do you want to write this file structure to disk? › Yes
Writing..... done
✔ Do you want to install dependencies? › Yes, with npm
Installing dependencies...
This might take some time...
Using npm to install...
npm: npm
npm: WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm: npm
npm: WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
added 1098 packages, and audited 1099 packages in 2m
254 packages are looking for funding
run `npm fund` for details
8 high severity vulnerabilities
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
> [email protected] analyze
> cem analyze --litelement
[4:18:37 PM] @custom-elements-manifest/analyzer: Created new manifest.
If you want to rerun this exact same generator you can do so by executing:
npm init @open-wc --destinationPath /home/gfurlan/src/un-copy-art --type scaffold --scaffoldType app --features linting testing demoing building --typescript true --tagName un-copy-art --writeToDisk true --installDependencies npm
You are all set up now!
All you need to do is run:
cd un-copy-art
npm run start
# gfurlan at CPX-J9LPJETWYHX in ~/src [16:18:37]
→ cd un-copy-art
# gfurlan at CPX-J9LPJETWYHX in ~/src/un-copy-art [16:33:53]
→ npm run start
> [email protected] start
> tsc && concurrently -k -r "tsc --watch --preserveWatchOutput" "wds"
node_modules/@open-wc/scoped-elements/types/src/ScopedElementsMixin.d.ts:1:53 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@open-wc/dedupe-mixin")' call instead.
1 export type ScopedElementsMixin = <T extends import("@open-wc/dedupe-mixin").Constructor<import("@lit/reactive-element").ReactiveElement>>(superclass: T) => T & import("@open-wc/dedupe-mixin").Constructor<import("./types").ScopedElementsHost> & typeof import("./types").ScopedElementsHost;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/scoped-elements/types/src/ScopedElementsMixin.d.ts:1:97 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@lit/reactive-element")' call instead.
1 export type ScopedElementsMixin = <T extends import("@open-wc/dedupe-mixin").Constructor<import("@lit/reactive-element").ReactiveElement>>(superclass: T) => T & import("@open-wc/dedupe-mixin").Constructor<import("./types").ScopedElementsHost> & typeof import("./types").ScopedElementsHost;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/scoped-elements/types/src/ScopedElementsMixin.d.ts:1:169 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@open-wc/dedupe-mixin")' call instead.
1 export type ScopedElementsMixin = <T extends import("@open-wc/dedupe-mixin").Constructor<import("@lit/reactive-element").ReactiveElement>>(superclass: T) => T & import("@open-wc/dedupe-mixin").Constructor<import("./types").ScopedElementsHost> & typeof import("./types").ScopedElementsHost;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/scoped-elements/types/src/ScopedElementsMixin.d.ts:7:56 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@open-wc/dedupe-mixin")' call instead.
7 export function ScopedElementsMixin<T_1 extends import("@open-wc/dedupe-mixin").Constructor<HTMLElement>>(superclass: T_1): T_1 & import("@open-wc/dedupe-mixin").Constructor<import("./types").ScopedElementsHost>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/scoped-elements/types/src/ScopedElementsMixin.d.ts:7:138 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@open-wc/dedupe-mixin")' call instead.
7 export function ScopedElementsMixin<T_1 extends import("@open-wc/dedupe-mixin").Constructor<HTMLElement>>(superclass: T_1): T_1 & import("@open-wc/dedupe-mixin").Constructor<import("./types").ScopedElementsHost>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/scoped-elements/types/src/ScopedElementsMixin.d.ts:16:40 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@lit/reactive-element")' call instead.
16 export type CSSResultOrNative = import("@lit/reactive-element").CSSResult | CSSStyleSheet;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/scoped-elements/types/src/types.d.ts:1:29 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@open-wc/dedupe-mixin")' call instead.
1 import { Constructor } from '@open-wc/dedupe-mixin';
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/scoped-elements/types/src/types.d.ts:2:33 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@lit/reactive-element")' call instead.
2 import { ReactiveElement } from '@lit/reactive-element';
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/semantic-dom-diff/chai-dom-diff-plugin.d.ts:3:29 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './get-diffable-html.js'?
3 import { DiffOptions } from "./get-diffable-html";
~~~~~~~~~~~~~~~~~~~~~
node_modules/@open-wc/testing-helpers/types/index.d.ts:2:22 - error TS2307: Cannot find module 'lit-html/static' or its corresponding type declarations.
2 import { html } from "lit-html/static";
~~~~~~~~~~~~~~~~~
node_modules/@open-wc/testing-helpers/types/index.d.ts:3:30 - error TS2307: Cannot find module 'lit-html/static' or its corresponding type declarations.
3 import { unsafeStatic } from "lit-html/static";
~~~~~~~~~~~~~~~~~
node_modules/@open-wc/testing-helpers/types/src/fixture-no-side-effect.d.ts:19:65 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
19 export function fixtureSync<T extends Element>(template: import('./renderable').LitHTMLRenderable, options?: FixtureOptions): T;
~~~~~~~~~~~~~~
node_modules/@open-wc/testing-helpers/types/src/fixture-no-side-effect.d.ts:41:61 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
41 export function fixture<T extends Element>(template: import('./renderable').LitHTMLRenderable, options?: FixtureOptions): Promise<T>;
~~~~~~~~~~~~~~
node_modules/@open-wc/testing-helpers/types/src/litFixture.d.ts:10:68 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
10 export function litFixtureSync<T extends Element>(template: import('./renderable').LitHTMLRenderable, options?: import('./fixture-no-side-effect.js').FixtureOptions, getScopedElementsTemplate?: import('./scopedElementsWrapper.js').ScopedElementsTemplateGetter): T;
~~~~~~~~~~~~~~
node_modules/@open-wc/testing-helpers/types/src/litFixture.d.ts:19:64 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
19 export function litFixture<T extends Element>(template: import('./renderable').LitHTMLRenderable, options?: import('./fixture-no-side-effect.js').FixtureOptions): Promise<T>;
~~~~~~~~~~~~~~
node_modules/@open-wc/testing-helpers/types/src/scopedElementsWrapper.d.ts:8:60 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
8 export function getScopedElementsTemplate(template: import('./renderable').LitHTMLRenderable, scopedElements: ScopedElementsMap): HTMLElement;
~~~~~~~~~~~~~~
test/un-copy-art.test.ts:4:27 - error TS2307: Cannot find module '../src/UnCopyArt.js' or its corresponding type declarations.
4 import { UnCopyArt } from '../src/UnCopyArt.js';
~~~~~~~~~~~~~~~~~~~~~
Found 17 errors in 8 files.
Errors Files
6 node_modules/@open-wc/scoped-elements/types/src/ScopedElementsMixin.d.ts:1
2 node_modules/@open-wc/scoped-elements/types/src/types.d.ts:1
1 node_modules/@open-wc/semantic-dom-diff/chai-dom-diff-plugin.d.ts:3
2 node_modules/@open-wc/testing-helpers/types/index.d.ts:2
2 node_modules/@open-wc/testing-helpers/types/src/fixture-no-side-effect.d.ts:19
2 node_modules/@open-wc/testing-helpers/types/src/litFixture.d.ts:10
1 node_modules/@open-wc/testing-helpers/types/src/scopedElementsWrapper.d.ts:8
1 test/un-copy-art.test.ts:4```
Is it a common problem, or it's my environment? Can you help me please?
Thanks :)
During the create process the initial screen displays a link which leads to a 404, this one https://open-wc.org/init/
I'm currently busy to fix a typo anyways, so I could change it, but to where should the link point?
Should it link to here: https://open-wc.org/docs/development/generator/ ?
I also see that it (the initial screen with the link) is mentioned in the open-wc repository. Is there a link between them or do they need to be updated separately?
There is a lot of duplication between the different parts of the generator, for instance the app and component and JS/TS parts. We should look into a smarter way of reusing code between these parts.
Hello,
We are extending this project to generate our projects bases on frontend form/backend api to configure the content to be generated.
But to writes templates, actually, we can just replace variables.
It means when we have case like loop (for example rendering a list of components), then we have to write/render "ourself" the looped elements inside a variable and then inject the the variable in the template.
It means that the template just content the variable and hide the loop.
-> not clear
-> template content splitted with variable generation and template.
Expected feature
I don't know which is the best template engine at the moment in JS but here some of them:
We should have an automated process which updates the dependencies of the scaffolded projects in the generator.
I used following command to create an application skeleton:
npm init @open-wc --destinationPath /Users/xxx/Desktop/ui-demo --type scaffold --scaffoldType wc --features linting testing demoing --typescript true --tagName ui-demo --writeToDisk true --installDependencies npm
Starting storybook using npm run storybook
leads to:
Error while transforming node_modules/@web/storybook-prebuilt/manager.js: Could not resolve import "react".
storybook dev server starts without errors and I can inspect storybook on http://localhost:8000
.
The README has a bunch of code in it that's really only useful for contributors.
Our readme should just be an args table with some explanation, and this stuff should go in CONTRIBUTING.md
The rollup.config.js generated by npm init @open-wc
is different from the manual setup section on the docs.
I'm not sure if the docs are outdated or if the rollup.config.js output is wrong, but it should be consistent.
When i create new applicaiton using open-wc and try to run the storybook, i am facing below issues.
Error: [@web/dev-server-storybook] The file C:/Users/Ghost/Desktop/Training/web-app/stories/web-app.stories.js is not accessible by the browser because it is outside the root directory C:\Users\Ghost\Desktop\Training\web-app. Change the rootDir option to include this directory.
at createError (C:\Users\Ghost\Desktop\Training\web-app\node_modules@web\dev-server-storybook\dist\shared\utils.js:9:12)
at Object.
When i do the debugging, its look like Root directory and filepath url slash format is different, so facing an issue, the format look like below
RootDir :: C:\Users\Ghost\Desktop\Training\web-app
FilePath :: C:/Users/Ghost/Desktop/Training/web-app/stories/web-app.stories.js
The generator can take some time to install. We can by faster if we bundling the generator with rollup, so that the user just gets a single package to download and run. Perhaps even slim down on the amount of dependencies as well.
Howdy! I really like this project. @thepassle told me to file feedback here.
I was playing around with npm init @open-wc
this month and I had two questions/ideas...
Upgrade Existing Project
is supposed to do or where I'm supposed to run it. Does that only work for any app? Only project made with open-wc? Do I do run the command outside of the project scope like the Scaffold a new project
? Maybe it's related to #58 and it actually does nothing right now, which is why I was confused?Add another component
option would be nice for building out components in a design system or an application. Then I could get a component file, test file, and a stories file?Let me know if I'm not making sense.
After initializing a new component with the following options:
and running npm run storybook
, storybook opens, but shows an error saying:
Couldn't find any stories in your Storybook.
- Please check your stories field of your main.js config.
- Also check the browser console and terminal for error messages.
It's unclear to me what is causing the error, as the glob in .storybook/main.js
appears to be correct, and the <component-name>.stories.js
files are built in dist.
#36 installs some seemingly useless devDependencies:
"@open-wc/testing": "^2.5.33",
"@rollup/plugin-babel": "^5.3.0",
"@web/rollup-plugin-html": "^1.9.1",
"@web/rollup-plugin-import-meta-assets": "^1.0.7",
and
"lit": "^2.0.0-rc.2",
These are here because our integration testing writes actual files to the /create
package root, therefore eslint import plugin is able to resolve them in /create/node_modules
. This is not ideal. Tests which rely on the scaffolded package's node_modules should run e2e in an isolated temp dir that's not affected by create's node_modules, or in a virtual filesystem where deps are stubbed.
Originally posted by @bennypowers in #36 (comment)
Thanks for the brilliant server, test runner & templates - they're a pleasure to use!
I was wondering why HMR wasn't working, so I had just started implementing a base class based on this guide: https://open-wc.org/docs/development/hot-module-replacement/
Then I started thinking "surely someone cleverer than me has already done this" and of course they have - the preset just needed changing from presets.litElement
to presets.lit
in web-dev-server.config.mjs
. Would it be worth updating the template here?
When adding storybook to an existing project the workflow fails to ask which of npm
or yarn
you'd like to use leaving a variable unassigned causing the workflow to fail.
Please consider adding a favicon.ico file, perhaps the open-wc logo, to prevent the console message:
:8000/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
or one of the headers as you have on https://open-wc.org/.
When running npm init @open-wc
on Windows I get the following error:
Error: EPERM: operation not permitted, mkdir 'C:\Users\Mendy'
command not found: create
I tried to reinstall @open-wc/create
already but no luck
I think that it has to do with the space in the directory name C:\Users\Mendy Berger\Documents\whatever
#53 came up in some UX testing with a new developer running init
but just last week when I had a similar issue I came across a package called validate-element-name
- https://www.npmjs.com/package/validate-element-name
This would include valid feedback as to the specific issue in question with what someone enters but what I also noted with it is that they also have additional checks in that I previously have not considered as they are going off the spec -- https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name
This has additional names of elements that are not valid because of conflicts with the name space used elsewhere in the web platform.
If there is interest in adding support for this to match the spec I'd be happy to assign this to a student to work into open-wc this semester.
Hello everybody,
I'm trying to add storybook to an App project I previously initialized using the CLI, but it throws the following error:
$ npm init @open-wc
npx: installed 58 in 0.961s
_.,,,,,,,,,._
.d'' ``b. Open Web Components Recommendations
.p' Open `q.
.d' Web Components `b. Start or upgrade your web component project with
.d' `b. ease. All our recommendations at your fingertips.
:: ................. ::
`p. .q'
`p. open-wc.org .q'
`b. @openWc .d'
`q.. ..,' See more details at https://open-wc.org/init/
'',,,,,,,,,,''
Note: you can exit any time with Ctrl+C or Esc
✔ What would you like to do today? › Upgrade an existing project
✔ What would you like to add? › Demoing (storybook)
✔ Would you like to use typescript? › Yes
✔ What is the tag name of your web component? … my-component
ReferenceError: template:3
1| {
2| "scripts": {
>> 3| "storybook": "tsc && <%= scriptRunCommand %> analyze --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds -c .storybook/server.mjs\"",
4| "storybook:build": "tsc && <%= scriptRunCommand %> analyze --exclude dist && build-storybook"
5| },
6| "devDependencies": {
scriptRunCommand is not defined
After initializing a new component with the following options:
Scaffold a new project
Application
Linting (eslint & prettier)
Testing (web-test-runner)
Demoing (storybook)
Typescript
npm
and running npm run storybook, the following error is thrown:
interneuron:st-app kito$ npm run storybook
> [email protected] storybook
> tsc && npm run analyze -- --exclude dist && concurrently -k -r "tsc --watch --preserveWatchOutput" "wds -c .storybook/server.mjs"
> [email protected] analyze
> cem analyze --litelement --exclude dist
[11:38:31 PM] @custom-elements-manifest/analyzer: Created new manifest.
[11:38:31 PM] Starting compilation in watch mode...
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/kito/Core/Projects/focus.speakertrax/vcs/st-speaker-profile/st-app/.storybook/main.js from /Users/kito/Core/Projects/focus.speakertrax/vcs/st-speaker-profile/st-app/node_modules/@web/dev-server-storybook/dist/shared/config/readStorybookConfig.js not supported.
main.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename main.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/kito/Core/Projects/focus.speakertrax/vcs/st-speaker-profile/st-app/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at Object.readStorybookConfig (/Users/kito/Core/Projects/focus.speakertrax/vcs/st-speaker-profile/st-app/node_modules/@web/dev-server-storybook/dist/shared/config/readStorybookConfig.js:56:35)
at storybookPlugin (/Users/kito/Core/Projects/focus.speakertrax/vcs/st-speaker-profile/st-app/node_modules/@web/dev-server-storybook/dist/serve/storybookPlugin.js:16:51)
at file:///Users/kito/Core/Projects/focus.speakertrax/vcs/st-speaker-profile/st-app/.storybook/server.mjs:7:13 {
code: 'ERR_REQUIRE_ESM'
}
This is potentially related to #87.
Hello,
Which is the utility of common-repo/templates/static/
?
It generate the following files:
Concerning editorconfig, all his job is already made with the configuration of prettier and lint from ´https://github.com/open-wc/create/blob/master/src/generators/linting/templates/package.json´
Concerning license, it is dependent of the project user, here a MIT license file is generated but not every body is using it.
Can't it be removed, or chosen with an option ?
So to resume, does common-repo is necessary since it is the only 2 files added.
Steps:
@custom-elements-manifest/analyzer
as devdep to all templatesanalyze
script to all templatescc @thepassle
Hi,
Currently the build step first runs tsc before running through either rollup and webpack. For me, this seems like it could be optimised by using the relevant plugins, i.e. @rollup/plugin-typescript for rollup and ts-loader for webpack.
The current issue i'm trying to workaround is static assets (such as css) not being including in the out-tsc folder, requiring an extra build step. I'm assuming this would workaround that issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.