@blockquote/create-wc 1.94.0 → 1.95.1
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 +55 -117
- package/package.json +2 -2
- package/src/common-linting/templates/package.json +4 -4
- package/src/common-repo/templates/eslintignore +1 -1
- package/src/common-repo/templates/package.json +4 -6
- package/src/common-repo/templates/static/.husky/pre-commit +0 -3
- package/src/linting-eslint-ts/templates/package.json +2 -2
- package/src/testing/templates/my-el.test.js +0 -3
- package/src/testing-ts/templates/my-el.test.ts +3 -7
- package/src/wc-lit-element/templates/static/README.md +4 -0
- package/src/wc-lit-element-ts/templates/static/README.md +4 -0
- package/src/wc-lit-element-ts/templates/tsconfig.json +5 -5
package/README.md
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
1
|
# Web Component with Lit - Scaffolding
|
|
2
2
|
|
|
3
|
-
This scaffold generator extends and customizes the core parts of [@open-wc/create](https://open-wc.org/docs/development/generator/#extending) providing a starting point for creating a web component with [Lit](https://lit.dev/)
|
|
3
|
+
This scaffold generator extends and customizes the core parts of **[@open-wc/create](https://open-wc.org/docs/development/generator/#extending)** providing a starting point for creating a web component with **[Lit](https://lit.dev/)**
|
|
4
4
|
|
|
5
5
|
## Development tools:
|
|
6
6
|
|
|
7
|
-
- ### [
|
|
7
|
+
- ### [Open Web Components](https://open-wc.org/) & [Modern Web](https://modern-web.dev/)
|
|
8
8
|
|
|
9
9
|
- Scaffold
|
|
10
|
-
- Lint
|
|
11
|
-
- Format
|
|
12
|
-
- Test
|
|
10
|
+
- Lint `es-lint`
|
|
11
|
+
- Format `prettier`
|
|
12
|
+
- Test `web-test-runner`
|
|
13
13
|
|
|
14
|
-
- ### [
|
|
14
|
+
- ### [Vite](https://vitejs.dev/)
|
|
15
15
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
16
|
+
- [De Server](https://vitejs.dev/config/server-options.html)
|
|
17
|
+
- [Preview](https://vitejs.dev/config/preview-options.html)
|
|
18
|
+
- [Build](https://vitejs.dev/guide/build.html)
|
|
19
|
+
- TypeScript & [tsconfig](https://github.com/lit/lit/blob/main/packages/lit-starter-ts/tsconfig.json)
|
|
19
20
|
|
|
20
|
-
- ### [
|
|
21
|
+
- ### [Sass](https://github.com/oscarmarina/sass-style-template)
|
|
21
22
|
|
|
22
|
-
- SCSS watcher with
|
|
23
|
+
- SCSS watcher with [sass](https://www.npmjs.com/package/sass)
|
|
23
24
|
|
|
24
|
-
- ###
|
|
25
|
-
- [tsconfig](https://github.com/lit/lit/blob/main/packages/lit-starter-ts/tsconfig.json)
|
|
25
|
+
- ### analyze
|
|
26
26
|
- [Custom Elements Manifest](https://custom-elements-manifest.open-wc.org/blog/intro/)
|
|
27
|
-
|
|
27
|
+
- [Plugin: cem-to-markdown-readme](https://github.com/oscarmarina/cem-to-markdown-readme)
|
|
28
28
|
|
|
29
29
|
<hr>
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm init @blockquote/wc
|
|
34
|
+
npm init @blockquote/wc@latest
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
### Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm start
|
|
41
|
+
```
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
<hr>
|
|
41
44
|
|
|
42
|
-
###
|
|
45
|
+
### Linting and formatting
|
|
43
46
|
|
|
44
47
|
To scan the project for linting and formatting errors, run
|
|
45
48
|
|
|
@@ -53,11 +56,10 @@ To automatically fix linting and formatting errors, run
|
|
|
53
56
|
npm run format
|
|
54
57
|
```
|
|
55
58
|
|
|
56
|
-
###
|
|
59
|
+
### Testing with Web Test Runner
|
|
57
60
|
|
|
58
61
|
- playwright
|
|
59
|
-
-
|
|
60
|
-
- coverage config
|
|
62
|
+
- coverage
|
|
61
63
|
- TDD option
|
|
62
64
|
|
|
63
65
|
<br>
|
|
@@ -67,56 +69,49 @@ npm run format
|
|
|
67
69
|
```js
|
|
68
70
|
import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
69
71
|
import { defaultReporter, summaryReporter } from '@web/test-runner';
|
|
70
|
-
import { coverageTableReporter } from '@blockquote/coverage-table-reporter'
|
|
72
|
+
import { coverageTableReporter } from '@blockquote/coverage-table-reporter';
|
|
71
73
|
|
|
74
|
+
const filteredLogs = ['in dev mode'];
|
|
72
75
|
const outDir = process.env.OUTDIR || '.';
|
|
73
76
|
|
|
74
|
-
export default ({
|
|
77
|
+
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
75
78
|
files: [`${outDir}/test/**/*.test.js`],
|
|
76
|
-
|
|
77
|
-
nodeResolve: {
|
|
78
|
-
exportConditions: ['browser', 'development'],
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/** Browsers to run tests on */
|
|
79
|
+
nodeResolve: true,
|
|
82
80
|
browsers: [
|
|
83
81
|
playwrightLauncher({ product: 'chromium' }),
|
|
84
82
|
playwrightLauncher({ product: 'webkit' }),
|
|
85
83
|
],
|
|
86
|
-
|
|
87
|
-
/** Amount of browsers to run concurrently */
|
|
88
84
|
concurrentBrowsers: 2,
|
|
89
|
-
|
|
90
|
-
/** Amount of test files per browser to test concurrently */
|
|
91
85
|
concurrency: 1,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
defaultReporter(),
|
|
95
|
-
summaryReporter(),
|
|
96
|
-
coverageTableReporter()
|
|
97
|
-
],
|
|
98
|
-
|
|
86
|
+
reporters: [summaryReporter({}), defaultReporter(), coverageTableReporter()],
|
|
87
|
+
preserveSymlinks: true,
|
|
99
88
|
coverage: true,
|
|
100
89
|
coverageConfig: {
|
|
101
|
-
report: true,
|
|
102
90
|
reportDir: `${outDir}/test/coverage`,
|
|
91
|
+
reporters: ['lcov', 'lcovonly', 'json'],
|
|
103
92
|
threshold: {
|
|
104
93
|
statements: 80,
|
|
105
94
|
branches: 80,
|
|
106
95
|
functions: 80,
|
|
107
96
|
lines: 80,
|
|
108
97
|
},
|
|
98
|
+
include: ['**/src/**/*', '**/define/**/*'],
|
|
109
99
|
},
|
|
110
|
-
|
|
111
100
|
testFramework: {
|
|
112
101
|
config: {
|
|
113
102
|
ui: 'tdd',
|
|
114
|
-
timeout: 4000
|
|
103
|
+
timeout: 4000,
|
|
115
104
|
},
|
|
116
105
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
filterBrowserLogs(log) {
|
|
107
|
+
for (const arg of log.args) {
|
|
108
|
+
if (typeof arg === 'string' && filteredLogs.some((l) => arg.includes(l))) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
},
|
|
114
|
+
});
|
|
120
115
|
```
|
|
121
116
|
|
|
122
117
|
To execute a single test run:
|
|
@@ -132,9 +127,6 @@ npm run test:watch
|
|
|
132
127
|
```
|
|
133
128
|
|
|
134
129
|
<hr>
|
|
135
|
-
<br>
|
|
136
|
-
|
|
137
|
-
## vite
|
|
138
130
|
|
|
139
131
|
### dev server
|
|
140
132
|
|
|
@@ -150,102 +142,48 @@ npm run vite
|
|
|
150
142
|
npm run dev:vite
|
|
151
143
|
```
|
|
152
144
|
|
|
153
|
-
### [server static-deploy](https://vitejs.dev/guide/static-deploy.html)
|
|
154
|
-
|
|
155
145
|
```bash
|
|
156
146
|
npm run preview:vite
|
|
157
147
|
```
|
|
158
148
|
|
|
159
149
|
<hr>
|
|
160
|
-
<br>
|
|
161
|
-
|
|
162
|
-
## sass
|
|
163
150
|
|
|
164
|
-
###
|
|
151
|
+
### TypeScript
|
|
165
152
|
|
|
166
153
|
```bash
|
|
167
|
-
npm run
|
|
154
|
+
npm run build
|
|
168
155
|
```
|
|
169
156
|
|
|
170
157
|
<hr>
|
|
171
|
-
<br>
|
|
172
158
|
|
|
173
|
-
|
|
159
|
+
### sass
|
|
174
160
|
|
|
175
|
-
|
|
161
|
+
#### scss watcher
|
|
176
162
|
|
|
177
163
|
```bash
|
|
178
|
-
npm run
|
|
164
|
+
npm run sass:watch
|
|
179
165
|
```
|
|
180
166
|
|
|
181
167
|
<hr>
|
|
182
|
-
<br>
|
|
183
168
|
|
|
184
|
-
|
|
169
|
+
### Custom Element Manifest
|
|
185
170
|
|
|
186
|
-
|
|
171
|
+
#### Generating README from custom-elements.json
|
|
187
172
|
|
|
188
173
|
```bash
|
|
189
|
-
npm run
|
|
174
|
+
npm run analyze
|
|
190
175
|
```
|
|
191
176
|
|
|
192
|
-
|
|
193
|
-
<br>
|
|
177
|
+
### Husky
|
|
194
178
|
|
|
195
|
-
|
|
179
|
+
Husky is pre-installed.
|
|
196
180
|
|
|
197
|
-
|
|
181
|
+
After `git init`; run `npm run prepare` to set up Husky and its Git hooks.
|
|
198
182
|
|
|
199
|
-
|
|
200
|
-
npm start
|
|
201
|
-
```
|
|
183
|
+
<hr>
|
|
202
184
|
|
|
203
185
|
**Example:**
|
|
204
186
|
|
|
205
|
-
|
|
187
|
+
> - https://github.com/oscarmarina/blockquote-web-components
|
|
206
188
|
|
|
207
189
|
<hr>
|
|
208
|
-
<br>
|
|
209
|
-
|
|
210
|
-
## File structure JS & TS
|
|
211
|
-
|
|
212
|
-
```css
|
|
213
|
-
./
|
|
214
|
-
├── my-el/
|
|
215
|
-
│ ├── .husky/
|
|
216
|
-
│ │ ├── _/
|
|
217
|
-
│ │ │ ├── .gitignore
|
|
218
|
-
│ │ │ └── husky.sh
|
|
219
|
-
│ │ └── pre-commit
|
|
220
|
-
│ ├── define/
|
|
221
|
-
│ │ └── my-el.{js,ts}
|
|
222
|
-
│ ├── demo/
|
|
223
|
-
│ │ └── index.html
|
|
224
|
-
│ ├── src/
|
|
225
|
-
│ │ ├── styles/
|
|
226
|
-
│ │ │ ├── MyEl-styles.{js,ts}
|
|
227
|
-
│ │ │ └── MyEl.scss
|
|
228
|
-
│ │ └── MyEl.{js,ts}
|
|
229
|
-
│ ├── test/
|
|
230
|
-
│ │ └── my-el.test.{js,ts}
|
|
231
|
-
│ ├── .editorconfig
|
|
232
|
-
│ ├── .gitignore
|
|
233
|
-
│ ├── index.html
|
|
234
|
-
│ ├── index.{js,ts}
|
|
235
|
-
│ ├── LICENSE
|
|
236
|
-
│ ├── package.json
|
|
237
|
-
│ ├── README.md
|
|
238
|
-
│ ├── vite.config.js
|
|
239
|
-
│ └── web-test-runner.config.mjs
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
<hr>
|
|
243
|
-
|
|
244
|
-
### the component definition is generated in its own folder
|
|
245
|
-
|
|
246
|
-
```css
|
|
247
|
-
./
|
|
248
|
-
├── my-el/
|
|
249
|
-
│ ├── define/
|
|
250
|
-
│ │ └── my-el.{js,ts}
|
|
251
|
-
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote/create-wc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.95.1",
|
|
4
4
|
"description": "Web component with Lit scaffolding - Extending Open Web Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"LitElement",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@open-wc/eslint-config": "^12.0.3",
|
|
50
50
|
"eslint": "^8.56.0",
|
|
51
51
|
"eslint-config-prettier": "^9.1.0",
|
|
52
|
-
"prettier": "^3.2.
|
|
52
|
+
"prettier": "^3.2.4"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=14.15.0"
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
"@open-wc/eslint-config": "^12.0.3",
|
|
97
97
|
"eslint": "^8.56.0",
|
|
98
98
|
"eslint-config-prettier": "^9.1.0",
|
|
99
|
-
"husky": "^
|
|
100
|
-
"lint-staged": "^15.2.
|
|
101
|
-
"prettier": "^3.2.
|
|
102
|
-
"stylelint": "^16.1
|
|
99
|
+
"husky": "^9.0.10",
|
|
100
|
+
"lint-staged": "^15.2.1",
|
|
101
|
+
"prettier": "^3.2.4",
|
|
102
|
+
"stylelint": "^16.2.1",
|
|
103
103
|
"stylelint-config-standard-scss": "^13.0.0"
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"analyze": "cem analyze --litelement --globs \"{src,define}/**/*.{js,ts}\" \"index.js\"",
|
|
20
20
|
"sort:package": "npx sort-package-json",
|
|
21
21
|
"postinstall": "npm run sort:package",
|
|
22
|
-
"prepare": "husky
|
|
22
|
+
"prepare": "husky"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"lit": "^3.1.
|
|
25
|
+
"lit": "^3.1.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@blockquote/cem-to-markdown-readme": "^1.0.0",
|
|
@@ -31,13 +31,11 @@
|
|
|
31
31
|
"@blockquote/rollup-plugin-total-bundlesize": "^2.1.2",
|
|
32
32
|
"@blockquote/sass-style-template": "^3.0.2",
|
|
33
33
|
"@custom-elements-manifest/analyzer": "^0.9.0",
|
|
34
|
-
|
|
35
|
-
|
|
36
34
|
"@web/rollup-plugin-html": "^2.1.2",
|
|
37
35
|
"concurrently": "^8.2.2",
|
|
38
|
-
"sort-package-json": "^2.
|
|
36
|
+
"sort-package-json": "^2.7.0",
|
|
39
37
|
"ts-lit-plugin": "^2.0.2",
|
|
40
|
-
"vite": "^5.0.
|
|
38
|
+
"vite": "^5.0.12"
|
|
41
39
|
},
|
|
42
40
|
"publishConfig": {
|
|
43
41
|
"access": "public"
|
|
@@ -12,7 +12,6 @@ suite('<%= className %>', () => {
|
|
|
12
12
|
suite('Default', () => {
|
|
13
13
|
setup(async () => {
|
|
14
14
|
el = await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`);
|
|
15
|
-
await el.updateComplete;
|
|
16
15
|
});
|
|
17
16
|
|
|
18
17
|
test('has a default heading "Hey there" and counter 5', () => {
|
|
@@ -38,7 +37,6 @@ suite('<%= className %>', () => {
|
|
|
38
37
|
suite('Events ', () => {
|
|
39
38
|
setup(async () => {
|
|
40
39
|
el = await fixture(html`<<%= tagName %>></<%= tagName %>>`);
|
|
41
|
-
await el.updateComplete;
|
|
42
40
|
});
|
|
43
41
|
|
|
44
42
|
test('increases the counter on button click', () => {
|
|
@@ -50,7 +48,6 @@ suite('<%= className %>', () => {
|
|
|
50
48
|
suite('Override ', () => {
|
|
51
49
|
setup(async () => {
|
|
52
50
|
el = await fixture(html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`);
|
|
53
|
-
await el.updateComplete;
|
|
54
51
|
});
|
|
55
52
|
|
|
56
53
|
test('can override the heading via attribute', () => {
|
|
@@ -9,8 +9,7 @@ suite('<%= className %>', () => {
|
|
|
9
9
|
|
|
10
10
|
suite('Default', () => {
|
|
11
11
|
setup(async () => {
|
|
12
|
-
el =
|
|
13
|
-
await el.updateComplete;
|
|
12
|
+
el = await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`);
|
|
14
13
|
});
|
|
15
14
|
|
|
16
15
|
test('has a default heading "Hey there" and counter 5', () => {
|
|
@@ -35,8 +34,7 @@ suite('<%= className %>', () => {
|
|
|
35
34
|
|
|
36
35
|
suite('Events ', () => {
|
|
37
36
|
setup(async () => {
|
|
38
|
-
el =
|
|
39
|
-
await el.updateComplete;
|
|
37
|
+
el = await fixture(html`<<%= tagName %>></<%= tagName %>>`);
|
|
40
38
|
});
|
|
41
39
|
|
|
42
40
|
test('increases the counter on button click', () => {
|
|
@@ -48,9 +46,7 @@ suite('<%= className %>', () => {
|
|
|
48
46
|
|
|
49
47
|
suite('Override ', () => {
|
|
50
48
|
setup(async () => {
|
|
51
|
-
el =
|
|
52
|
-
html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`));
|
|
53
|
-
await el.updateComplete;
|
|
49
|
+
el = await fixture(html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`);
|
|
54
50
|
});
|
|
55
51
|
|
|
56
52
|
test('can override the heading via attribute', () => {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"no-unknown-slot": "warning",
|
|
31
31
|
"no-unknown-attribute": "warning",
|
|
32
32
|
"no-unknown-property": "warning",
|
|
33
|
-
"no-unknown-event": "warning"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
33
|
+
"no-unknown-event": "warning",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
36
|
],
|
|
37
|
-
"types": ["mocha"]
|
|
37
|
+
"types": ["mocha"],
|
|
38
38
|
},
|
|
39
|
-
"include": ["src/**/*.ts", "define/**/*.ts", "test/**/*.ts", "./index.ts", "types/**/*.d.ts"]
|
|
39
|
+
"include": ["src/**/*.ts", "define/**/*.ts", "test/**/*.ts", "./index.ts", "types/**/*.d.ts"],
|
|
40
40
|
}
|