@blockquote/create-wc 2.12.1 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +12 -8
- package/src/common-linting/templates/package.json +11 -11
- package/src/common-repo/templates/eslint.config.js +0 -1
- package/src/common-repo/templates/package.json +20 -21
- package/src/common-repo/templates/static/vite.config.js +27 -9
- package/src/wc-lit-element/templates/package.json +1 -0
- package/src/wc-lit-element/templates/tsconfig.json +8 -3
- package/src/wc-lit-element-ts/templates/package.json +2 -1
- package/src/wc-lit-element-ts/templates/tsconfig.json +11 -3
- package/src/wc-lit-element-ts/templates/vite.lib.config.js +25 -7
package/README.md
CHANGED
|
@@ -163,3 +163,4 @@ The repository itself is intentionally small: it assembles mixins and templates
|
|
|
163
163
|
|
|
164
164
|
- [rollup-plugin-total-bundlesize](https://github.com/oscarmarina/rollup-plugin-total-bundlesize)
|
|
165
165
|
- [vite-plugin-prevent-rewrite-imports-type-module](https://github.com/oscarmarina/vite-plugin-prevent-rewrite-imports-type-module/tree/main)
|
|
166
|
+
- [Create TypeScript Declarations from JavaScript JSDoc](https://humanwhocodes.com/snippets/2020/10/create-typescript-declarations-from-javascript-jsdoc/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote/create-wc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Web component with Lit scaffolding - Extending Open Web Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit",
|
|
@@ -30,18 +30,22 @@
|
|
|
30
30
|
"start": "node ./src/create.js"
|
|
31
31
|
},
|
|
32
32
|
"prettier": {
|
|
33
|
-
"bracketSameLine": true,
|
|
34
|
-
"htmlWhitespaceSensitivity": "ignore",
|
|
35
|
-
"singleQuote": true,
|
|
36
33
|
"bracketSpacing": false,
|
|
37
|
-
"trailingComma": "es5",
|
|
38
34
|
"printWidth": 100,
|
|
35
|
+
"singleQuote": true,
|
|
36
|
+
"trailingComma": "es5",
|
|
39
37
|
"overrides": [
|
|
40
38
|
{
|
|
41
39
|
"files": "*.{scss,css}",
|
|
42
40
|
"options": {
|
|
43
41
|
"singleQuote": false
|
|
44
42
|
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"files": "*.json",
|
|
46
|
+
"options": {
|
|
47
|
+
"parser": "json-stringify"
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
]
|
|
47
51
|
},
|
|
@@ -55,10 +59,10 @@
|
|
|
55
59
|
"devDependencies": {
|
|
56
60
|
"@eslint/js": "^10.0.1",
|
|
57
61
|
"@open-wc/eslint-config": "^13.1.0",
|
|
58
|
-
"eslint": "^10.
|
|
62
|
+
"eslint": "^10.6.0",
|
|
59
63
|
"eslint-config-prettier": "^10.1.8",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
64
|
+
"globals": "^17.7.0",
|
|
65
|
+
"prettier": "^3.9.4"
|
|
62
66
|
},
|
|
63
67
|
"publishConfig": {
|
|
64
68
|
"access": "public"
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"prettier": {
|
|
21
|
-
"singleQuote": true,
|
|
22
21
|
"bracketSpacing": false,
|
|
23
|
-
"trailingComma": "es5",
|
|
24
22
|
"printWidth": 100,
|
|
23
|
+
"singleQuote": true,
|
|
24
|
+
"trailingComma": "es5",
|
|
25
25
|
"overrides": [
|
|
26
26
|
{
|
|
27
27
|
"files": "*.{scss,css}",
|
|
@@ -69,22 +69,22 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@eslint/js": "^10.0.1",
|
|
72
|
-
"@html-eslint/eslint-plugin": "^0.
|
|
73
|
-
"@html-eslint/parser": "^0.
|
|
74
|
-
"eslint": "^10.
|
|
72
|
+
"@html-eslint/eslint-plugin": "^0.63.0",
|
|
73
|
+
"@html-eslint/parser": "^0.63.0",
|
|
74
|
+
"eslint": "^10.6.0",
|
|
75
75
|
"eslint-config-prettier": "^10.1.8",
|
|
76
|
-
"eslint-plugin-html": "^8.1.4",
|
|
77
|
-
"eslint-plugin-import-x": "^4.17.0",
|
|
78
76
|
"eslint-import-resolver-typescript": "4.4.5",
|
|
77
|
+
"eslint-plugin-html": "^8.1.4",
|
|
78
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
79
79
|
"eslint-plugin-lit": "^2.3.1",
|
|
80
80
|
"eslint-plugin-lit-a11y": "^5.1.1",
|
|
81
81
|
"eslint-plugin-wc": "^3.1.0",
|
|
82
|
-
"typescript-eslint": "^8.62.0",
|
|
83
82
|
"globals": "^17.7.0",
|
|
84
83
|
"husky": "^9.1.7",
|
|
85
84
|
"lint-staged": "^17.0.8",
|
|
86
|
-
"prettier": "^3.
|
|
87
|
-
"stylelint": "^17.
|
|
88
|
-
"stylelint-config-standard-scss": "^17.0.0"
|
|
85
|
+
"prettier": "^3.9.4",
|
|
86
|
+
"stylelint": "^17.14.0",
|
|
87
|
+
"stylelint-config-standard-scss": "^17.0.0",
|
|
88
|
+
"typescript-eslint": "^8.63.0"
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -9,7 +9,6 @@ import htmlEslintParser from '@html-eslint/parser';
|
|
|
9
9
|
import eslintPluginHtml from 'eslint-plugin-html';
|
|
10
10
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
11
11
|
import globals from 'globals';
|
|
12
|
-
import path from 'node:path';
|
|
13
12
|
|
|
14
13
|
const fileTypes = '{js,ts,mjs}';
|
|
15
14
|
|
|
@@ -7,21 +7,19 @@
|
|
|
7
7
|
"web-component",
|
|
8
8
|
"lit-element"
|
|
9
9
|
],
|
|
10
|
-
"author": "<%= tagName %>",
|
|
11
10
|
"license": "MIT",
|
|
12
|
-
"
|
|
11
|
+
"author": "<%= tagName %>",
|
|
13
12
|
"type": "module",
|
|
14
13
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
-
"vite": "vite",
|
|
14
|
+
"analyze": "cem analyze --litelement --globs \"src/**/*.{js,ts}\" \"index.js\"",
|
|
17
15
|
"dev:vite": "vite build",
|
|
16
|
+
"prepare": "husky",
|
|
18
17
|
"preview:vite": "vite preview",
|
|
19
|
-
"analyze": "cem analyze --litelement --globs \"src/**/*.{js,ts}\" \"index.js\"",
|
|
20
18
|
"sort:package": "npx sort-package-json",
|
|
21
|
-
"
|
|
22
|
-
"prepare": "husky",
|
|
19
|
+
"start": "concurrently -k -r \"npm:vite\" \"npm:sass:watch\"",
|
|
23
20
|
"test": "vitest",
|
|
24
|
-
"test:watch": "vitest --browser.headless=false"
|
|
21
|
+
"test:watch": "vitest --browser.headless=false",
|
|
22
|
+
"vite": "vite"
|
|
25
23
|
},
|
|
26
24
|
"dependencies": {
|
|
27
25
|
"lit": "^3.3.3"
|
|
@@ -33,24 +31,25 @@
|
|
|
33
31
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
34
32
|
"@open-wc/semantic-dom-diff": "^0.20.1",
|
|
35
33
|
"@open-wc/testing-helpers": "^3.0.1",
|
|
36
|
-
"playwright": "^1.61.0",
|
|
37
|
-
"postcss-html": "^1.8.1",
|
|
38
|
-
"postcss-lit": "^1.4.1",
|
|
39
34
|
"@types/mocha": "^10.0.10",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
35
|
+
"@vitest/browser-playwright": "^4.1.10",
|
|
36
|
+
"@vitest/coverage-istanbul": "^4.1.10",
|
|
37
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
38
|
+
"@vitest/ui": "^4.1.10",
|
|
43
39
|
"chai-a11y-axe": "^1.5.0",
|
|
44
40
|
"concurrently": "^10.0.3",
|
|
41
|
+
"playwright": "^1.61.1",
|
|
42
|
+
"postcss-html": "^1.8.1",
|
|
43
|
+
"postcss-lit": "^1.4.1",
|
|
44
|
+
"rollup-plugin-node-externals": "^9.0.1",
|
|
45
45
|
"sort-package-json": "^4.0.0",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"vitest": "^4.1.9",
|
|
51
|
-
"vite": "^8.1.0"
|
|
46
|
+
"tinyglobby": "^0.2.17",
|
|
47
|
+
"vite": "^8.1.4",
|
|
48
|
+
"vite-plugin-static-copy": "^4.1.1",
|
|
49
|
+
"vitest": "^4.1.10"
|
|
52
50
|
},
|
|
53
51
|
"publishConfig": {
|
|
54
52
|
"access": "public"
|
|
55
|
-
}
|
|
53
|
+
},
|
|
54
|
+
"customElements": "custom-elements.json"
|
|
56
55
|
}
|
|
@@ -1,31 +1,49 @@
|
|
|
1
1
|
import {defineConfig} from 'vitest/config';
|
|
2
2
|
import {playwright} from '@vitest/browser-playwright';
|
|
3
3
|
import {globSync} from 'tinyglobby';
|
|
4
|
-
import
|
|
4
|
+
import {viteStaticCopy} from 'vite-plugin-static-copy';
|
|
5
5
|
import totalBundlesize from '@blockquote/rollup-plugin-total-bundlesize';
|
|
6
6
|
|
|
7
7
|
const OUT_DIR = 'dev';
|
|
8
8
|
const ENTRIES_DIR = 'demo';
|
|
9
9
|
const ENTRIES_GLOB = [`${ENTRIES_DIR}/**/*.js`];
|
|
10
|
+
const ENTRY_EXCLUDE_GLOBS = [`${ENTRIES_DIR}/**/*.{test,spec}.js`];
|
|
10
11
|
|
|
11
12
|
const copyConfig = {
|
|
12
13
|
targets: [
|
|
13
14
|
{
|
|
14
15
|
src: [`${ENTRIES_DIR}/**/*.*`, `!${ENTRIES_GLOB}`],
|
|
15
|
-
dest:
|
|
16
|
+
dest: '.',
|
|
17
|
+
rename: {stripBase: 1},
|
|
16
18
|
},
|
|
17
19
|
],
|
|
18
|
-
hook: 'writeBundle',
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
// https://github.com/vitejs/vite/discussions/1736#discussioncomment-5126923
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const [key] = file.match(new RegExp(`(?<=${ENTRIES_DIR}/).*`)) || [];
|
|
25
|
-
return [key?.replace(/\.[^.]*$/, ''), file];
|
|
26
|
-
})
|
|
23
|
+
const entryFiles = [...new Set(globSync(ENTRIES_GLOB, {ignore: ENTRY_EXCLUDE_GLOBS}))].sort(
|
|
24
|
+
(a, b) => a.localeCompare(b)
|
|
27
25
|
);
|
|
28
26
|
|
|
27
|
+
const entries = (() => {
|
|
28
|
+
const map = new Map();
|
|
29
|
+
|
|
30
|
+
for (const file of entryFiles) {
|
|
31
|
+
const key = file.startsWith(`${ENTRIES_DIR}/`)
|
|
32
|
+
? file.slice(ENTRIES_DIR.length + 1).replace(/\.[^.]*$/, '')
|
|
33
|
+
: file.replace(/\.[^.]*$/, '');
|
|
34
|
+
|
|
35
|
+
if (map.has(key)) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Duplicate demo entry key "${key}" generated by "${map.get(key)}" and "${file}".`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
map.set(key, file);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return Object.fromEntries(map);
|
|
45
|
+
})();
|
|
46
|
+
|
|
29
47
|
// https://vitejs.dev/config/
|
|
30
48
|
// https://vite-rollup-plugins.patak.dev/
|
|
31
49
|
// https://github.com/vitest-dev/vitest/commit/78b62ffe#diff-d3e264f3679867e205ed7eeb7622aa3b62bb0c4b1a4aa5a5983cb3aa118fcf3c
|
|
@@ -78,7 +96,7 @@ export default defineConfig(({command}) => ({
|
|
|
78
96
|
exclude: ['**/src/**/index.*', '**/src/styles/'],
|
|
79
97
|
},
|
|
80
98
|
},
|
|
81
|
-
plugins: [
|
|
99
|
+
plugins: command === 'build' ? [viteStaticCopy(copyConfig), totalBundlesize()] : [],
|
|
82
100
|
optimizeDeps: {
|
|
83
101
|
exclude: ['lit', 'lit-html'],
|
|
84
102
|
},
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
// https://humanwhocodes.com/snippets/2020/10/create-typescript-declarations-from-javascript-jsdoc/
|
|
4
3
|
"target": "es2021",
|
|
5
|
-
"lib": [
|
|
4
|
+
"lib": [
|
|
5
|
+
"es2021",
|
|
6
|
+
"DOM",
|
|
7
|
+
"DOM.Iterable"
|
|
8
|
+
],
|
|
6
9
|
"module": "es2020",
|
|
7
10
|
"moduleResolution": "node",
|
|
8
11
|
"allowJs": true,
|
|
@@ -15,5 +18,7 @@
|
|
|
15
18
|
"alwaysStrict": true,
|
|
16
19
|
"allowSyntheticDefaultImports": true
|
|
17
20
|
},
|
|
18
|
-
"include": [
|
|
21
|
+
"include": [
|
|
22
|
+
"src/**/*.js"
|
|
23
|
+
]
|
|
19
24
|
}
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"/dist/"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "npm run
|
|
29
|
+
"build": "npm run build:lib && npm run build:tsc",
|
|
30
|
+
"build:demo": "npm run dev:vite",
|
|
30
31
|
"build:lib": "vite build --config vite.lib.config.js",
|
|
31
32
|
"build:tsc": "tsc",
|
|
32
33
|
"sass:watch": "sass-style-template -j ts"
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"experimentalDecorators": true,
|
|
10
10
|
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"lib": [
|
|
11
|
+
"lib": [
|
|
12
|
+
"es2023",
|
|
13
|
+
"DOM",
|
|
14
|
+
"DOM.Iterable"
|
|
15
|
+
],
|
|
12
16
|
"module": "esnext",
|
|
13
17
|
"moduleResolution": "Bundler",
|
|
14
18
|
"noFallthroughCasesInSwitch": true,
|
|
@@ -26,9 +30,13 @@
|
|
|
26
30
|
"strict": true,
|
|
27
31
|
"stripInternal": true,
|
|
28
32
|
"target": "es2023",
|
|
29
|
-
"types": [
|
|
33
|
+
"types": [
|
|
34
|
+
"mocha"
|
|
35
|
+
],
|
|
30
36
|
"useDefineForClassFields": false,
|
|
31
37
|
"verbatimModuleSyntax": true
|
|
32
38
|
},
|
|
33
|
-
"include": [
|
|
39
|
+
"include": [
|
|
40
|
+
"src/**/*.ts"
|
|
41
|
+
]
|
|
34
42
|
}
|
|
@@ -3,16 +3,34 @@ import {nodeExternals} from 'rollup-plugin-node-externals';
|
|
|
3
3
|
import {globSync} from 'tinyglobby';
|
|
4
4
|
|
|
5
5
|
const ENTRIES_DIR = 'src';
|
|
6
|
-
const ENTRIES_GLOB = [`${ENTRIES_DIR}/**/*.ts`];
|
|
6
|
+
const ENTRIES_GLOB = [`${ENTRIES_DIR}/**/*.{js,ts}`];
|
|
7
|
+
const ENTRY_EXCLUDE_GLOBS = [`${ENTRIES_DIR}/**/*.{test,spec}.{js,ts}`];
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
globSync(ENTRIES_GLOB).map((file) => {
|
|
11
|
-
const [key] = file.match(new RegExp(`(?<=${ENTRIES_DIR}/).*`)) || [];
|
|
12
|
-
return [key?.replace(/\.[^.]*$/, ''), file];
|
|
13
|
-
})
|
|
9
|
+
const entryFiles = [...new Set(globSync(ENTRIES_GLOB, {ignore: ENTRY_EXCLUDE_GLOBS}))].sort(
|
|
10
|
+
(a, b) => a.localeCompare(b)
|
|
14
11
|
);
|
|
15
12
|
|
|
13
|
+
// https://github.com/vitejs/vite/discussions/1736#discussioncomment-5126923
|
|
14
|
+
const entries = (() => {
|
|
15
|
+
const map = new Map();
|
|
16
|
+
|
|
17
|
+
for (const file of entryFiles) {
|
|
18
|
+
const key = file.startsWith(`${ENTRIES_DIR}/`)
|
|
19
|
+
? file.slice(ENTRIES_DIR.length + 1).replace(/\.[^.]*$/, '')
|
|
20
|
+
: file.replace(/\.[^.]*$/, '');
|
|
21
|
+
|
|
22
|
+
if (map.has(key)) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Duplicate library entry key "${key}" generated by "${map.get(key)}" and "${file}".`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
map.set(key, file);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return Object.fromEntries(map);
|
|
32
|
+
})();
|
|
33
|
+
|
|
16
34
|
export default defineConfig({
|
|
17
35
|
plugins: [nodeExternals()],
|
|
18
36
|
build: {
|