Skip to content

Commit 372448e

Browse files
authored
Lots of modernization. (#104)
* ci: run CI against node 18, 20, and 22 * fix: ensure all index.html files leverage the "viewport" meta tag * refactor: only use .js extensions now that the projects are "type=module" * feat: move to Storybook Builder from Storybook Pre-built * feat: update husky to 9.x * fix: remove wallaby templates * deps: use latest OpenWC versions * deps: use latest @web versions * deps: update @babel dependencies * deps: use latest Rollup depednencies * deps: use latest TS * deps: use latest CEM analyzer * deps: use latest lint-staged * deps: use latest prettier depdendencies * deps: update concurrently * deps: use latest rimraf (#110) * deps: latest lint plugins (#111) * deps: use lit@^3.0 (#113) * chore: normalize on using "web-dev-server" over "wds" (#114) * chore: update tsconfig for more modern values (#116) * deps: use latest deepmerge (#117) * fix: remove "require" in ESM contexts (#118) * chore: remove unused dependency (#120) * fix: ensure stories work in TS projects (#119) * fix: correct more info URL in output (#121) * remove: take "@babel/preset-env" out of the generators (#122) * docs: outline node version usage (#126)
1 parent eff59c1 commit 372448e

File tree

67 files changed

+1853
-3547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1853
-3547
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout Repo
16-
uses: actions/checkout@master
16+
uses: actions/checkout@v4
1717
with:
1818
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1919
fetch-depth: 0
2020

21-
- name: Setup Node.js 14.x
22-
uses: actions/setup-node@master
21+
- name: Setup Node.js 22.x
22+
uses: actions/setup-node@v4
2323
with:
24-
node-version: 14.x
24+
node-version: 22.x
2525
registry-url: 'https://registry.npmjs.org'
2626

2727
- name: Get yarn cache directory path

.github/workflows/verify-node.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
node-version: [14.x, 16.x]
15+
node-version: [18.x, 20.x, 22.x]
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818

1919
- name: Setup Node ${{ matrix.node-version }}
20-
uses: actions/setup-node@v2
20+
uses: actions/setup-node@v4
2121
with:
2222
node-version: ${{ matrix.node-version }}
2323
cache: 'yarn'
@@ -31,7 +31,5 @@ jobs:
3131
- name: Lint
3232
run: yarn lint
3333

34-
- run: npm config set scripts-prepend-node-path true
35-
3634
- name: Test
3735
run: yarn test

.github/workflows/verify-windows.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
git config --global core.autocrlf false
1717
git config --global core.eol lf
1818
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
2020

21-
- name: Setup Node 14.x
22-
uses: actions/setup-node@v2
21+
- name: Setup Node 22.x
22+
uses: actions/setup-node@v4
2323
with:
24-
node-version: 14.x
24+
node-version: 22.x
2525
cache: 'yarn'
2626

2727
- name: Install dependencies
@@ -30,7 +30,5 @@ jobs:
3030
- name: Build
3131
run: yarn build
3232

33-
- run: npm config set scripts-prepend-node-path true
34-
3533
- name: Test
3634
run: yarn test

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Web component project scaffolding.
1818
npm init @open-wc
1919
```
2020

21-
<div class="custom-block warning"><p class="custom-block-title">WARNING</p> <p><code>npm init</code> requires node 14 &amp; npm 6 or higher</p></div>
21+
<div class="custom-block warning"><p class="custom-block-title">WARNING</p> <p><code>npm init</code> requires node 18 &amp; npm 6 or higher</p></div>
2222

2323
This will kickstart a menu guiding you through all available actions.
2424

@@ -30,7 +30,7 @@ This will kickstart a menu guiding you through all available actions.
3030
.d' Web Components `b. Start or upgrade your web component project with
3131
.d' `b. ease. All our recommendations at your fingertips.
3232
:: ................. ::
33-
`p. .q' See more details at https://open-wc.org/init/
33+
`p. .q' See more details at https://open-wc.org/docs/development/generator/
3434
`p. open-wc.org .q'
3535
`b. @openWc .d'
3636
`q.. ..,' Note: you can exit any time with Ctrl+C or Esc

package.json

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"access": "public"
66
},
77
"description": "Easily setup all the tools of Open Web Components.",
8+
"engines": {
9+
"node": ">=18.0.0"
10+
},
811
"license": "MIT",
912
"repository": {
1013
"type": "git",
@@ -54,30 +57,30 @@
5457
"devDependencies": {
5558
"@babel/cli": "^7.24.6",
5659
"@babel/core": "^7.24.6",
57-
"@babel/preset-env": "^7.24.6",
5860
"@babel/register": "^7.24.6",
59-
"@custom-elements-manifest/analyzer": "^0.4.17",
60-
"@open-wc/building-rollup": "^2.2.3",
61-
"@open-wc/eslint-config": "^9.2.2",
62-
"@open-wc/testing": "^2.5.33",
63-
"@rollup/plugin-babel": "^5.3.1",
64-
"@web/rollup-plugin-html": "^1.11.1",
65-
"@web/rollup-plugin-import-meta-assets": "^1.0.8",
61+
"@custom-elements-manifest/analyzer": "^0.10.2",
62+
"@open-wc/eslint-config": "^12.0.3",
63+
"@open-wc/testing": "^4.0.0",
64+
"@rollup/plugin-babel": "^6.0.4",
65+
"@rollup/plugin-node-resolve": "^15.2.3",
66+
"@web/rollup-plugin-html": "^2.3.0",
67+
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
6668
"babel-plugin-transform-dynamic-import": "^2.1.0",
6769
"chai": "^4.4.1",
6870
"chai-fs": "^2.0.0",
6971
"eslint": "^8.57.0",
70-
"eslint-config-prettier": "^8.10.0",
72+
"eslint-config-prettier": "^9.1.0",
7173
"eslint-plugin-import": "^2.29.1",
7274
"eslint-plugin-lit": "^1.13.0",
73-
"eslint-plugin-lit-a11y": "^1.1.0",
75+
"eslint-plugin-lit-a11y": "^4.1.2",
7476
"eslint-plugin-wc": "^1.5.0",
75-
"lit": "^2.0.2",
76-
"lit-element": "^2.5.1",
77+
"lit": "^3.0.0",
78+
"lit-element": "^4.0.0",
7779
"mocha": "^9.2.2",
7880
"onchange": "^7.1.0",
79-
"prettier": "^2.8.8",
80-
"rollup-plugin-esbuild": "^5.0.0",
81+
"prettier": "^3.2.5",
82+
"rollup-plugin-esbuild": "^6.1.1",
83+
"rollup-plugin-workbox": "^8.1.0",
8184
"commit-and-tag-version": "^9.6.0"
8285
},
8386
"prettier": {

src/generators/app-lit-element-ts/templates/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"license": "MIT",
44
"type": "module",
55
"scripts": {
6-
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\""
6+
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"web-dev-server\""
77
},
88
"dependencies": {
9-
"lit": "^2.0.2"
9+
"lit": "^3.0.0"
1010
},
1111
"devDependencies": {
12-
"@web/dev-server": "^0.1.38",
13-
"concurrently": "^5.3.0",
14-
"typescript": "^4.5.5",
15-
"tslib": "^2.3.1"
12+
"@web/dev-server": "^0.4.5",
13+
"concurrently": "^8.2.2",
14+
"typescript": "^5.4.5",
15+
"tslib": "^2.6.2"
1616
}
1717
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
module.exports = {
2-
stories: ['../**/out-tsc/stories/*.stories.{js,md,mdx}'],
1+
const config = {
2+
stories: ['../out-tsc/stories/**/*.stories.{js,md,mdx}'],
3+
framework: {
4+
name: '@web/storybook-framework-web-components',
5+
},
36
};
7+
8+
export default config;

src/generators/app-lit-element-ts/templates/static-demoing/.storybook/server.mjs

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.mjs renamed to src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// import { playwrightLauncher } from '@web/test-runner-playwright';
22

3-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
3+
const filteredLogs = ['Running in dev mode', 'Lit is in dev mode'];
44

55
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
66
/** Test files to run */
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"compilerOptions": {
3-
"target": "es2018",
4-
"module": "esnext",
5-
"moduleResolution": "node",
3+
"target": "es2021",
4+
"module": "NodeNext",
5+
"moduleResolution": "NodeNext",
66
"noEmitOnError": true,
7-
"lib": ["es2017", "dom"],
7+
"lib": ["es2021", "dom", "DOM.Iterable"],
88
"strict": true,
99
"esModuleInterop": false,
1010
"allowSyntheticDefaultImports": true,
@@ -14,7 +14,8 @@
1414
"sourceMap": true,
1515
"inlineSources": true,
1616
"rootDir": "./",
17-
"incremental": true
17+
"incremental": true,
18+
"skipLibCheck": true
1819
},
1920
"include": ["**/*.ts"]
2021
}

src/generators/app-lit-element/templates/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"start": "web-dev-server"
77
},
88
"dependencies": {
9-
"lit": "^2.0.2"
9+
"lit": "^3.0.0"
1010
},
1111
"devDependencies": {
12-
"@web/dev-server": "^0.1.38"
12+
"@web/dev-server": "^0.4.5"
1313
}
1414
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
module.exports = {
2-
stories: ['../**/stories/*.stories.{js,md,mdx}'],
1+
const config = {
2+
stories: ['../stories/*.stories.{js,md,mdx}'],
3+
framework: {
4+
name: '@web/storybook-framework-web-components',
5+
},
36
};
7+
8+
export default config;

src/generators/app-lit-element/templates/static-demoing/.storybook/server.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/generators/app-lit-element/templates/static-testing/web-test-runner.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// import { playwrightLauncher } from '@web/test-runner-playwright';
22

3-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
3+
const filteredLogs = ['Running in dev mode', 'Lit is in dev mode'];
44

55
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
66
/** Test files to run */

src/generators/app/header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default `
1010
\`p. .q'
1111
\`p. open-wc.org .q'
1212
\`b. @openWc .d'
13-
\`q.. ..,' See more details at https://open-wc.org/init/
13+
\`q.. ..,' See more details at https://open-wc.org/docs/development/generator/
1414
'',,,,,,,,,,''
1515
1616
`;

src/generators/building-rollup-ts/templates/package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
"start:build": "web-dev-server --root-dir dist --app-index index.html --open"
55
},
66
"devDependencies": {
7-
"@babel/preset-env": "^7.24.6",
8-
"@open-wc/building-rollup": "^2.2.3",
9-
"@rollup/plugin-babel": "^5.3.1",
10-
"@rollup/plugin-node-resolve": "^13.3.0",
11-
"@web/rollup-plugin-html": "^1.11.1",
12-
"@web/rollup-plugin-import-meta-assets": "^1.0.8",
7+
"@rollup/plugin-babel": "^6.0.4",
8+
"@rollup/plugin-node-resolve": "^15.2.3",
9+
"@web/rollup-plugin-html": "^2.3.0",
10+
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
1311
"babel-plugin-template-html-minifier": "^4.1.0",
1412
"deepmerge": "^4.3.1",
15-
"rimraf": "^3.0.2",
16-
"rollup-plugin-esbuild": "^5.0.0",
17-
"rollup-plugin-workbox": "^6.2.2",
18-
"rollup": "^2.60.2"
13+
"rimraf": "^5.0.7",
14+
"rollup-plugin-esbuild": "^6.1.1",
15+
"rollup-plugin-workbox": "^8.1.0",
16+
"rollup": "^4.18.0"
1917
}
2018
}

