diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6a70320..ff07f597 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,15 +13,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@master + uses: actions/checkout@v4 with: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 - - name: Setup Node.js 14.x - uses: actions/setup-node@master + - name: Setup Node.js 22.x + uses: actions/setup-node@v4 with: - node-version: 14.x + node-version: 22.x registry-url: 'https://registry.npmjs.org' - name: Get yarn cache directory path diff --git a/.github/workflows/verify-node.yml b/.github/workflows/verify-node.yml index 5227437f..4c117231 100644 --- a/.github/workflows/verify-node.yml +++ b/.github/workflows/verify-node.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x, 16.x] + node-version: [18.x, 20.x, 22.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'yarn' @@ -31,7 +31,5 @@ jobs: - name: Lint run: yarn lint - - run: npm config set scripts-prepend-node-path true - - name: Test run: yarn test diff --git a/.github/workflows/verify-windows.yml b/.github/workflows/verify-windows.yml index d85e90e6..5e8c1ceb 100644 --- a/.github/workflows/verify-windows.yml +++ b/.github/workflows/verify-windows.yml @@ -16,12 +16,12 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setup Node 14.x - uses: actions/setup-node@v2 + - name: Setup Node 22.x + uses: actions/setup-node@v4 with: - node-version: 14.x + node-version: 22.x cache: 'yarn' - name: Install dependencies @@ -30,7 +30,5 @@ jobs: - name: Build run: yarn build - - run: npm config set scripts-prepend-node-path true - - name: Test run: yarn test diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..25bf17fc --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/README.md b/README.md index 6a5fff97..c98ff374 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Web component project scaffolding. npm init @open-wc ``` -

WARNING

npm init requires node 14 & npm 6 or higher

+

WARNING

npm init requires node 18 & npm 6 or higher

This will kickstart a menu guiding you through all available actions. @@ -30,7 +30,7 @@ This will kickstart a menu guiding you through all available actions. .d' Web Components `b. Start or upgrade your web component project with .d' `b. ease. All our recommendations at your fingertips. :: ................. :: - `p. .q' See more details at https://open-wc.org/init/ + `p. .q' See more details at https://open-wc.org/docs/development/generator/ `p. open-wc.org .q' `b. @openWc .d' `q.. ..,' Note: you can exit any time with Ctrl+C or Esc diff --git a/package.json b/package.json index 41007be1..b3a4eb96 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "access": "public" }, "description": "Easily setup all the tools of Open Web Components.", + "engines": { + "node": ">=18.0.0" +}, "license": "MIT", "repository": { "type": "git", @@ -54,30 +57,30 @@ "devDependencies": { "@babel/cli": "^7.24.6", "@babel/core": "^7.24.6", - "@babel/preset-env": "^7.24.6", "@babel/register": "^7.24.6", - "@custom-elements-manifest/analyzer": "^0.4.17", - "@open-wc/building-rollup": "^2.2.3", - "@open-wc/eslint-config": "^9.2.2", - "@open-wc/testing": "^2.5.33", - "@rollup/plugin-babel": "^5.3.1", - "@web/rollup-plugin-html": "^1.11.1", - "@web/rollup-plugin-import-meta-assets": "^1.0.8", + "@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": "^8.10.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-lit": "^1.13.0", - "eslint-plugin-lit-a11y": "^1.1.0", + "eslint-plugin-lit-a11y": "^4.1.2", "eslint-plugin-wc": "^1.5.0", - "lit": "^2.0.2", - "lit-element": "^2.5.1", + "lit": "^3.0.0", + "lit-element": "^4.0.0", "mocha": "^9.2.2", "onchange": "^7.1.0", - "prettier": "^2.8.8", - "rollup-plugin-esbuild": "^5.0.0", + "prettier": "^3.2.5", + "rollup-plugin-esbuild": "^6.1.1", + "rollup-plugin-workbox": "^8.1.0", "commit-and-tag-version": "^9.6.0" }, "prettier": { diff --git a/src/generators/app-lit-element-ts/templates/package.json b/src/generators/app-lit-element-ts/templates/package.json index 5fba0eae..42cfe2a8 100644 --- a/src/generators/app-lit-element-ts/templates/package.json +++ b/src/generators/app-lit-element-ts/templates/package.json @@ -3,15 +3,15 @@ "license": "MIT", "type": "module", "scripts": { - "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"" + "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"web-dev-server\"" }, "dependencies": { - "lit": "^2.0.2" + "lit": "^3.0.0" }, "devDependencies": { - "@web/dev-server": "^0.1.38", - "concurrently": "^5.3.0", - "typescript": "^4.5.5", - "tslib": "^2.3.1" + "@web/dev-server": "^0.4.5", + "concurrently": "^8.2.2", + "typescript": "^5.4.5", + "tslib": "^2.6.2" } } diff --git a/src/generators/app-lit-element-ts/templates/static-demoing/.storybook/main.js b/src/generators/app-lit-element-ts/templates/static-demoing/.storybook/main.js index 93ff33dd..81652598 100644 --- a/src/generators/app-lit-element-ts/templates/static-demoing/.storybook/main.js +++ b/src/generators/app-lit-element-ts/templates/static-demoing/.storybook/main.js @@ -1,3 +1,8 @@ -module.exports = { - stories: ['../**/out-tsc/stories/*.stories.{js,md,mdx}'], +const config = { + stories: ['../out-tsc/stories/**/*.stories.{js,md,mdx}'], + framework: { + name: '@web/storybook-framework-web-components', + }, }; + +export default config; \ No newline at end of file diff --git a/src/generators/app-lit-element-ts/templates/static-demoing/.storybook/server.mjs b/src/generators/app-lit-element-ts/templates/static-demoing/.storybook/server.mjs deleted file mode 100644 index 9e919060..00000000 --- a/src/generators/app-lit-element-ts/templates/static-demoing/.storybook/server.mjs +++ /dev/null @@ -1,8 +0,0 @@ -import { storybookPlugin } from '@web/dev-server-storybook'; -import baseConfig from '../web-dev-server.config.mjs'; - -export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ - ...baseConfig, - open: '/', - plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins], -}); diff --git a/src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.mjs b/src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.js similarity index 93% rename from src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.mjs rename to src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.js index f3d46d89..e198fadb 100644 --- a/src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.mjs +++ b/src/generators/app-lit-element-ts/templates/static-testing/web-test-runner.config.js @@ -1,6 +1,6 @@ // import { playwrightLauncher } from '@web/test-runner-playwright'; -const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode']; +const filteredLogs = ['Running in dev mode', 'Lit is in dev mode']; export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ /** Test files to run */ diff --git a/src/generators/app-lit-element-ts/templates/static/web-dev-server.config.mjs b/src/generators/app-lit-element-ts/templates/static/web-dev-server.config.js similarity index 100% rename from src/generators/app-lit-element-ts/templates/static/web-dev-server.config.mjs rename to src/generators/app-lit-element-ts/templates/static/web-dev-server.config.js diff --git a/src/generators/app-lit-element-ts/templates/tsconfig.json b/src/generators/app-lit-element-ts/templates/tsconfig.json index a97d82e7..153ed624 100644 --- a/src/generators/app-lit-element-ts/templates/tsconfig.json +++ b/src/generators/app-lit-element-ts/templates/tsconfig.json @@ -1,10 +1,10 @@ { "compilerOptions": { - "target": "es2018", - "module": "esnext", - "moduleResolution": "node", + "target": "es2021", + "module": "NodeNext", + "moduleResolution": "NodeNext", "noEmitOnError": true, - "lib": ["es2017", "dom"], + "lib": ["es2021", "dom", "DOM.Iterable"], "strict": true, "esModuleInterop": false, "allowSyntheticDefaultImports": true, @@ -14,7 +14,8 @@ "sourceMap": true, "inlineSources": true, "rootDir": "./", - "incremental": true + "incremental": true, + "skipLibCheck": true }, "include": ["**/*.ts"] } diff --git a/src/generators/app-lit-element/templates/package.json b/src/generators/app-lit-element/templates/package.json index 4929158c..6e4bd45e 100644 --- a/src/generators/app-lit-element/templates/package.json +++ b/src/generators/app-lit-element/templates/package.json @@ -6,9 +6,9 @@ "start": "web-dev-server" }, "dependencies": { - "lit": "^2.0.2" + "lit": "^3.0.0" }, "devDependencies": { - "@web/dev-server": "^0.1.38" + "@web/dev-server": "^0.4.5" } } \ No newline at end of file diff --git a/src/generators/app-lit-element/templates/static-demoing/.storybook/main.js b/src/generators/app-lit-element/templates/static-demoing/.storybook/main.js index 94f9cf85..0b7f2c48 100644 --- a/src/generators/app-lit-element/templates/static-demoing/.storybook/main.js +++ b/src/generators/app-lit-element/templates/static-demoing/.storybook/main.js @@ -1,3 +1,8 @@ -module.exports = { - stories: ['../**/stories/*.stories.{js,md,mdx}'], +const config = { + stories: ['../stories/*.stories.{js,md,mdx}'], + framework: { + name: '@web/storybook-framework-web-components', + }, }; + +export default config; \ No newline at end of file diff --git a/src/generators/app-lit-element/templates/static-demoing/.storybook/server.js b/src/generators/app-lit-element/templates/static-demoing/.storybook/server.js deleted file mode 100644 index 1b68ac5f..00000000 --- a/src/generators/app-lit-element/templates/static-demoing/.storybook/server.js +++ /dev/null @@ -1,8 +0,0 @@ -import { storybookPlugin } from '@web/dev-server-storybook'; -import baseConfig from '../web-dev-server.config.js'; - -export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ - ...baseConfig, - open: '/', - plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins], -}); diff --git a/src/generators/app-lit-element/templates/static-testing/web-test-runner.config.js b/src/generators/app-lit-element/templates/static-testing/web-test-runner.config.js index be213a54..64614172 100644 --- a/src/generators/app-lit-element/templates/static-testing/web-test-runner.config.js +++ b/src/generators/app-lit-element/templates/static-testing/web-test-runner.config.js @@ -1,6 +1,6 @@ // import { playwrightLauncher } from '@web/test-runner-playwright'; -const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode']; +const filteredLogs = ['Running in dev mode', 'Lit is in dev mode']; export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ /** Test files to run */ diff --git a/src/generators/app/header.js b/src/generators/app/header.js index 13373809..fe26deba 100644 --- a/src/generators/app/header.js +++ b/src/generators/app/header.js @@ -10,7 +10,7 @@ export default ` \`p. .q' \`p. open-wc.org .q' \`b. @openWc .d' - \`q.. ..,' See more details at https://open-wc.org/init/ + \`q.. ..,' See more details at https://open-wc.org/docs/development/generator/ '',,,,,,,,,,'' `; diff --git a/src/generators/building-rollup-ts/templates/package.json b/src/generators/building-rollup-ts/templates/package.json index 357e62bb..e5fb5e40 100644 --- a/src/generators/building-rollup-ts/templates/package.json +++ b/src/generators/building-rollup-ts/templates/package.json @@ -4,17 +4,15 @@ "start:build": "web-dev-server --root-dir dist --app-index index.html --open" }, "devDependencies": { - "@babel/preset-env": "^7.24.6", - "@open-wc/building-rollup": "^2.2.3", - "@rollup/plugin-babel": "^5.3.1", - "@rollup/plugin-node-resolve": "^13.3.0", - "@web/rollup-plugin-html": "^1.11.1", - "@web/rollup-plugin-import-meta-assets": "^1.0.8", + "@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": "^3.0.2", - "rollup-plugin-esbuild": "^5.0.0", - "rollup-plugin-workbox": "^6.2.2", - "rollup": "^2.60.2" + "rimraf": "^5.0.7", + "rollup-plugin-esbuild": "^6.1.1", + "rollup-plugin-workbox": "^8.1.0", + "rollup": "^4.18.0" } } diff --git a/src/generators/building-rollup-ts/templates/static/rollup.config.js b/src/generators/building-rollup-ts/templates/static/rollup.config.js index 087a1473..5e159b00 100644 --- a/src/generators/building-rollup-ts/templates/static/rollup.config.js +++ b/src/generators/building-rollup-ts/templates/static/rollup.config.js @@ -1,6 +1,6 @@ import nodeResolve from '@rollup/plugin-node-resolve'; import babel from '@rollup/plugin-babel'; -import html from '@web/rollup-plugin-html'; +import { rollupPluginHTML as html } from '@web/rollup-plugin-html'; import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets'; import esbuild from 'rollup-plugin-esbuild'; import { generateSW } from 'rollup-plugin-workbox'; @@ -37,7 +37,7 @@ export default { babel({ plugins: [ [ - require.resolve('babel-plugin-template-html-minifier'), + 'babel-plugin-template-html-minifier', { modules: { lit: ['html', { name: 'css', encapsulation: 'style' }] }, failOnError: false, diff --git a/src/generators/building-rollup/templates/package.json b/src/generators/building-rollup/templates/package.json index 60bde127..20e29d3a 100644 --- a/src/generators/building-rollup/templates/package.json +++ b/src/generators/building-rollup/templates/package.json @@ -4,17 +4,15 @@ "start:build": "web-dev-server --root-dir dist --app-index index.html --open" }, "devDependencies": { - "@babel/preset-env": "^7.24.6", - "@open-wc/building-rollup": "^2.2.3", - "@rollup/plugin-babel": "^5.3.1", - "@rollup/plugin-node-resolve": "^13.3.0", - "@web/rollup-plugin-html": "^1.11.1", - "@web/rollup-plugin-import-meta-assets": "^1.0.8", + "@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": "^3.0.2", - "rollup-plugin-esbuild": "^5.0.0", - "rollup-plugin-workbox": "^6.2.2", - "rollup": "^2.60.2" + "rimraf": "^5.0.7", + "rollup-plugin-esbuild": "^6.1.1", + "rollup-plugin-workbox": "^8.1.0", + "rollup": "^4.18.0" } } diff --git a/src/generators/building-rollup/templates/static/rollup.config.js b/src/generators/building-rollup/templates/static/rollup.config.js index 233afcc5..9fcc2769 100644 --- a/src/generators/building-rollup/templates/static/rollup.config.js +++ b/src/generators/building-rollup/templates/static/rollup.config.js @@ -1,6 +1,6 @@ import nodeResolve from '@rollup/plugin-node-resolve'; import babel from '@rollup/plugin-babel'; -import html from '@web/rollup-plugin-html'; +import { rollupPluginHTML as html } from '@web/rollup-plugin-html'; import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets'; import esbuild from 'rollup-plugin-esbuild'; import { generateSW } from 'rollup-plugin-workbox'; @@ -37,7 +37,7 @@ export default { babel({ plugins: [ [ - require.resolve('babel-plugin-template-html-minifier'), + 'babel-plugin-template-html-minifier', { modules: { lit: ['html', { name: 'css', encapsulation: 'style' }] }, failOnError: false, diff --git a/src/generators/common-repo/templates/package.json b/src/generators/common-repo/templates/package.json index 18227036..bd0d4664 100644 --- a/src/generators/common-repo/templates/package.json +++ b/src/generators/common-repo/templates/package.json @@ -9,6 +9,6 @@ "analyze": "cem analyze --litelement" }, "devDependencies": { - "@custom-elements-manifest/analyzer": "^0.4.17" + "@custom-elements-manifest/analyzer": "^0.10.2" } } diff --git a/src/generators/demoing-storybook-ts/templates/package.json b/src/generators/demoing-storybook-ts/templates/package.json index faa096f3..a109fcf8 100644 --- a/src/generators/demoing-storybook-ts/templates/package.json +++ b/src/generators/demoing-storybook-ts/templates/package.json @@ -1,9 +1,15 @@ { "scripts": { - "storybook": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds -c .storybook/server.mjs\"", - "storybook:build": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist && build-storybook" + "storybook": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"storybook dev -p 8080\"", + "storybook:build": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist && storybook build" }, "devDependencies": { - "@web/dev-server-storybook": "^0.5.4" + "@storybook/addon-a11y": "^7.5.0", + "@storybook/addon-essentials": "^7.5.0", + "@storybook/addon-links": "^7.5.0", + "@storybook/web-components": "^7.5.0", + "@web/storybook-builder": "^0.1.16", + "@web/storybook-framework-web-components": "^0.1.2", + "storybook": "^7.5.0" } } diff --git a/src/generators/demoing-storybook-ts/templates/static/.storybook/main.js b/src/generators/demoing-storybook-ts/templates/static/.storybook/main.js index cbdd0566..efe8a072 100644 --- a/src/generators/demoing-storybook-ts/templates/static/.storybook/main.js +++ b/src/generators/demoing-storybook-ts/templates/static/.storybook/main.js @@ -1,3 +1,8 @@ -module.exports = { - stories: ['../dist/stories/**/*.stories.{js,md,mdx}'], +const config = { + stories: ['../**/dist/stories/*.stories.{js,md,mdx}'], + framework: { + name: '@web/storybook-framework-web-components', + }, }; + +export default config; \ No newline at end of file diff --git a/src/generators/demoing-storybook-ts/templates/static/.storybook/server.mjs b/src/generators/demoing-storybook-ts/templates/static/.storybook/server.mjs deleted file mode 100644 index 9e919060..00000000 --- a/src/generators/demoing-storybook-ts/templates/static/.storybook/server.mjs +++ /dev/null @@ -1,8 +0,0 @@ -import { storybookPlugin } from '@web/dev-server-storybook'; -import baseConfig from '../web-dev-server.config.mjs'; - -export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ - ...baseConfig, - open: '/', - plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins], -}); diff --git a/src/generators/demoing-storybook/templates/package.json b/src/generators/demoing-storybook/templates/package.json index f0ff281f..27f7d6f2 100644 --- a/src/generators/demoing-storybook/templates/package.json +++ b/src/generators/demoing-storybook/templates/package.json @@ -1,9 +1,15 @@ { "scripts": { - "storybook": "<%= scriptRunCommand %> analyze -- --exclude dist && web-dev-server -c .storybook/server.mjs", - "storybook:build": "<%= scriptRunCommand %> analyze -- --exclude dist && build-storybook" + "storybook": "<%= scriptRunCommand %> analyze -- --exclude dist && storybook dev -p 8080", + "storybook:build": "<%= scriptRunCommand %> analyze -- --exclude dist && storybook build" }, "devDependencies": { - "@web/dev-server-storybook": "^0.5.4" + "@storybook/addon-a11y": "^7.5.0", + "@storybook/addon-essentials": "^7.5.0", + "@storybook/addon-links": "^7.5.0", + "@storybook/web-components": "^7.5.0", + "@web/storybook-builder": "^0.1.16", + "@web/storybook-framework-web-components": "^0.1.2", + "storybook": "^7.5.0" } } diff --git a/src/generators/demoing-storybook/templates/static/.storybook/main.js b/src/generators/demoing-storybook/templates/static/.storybook/main.js index b3a4c59d..0b7f2c48 100644 --- a/src/generators/demoing-storybook/templates/static/.storybook/main.js +++ b/src/generators/demoing-storybook/templates/static/.storybook/main.js @@ -1,3 +1,8 @@ -module.exports = { - stories: ['../stories/**/*.stories.{js,md,mdx}'], +const config = { + stories: ['../stories/*.stories.{js,md,mdx}'], + framework: { + name: '@web/storybook-framework-web-components', + }, }; + +export default config; \ No newline at end of file diff --git a/src/generators/demoing-storybook/templates/static/.storybook/server.mjs b/src/generators/demoing-storybook/templates/static/.storybook/server.mjs deleted file mode 100644 index 9e919060..00000000 --- a/src/generators/demoing-storybook/templates/static/.storybook/server.mjs +++ /dev/null @@ -1,8 +0,0 @@ -import { storybookPlugin } from '@web/dev-server-storybook'; -import baseConfig from '../web-dev-server.config.mjs'; - -export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ - ...baseConfig, - open: '/', - plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins], -}); diff --git a/src/generators/linting-eslint-ts/templates/package.json b/src/generators/linting-eslint-ts/templates/package.json index bc5034ca..90efe06e 100644 --- a/src/generators/linting-eslint-ts/templates/package.json +++ b/src/generators/linting-eslint-ts/templates/package.json @@ -1,9 +1,9 @@ { "devDependencies": { "eslint": "^8.57.0", - "@open-wc/eslint-config": "^9.2.2", - "@typescript-eslint/parser": "^5.48.2", - "@typescript-eslint/eslint-plugin": "^5.48.2" + "@open-wc/eslint-config": "^12.0.3", + "@typescript-eslint/parser": "^7.10.0", + "@typescript-eslint/eslint-plugin": "^7.10.0" }, "eslintConfig": { "parser": "@typescript-eslint/parser", diff --git a/src/generators/linting-eslint/templates/package.json b/src/generators/linting-eslint/templates/package.json index 9674d3f8..c808b64b 100644 --- a/src/generators/linting-eslint/templates/package.json +++ b/src/generators/linting-eslint/templates/package.json @@ -1,7 +1,7 @@ { "devDependencies": { "eslint": "^8.57.0", - "@open-wc/eslint-config": "^9.2.2" + "@open-wc/eslint-config": "^12.0.3" }, "eslintConfig": { "extends": [ diff --git a/src/generators/linting-prettier-ts/templates/package.json b/src/generators/linting-prettier-ts/templates/package.json index 7eedbd1a..036c0416 100644 --- a/src/generators/linting-prettier-ts/templates/package.json +++ b/src/generators/linting-prettier-ts/templates/package.json @@ -1,7 +1,7 @@ { "devDependencies": { - "prettier": "^2.8.8", - "eslint-config-prettier": "^8.10.0" + "prettier": "^3.2.5", + "eslint-config-prettier": "^9.1.0" }, "eslintConfig": { "extends": [ diff --git a/src/generators/linting-prettier/templates/package.json b/src/generators/linting-prettier/templates/package.json index 7eedbd1a..036c0416 100644 --- a/src/generators/linting-prettier/templates/package.json +++ b/src/generators/linting-prettier/templates/package.json @@ -1,7 +1,7 @@ { "devDependencies": { - "prettier": "^2.8.8", - "eslint-config-prettier": "^8.10.0" + "prettier": "^3.2.5", + "eslint-config-prettier": "^9.1.0" }, "eslintConfig": { "extends": [ diff --git a/src/generators/linting-ts/index.js b/src/generators/linting-ts/index.js index 7c87b153..453f0702 100644 --- a/src/generators/linting-ts/index.js +++ b/src/generators/linting-ts/index.js @@ -12,5 +12,7 @@ export const TsLintingMixin = subclass => `${__dirname}/templates/package.json`, this.destinationPath('package.json'), ); + + await this.copyTemplates(`${__dirname}/templates/static/**/*`); } }; diff --git a/src/generators/linting-ts/templates/package.json b/src/generators/linting-ts/templates/package.json index cd2b6f2b..eee454e8 100644 --- a/src/generators/linting-ts/templates/package.json +++ b/src/generators/linting-ts/templates/package.json @@ -1,9 +1,4 @@ { - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, "lint-staged": { "*.ts": [ "eslint --fix", @@ -12,10 +7,11 @@ }, "scripts": { "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore", - "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore" + "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore", + "prepare": "husky" }, "devDependencies": { - "husky": "^4.3.8", - "lint-staged": "^10.5.4" + "husky": "^9.0.11", + "lint-staged": "^15.2.5" } } diff --git a/src/generators/linting-ts/templates/static/.husky/pre-commit b/src/generators/linting-ts/templates/static/.husky/pre-commit new file mode 100644 index 00000000..f568382f --- /dev/null +++ b/src/generators/linting-ts/templates/static/.husky/pre-commit @@ -0,0 +1 @@ +./node_modules/.bin/lint-staged \ No newline at end of file diff --git a/src/generators/linting-types-js/templates/package.json b/src/generators/linting-types-js/templates/package.json index eb523752..664e9370 100644 --- a/src/generators/linting-types-js/templates/package.json +++ b/src/generators/linting-types-js/templates/package.json @@ -3,6 +3,6 @@ "lint:types": "tsc" }, "devDependencies": { - "typescript": "~4.5.5" + "typescript": "^5.4.5" } } diff --git a/src/generators/linting-types-js/templates/static/tsconfig.json b/src/generators/linting-types-js/templates/static/tsconfig.json index d4cd9e09..34830958 100644 --- a/src/generators/linting-types-js/templates/static/tsconfig.json +++ b/src/generators/linting-types-js/templates/static/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "lib": ["es2017", "dom"], + "target": "es2021", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["es2021", "dom", "DOM.Iterable"], "allowJs": true, "checkJs": true, "noEmit": true, diff --git a/src/generators/linting/index.js b/src/generators/linting/index.js index 2455f960..af62c90f 100644 --- a/src/generators/linting/index.js +++ b/src/generators/linting/index.js @@ -12,5 +12,7 @@ export const LintingMixin = subclass => `${__dirname}/templates/package.json`, this.destinationPath('package.json'), ); + + await this.copyTemplates(`${__dirname}/templates/static/**/*`); } }; diff --git a/src/generators/linting/templates/package.json b/src/generators/linting/templates/package.json index 884278b2..a983d04a 100644 --- a/src/generators/linting/templates/package.json +++ b/src/generators/linting/templates/package.json @@ -1,9 +1,4 @@ { - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, "lint-staged": { "*.js": [ "eslint --fix", @@ -12,10 +7,11 @@ }, "scripts": { "lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.js\" --check --ignore-path .gitignore", - "format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.js\" --write --ignore-path .gitignore" + "format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.js\" --write --ignore-path .gitignore", + "prepare": "husky" }, "devDependencies": { - "husky": "^4.3.8", - "lint-staged": "^10.5.4" + "husky": "^9.0.11", + "lint-staged": "^15.2.5" } } diff --git a/src/generators/linting/templates/static/.husky/pre-commit b/src/generators/linting/templates/static/.husky/pre-commit new file mode 100644 index 00000000..f568382f --- /dev/null +++ b/src/generators/linting/templates/static/.husky/pre-commit @@ -0,0 +1 @@ +./node_modules/.bin/lint-staged \ No newline at end of file diff --git a/src/generators/testing-ts/templates/package.json b/src/generators/testing-ts/templates/package.json index b8f3ec3c..994827c9 100644 --- a/src/generators/testing-ts/templates/package.json +++ b/src/generators/testing-ts/templates/package.json @@ -1,5 +1,6 @@ { "devDependencies": { - "@open-wc/testing": "^3.1.8" + "@open-wc/testing": "^4.0.0", + "@types/mocha": "^10.0.6" } } diff --git a/src/generators/testing-wallaby/index.js b/src/generators/testing-wallaby/index.js deleted file mode 100644 index 0af4540c..00000000 --- a/src/generators/testing-wallaby/index.js +++ /dev/null @@ -1,13 +0,0 @@ -export const TestingWallabyMixin = subclass => - class extends subclass { - async execute() { - await super.execute(); - - this.copyTemplateJsonInto( - `${__dirname}/templates/package.json`, - this.destinationPath('package.json'), - ); - - await this.copyTemplates(`${__dirname}/templates/static/**/*`); - } - }; diff --git a/src/generators/testing-wallaby/templates/package.json b/src/generators/testing-wallaby/templates/package.json deleted file mode 100644 index b905ced1..00000000 --- a/src/generators/testing-wallaby/templates/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "devDependencies": { - "@open-wc/testing-wallaby": "^0.1.14" - } -} diff --git a/src/generators/testing-wallaby/templates/static/wallaby.js b/src/generators/testing-wallaby/templates/static/wallaby.js deleted file mode 100644 index e68d0948..00000000 --- a/src/generators/testing-wallaby/templates/static/wallaby.js +++ /dev/null @@ -1,23 +0,0 @@ -const wallabyWebpack = require('wallaby-webpack'); // eslint-disable-line import/no-extraneous-dependencies -const path = require('path'); - -const wallabyPostprocessor = wallabyWebpack({ - resolve: { - modules: [path.resolve(__dirname, 'bower_components'), 'node_modules'], - }, -}); - -module.exports = () => ({ - files: [{ pattern: '*.js', load: false }, '!wallaby.js', '!*.config.js', '!*.conf.js'], - tests: [{ pattern: 'test/*.test.js', load: false }], - testFramework: 'mocha', - debug: true, - env: { - kind: 'chrome', - }, - postprocessor: wallabyPostprocessor, - setup: () => { - // required to trigger test loading - window.__moduleBundler.loadTests(); - }, -}); diff --git a/src/generators/testing-wtr-ts/templates/package.json b/src/generators/testing-wtr-ts/templates/package.json index 89d9b3eb..4e6f598f 100644 --- a/src/generators/testing-wtr-ts/templates/package.json +++ b/src/generators/testing-wtr-ts/templates/package.json @@ -4,6 +4,6 @@ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"" }, "devDependencies": { - "@web/test-runner": "^0.14.1" + "@web/test-runner": "^0.18.2" } } \ No newline at end of file diff --git a/src/generators/testing-wtr-ts/templates/static/web-test-runner.config.mjs b/src/generators/testing-wtr-ts/templates/static/web-test-runner.config.js similarity index 93% rename from src/generators/testing-wtr-ts/templates/static/web-test-runner.config.mjs rename to src/generators/testing-wtr-ts/templates/static/web-test-runner.config.js index 057210b4..a5f9f8b5 100644 --- a/src/generators/testing-wtr-ts/templates/static/web-test-runner.config.mjs +++ b/src/generators/testing-wtr-ts/templates/static/web-test-runner.config.js @@ -1,6 +1,6 @@ // import { playwrightLauncher } from '@web/test-runner-playwright'; -const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode']; +const filteredLogs = ['Running in dev mode', 'Lit is in dev mode']; export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ /** Test files to run */ diff --git a/src/generators/testing-wtr/templates/package.json b/src/generators/testing-wtr/templates/package.json index c69fdb1c..13d27ae4 100644 --- a/src/generators/testing-wtr/templates/package.json +++ b/src/generators/testing-wtr/templates/package.json @@ -4,6 +4,6 @@ "test:watch": "web-test-runner --watch" }, "devDependencies": { - "@web/test-runner": "^0.14.1" + "@web/test-runner": "^0.18.2" } } \ No newline at end of file diff --git a/test/snapshots/fully-loaded-app/web-test-runner.config.mjs b/src/generators/testing-wtr/templates/static/web-test-runner.config.js similarity index 93% rename from test/snapshots/fully-loaded-app/web-test-runner.config.mjs rename to src/generators/testing-wtr/templates/static/web-test-runner.config.js index be213a54..64614172 100644 --- a/test/snapshots/fully-loaded-app/web-test-runner.config.mjs +++ b/src/generators/testing-wtr/templates/static/web-test-runner.config.js @@ -1,6 +1,6 @@ // import { playwrightLauncher } from '@web/test-runner-playwright'; -const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode']; +const filteredLogs = ['Running in dev mode', 'Lit is in dev mode']; export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ /** Test files to run */ diff --git a/src/generators/testing-wtr/templates/static/web-test-runner.config.mjs b/src/generators/testing-wtr/templates/static/web-test-runner.config.mjs deleted file mode 100644 index be213a54..00000000 --- a/src/generators/testing-wtr/templates/static/web-test-runner.config.mjs +++ /dev/null @@ -1,41 +0,0 @@ -// import { playwrightLauncher } from '@web/test-runner-playwright'; - -const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode']; - -export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ - /** Test files to run */ - files: 'test/**/*.test.js', - - /** Resolve bare module imports */ - nodeResolve: { - exportConditions: ['browser', 'development'], - }, - - /** Filter out lit dev mode logs */ - filterBrowserLogs(log) { - for (const arg of log.args) { - if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) { - return false; - } - } - return true; - }, - - /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */ - // esbuildTarget: 'auto', - - /** Amount of browsers to run concurrently */ - // concurrentBrowsers: 2, - - /** Amount of test files per browser to test concurrently */ - // concurrency: 1, - - /** Browsers to run tests on */ - // browsers: [ - // playwrightLauncher({ product: 'chromium' }), - // playwrightLauncher({ product: 'firefox' }), - // playwrightLauncher({ product: 'webkit' }), - // ], - - // See documentation for all available options -}); diff --git a/src/generators/testing/templates/package.json b/src/generators/testing/templates/package.json index b8f3ec3c..243e5543 100644 --- a/src/generators/testing/templates/package.json +++ b/src/generators/testing/templates/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "@open-wc/testing": "^3.1.8" + "@open-wc/testing": "^4.0.0" } } diff --git a/src/generators/wc-lit-element-ts/index.js b/src/generators/wc-lit-element-ts/index.js index c80b63b1..efaf2046 100644 --- a/src/generators/wc-lit-element-ts/index.js +++ b/src/generators/wc-lit-element-ts/index.js @@ -9,7 +9,7 @@ const compose = (...fns) => (...args) => f(g(...args)), ); -const safeReduce = (f, initial) => xs => Array.isArray(xs) ? xs.reduce(f, initial) : xs; +const safeReduce = (f, initial) => xs => (Array.isArray(xs) ? xs.reduce(f, initial) : xs); const getTemplatePart = compose(processTemplate, readFileFromPath); diff --git a/src/generators/wc-lit-element-ts/templates/package.json b/src/generators/wc-lit-element-ts/templates/package.json index 387aa6a1..19f41428 100644 --- a/src/generators/wc-lit-element-ts/templates/package.json +++ b/src/generators/wc-lit-element-ts/templates/package.json @@ -7,17 +7,17 @@ "./<%= tagName %>.js": "./dist/src/<%= tagName %>.js" }, "scripts": { - "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"", + "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"web-dev-server\"", "build": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist", "prepublish": "tsc && <%= scriptRunCommand %> analyze -- --exclude dist" }, "dependencies": { - "lit": "^2.0.2" + "lit": "^3.0.0" }, "devDependencies": { - "@web/dev-server": "^0.1.38", - "concurrently": "^5.3.0", - "typescript": "^4.5.5", - "tslib": "^2.3.1" + "@web/dev-server": "^0.4.5", + "concurrently": "^8.2.2", + "typescript": "^5.4.5", + "tslib": "^2.6.2" } } diff --git a/src/generators/wc-lit-element-ts/templates/static/demo/index.html b/src/generators/wc-lit-element-ts/templates/static/demo/index.html index a6514c99..3b5a6ed5 100644 --- a/src/generators/wc-lit-element-ts/templates/static/demo/index.html +++ b/src/generators/wc-lit-element-ts/templates/static/demo/index.html @@ -2,6 +2,7 @@ +