src/generators/building-rollup-ts/templates/static/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import nodeResolve from '@rollup/plugin-node-resolve';
22
import babel from '@rollup/plugin-babel';
3-
import html from '@web/rollup-plugin-html';
3+
import { rollupPluginHTML as html } from '@web/rollup-plugin-html';
44
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
55
import esbuild from 'rollup-plugin-esbuild';
66
import { generateSW } from 'rollup-plugin-workbox';
@@ -37,7 +37,7 @@ export default {
3737
babel({
3838
plugins: [
3939
[
40-
require.resolve('babel-plugin-template-html-minifier'),
40+
'babel-plugin-template-html-minifier',
4141
{
4242
modules: { lit: ['html', { name: 'css', encapsulation: 'style' }] },
4343
failOnError: false,

src/generators/building-rollup/templates/package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
"start:build": "web-dev-server --root-dir dist --app-index index.html --open"
55
},
66
"devDependencies": {
7-
"@babel/preset-env": "^7.24.6",
8-
"@open-wc/building-rollup": "^2.2.3",
9-
"@rollup/plugin-babel": "^5.3.1",
10-
"@rollup/plugin-node-resolve": "^13.3.0",
11-
"@web/rollup-plugin-html": "^1.11.1",
12-
"@web/rollup-plugin-import-meta-assets": "^1.0.8",
7+
"@rollup/plugin-babel": "^6.0.4",
8+
"@rollup/plugin-node-resolve": "^15.2.3",
9+
"@web/rollup-plugin-html": "^2.3.0",
10+
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
1311
"babel-plugin-template-html-minifier": "^4.1.0",
1412
"deepmerge": "^4.3.1",
15-
"rimraf": "^3.0.2",
16-
"rollup-plugin-esbuild": "^5.0.0",
17-
"rollup-plugin-workbox": "^6.2.2",
18-
"rollup": "^2.60.2"
13+
"rimraf": "^5.0.7",
14+
"rollup-plugin-esbuild": "^6.1.1",
15+
"rollup-plugin-workbox": "^8.1.0",
16+
"rollup": "^4.18.0"
1917
}
2018
}

src/generators/building-rollup/templates/static/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import nodeResolve from '@rollup/plugin-node-resolve';
22
import babel from '@rollup/plugin-babel';
3-
import html from '@web/rollup-plugin-html';
3+
import { rollupPluginHTML as html } from '@web/rollup-plugin-html';
44
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
55
import esbuild from 'rollup-plugin-esbuild';
66
import { generateSW } from 'rollup-plugin-workbox';
@@ -37,7 +37,7 @@ export default {
3737
babel({
3838
plugins: [
3939
[
40-
require.resolve('babel-plugin-template-html-minifier'),
40+
'babel-plugin-template-html-minifier',
4141
{
4242
modules: { lit: ['html', { name: 'css', encapsulation: 'style' }] },
4343
failOnError: false,

src/generators/common-repo/templates/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"analyze": "cem analyze --litelement"
1010
},
1111
"devDependencies": {
12-
"@custom-elements-manifest/analyzer": "^0.4.17"
12+
"@custom-elements-manifest/analyzer": "^0.10.2"
1313
}
1414
}
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
{
22
"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"
3+
"storybook": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"storybook dev -p 8080\"",
4+
"storybook:build": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist && storybook build"
55
},
66
"devDependencies": {
7-
"@web/dev-server-storybook": "^0.5.4"
7+
"@storybook/addon-a11y": "^7.5.0",
8+
"@storybook/addon-essentials": "^7.5.0",
9+
"@storybook/addon-links": "^7.5.0",
10+
"@storybook/web-components": "^7.5.0",
11+
"@web/storybook-builder": "^0.1.16",
12+
"@web/storybook-framework-web-components": "^0.1.2",
13+
"storybook": "^7.5.0"
814
}
915
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
module.exports = {
2-
stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
1+
const config = {
2+
stories: ['../**/dist/stories/*.stories.{js,md,mdx}'],
3+
framework: {
4+
name: '@web/storybook-framework-web-components',
5+
},
36
};
7+
8+
export default config;

0 commit comments

Comments
 (0)