@blockquote/create-wc 1.94.0 → 1.95.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 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
- - ### [open-wc](https://open-wc.org/) & [modern-web](https://modern-web.dev/)
7
+ - ### [Open Web Components](https://open-wc.org/) & [Modern Web](https://modern-web.dev/)
8
8
 
9
9
  - Scaffold
10
- - Lint (es-lint)
11
- - Format (prettier)
12
- - Test (web-test-runner)
10
+ - Lint        `es-lint`
11
+ - Format   `prettier`
12
+ - Test       `web-test-runner`
13
13
 
14
- - ### [vitejs](https://vitejs.dev/)
14
+ - ### [Vite](https://vitejs.dev/)
15
15
 
16
- - Dev Server
17
- - Static demo
18
- - TypeScript
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
- - ### [sass](https://github.com/oscarmarina/sass-style-template)
21
+ - ### [Sass](https://github.com/oscarmarina/sass-style-template)
21
22
 
22
- - SCSS watcher with autoprefixer
23
+ - SCSS watcher with [sass](https://www.npmjs.com/package/sass)
23
24
 
24
- - ### miscellany
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
- - [ESLint 8 - decorators](https://github.com/eslint/eslint/issues/15299#issuecomment-968099681)
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
- <hr>
38
- <br>
37
+ ### Start
38
+
39
+ ```bash
40
+ npm start
41
+ ```
39
42
 
40
- ## open-wc & modern-web
43
+ <hr>
41
44
 
42
- ### - Linting and formatting
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
- ### - Testing with Web Test Runner
59
+ ### Testing with Web Test Runner
57
60
 
58
61
  - playwright
59
- - mocha-style reporter
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
- reporters: [
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
- ### scss watcher with autoprefixer
151
+ ### TypeScript
165
152
 
166
153
  ```bash
167
- npm run sass:watch
154
+ npm run build
168
155
  ```
169
156
 
170
157
  <hr>
171
- <br>
172
158
 
173
- ## Custom Element Manifest
159
+ ### sass
174
160
 
175
- ### Generating README from custom-elements.json
161
+ #### scss watcher
176
162
 
177
163
  ```bash
178
- npm run analyze
164
+ npm run sass:watch
179
165
  ```
180
166
 
181
167
  <hr>
182
- <br>
183
168
 
184
- ## TypeScript
169
+ ### Custom Element Manifest
185
170
 
186
- ### build ts
171
+ #### Generating README from custom-elements.json
187
172
 
188
173
  ```bash
189
- npm run build
174
+ npm run analyze
190
175
  ```
191
176
 
192
- <hr>
193
- <br>
177
+ ### Husky
194
178
 
195
- ### Start:
179
+ Husky is pre-installed.
196
180
 
197
- #### `"start": "concurrently -k -r \"npm:sass:watch\" \"npm:vite\""`
181
+ After `git init`; run `npm run prepare` to set up Husky and its Git hooks.
198
182
 
199
- ```bash
200
- npm start
201
- ```
183
+ <hr>
202
184
 
203
185
  **Example:**
204
186
 
205
- ### [open-wc-vitejs-sass](https://github.com/oscarmarina/open-wc-vitejs-sass)
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.94.0",
3
+ "version": "1.95.0",
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.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": "^8.0.3",
99
+ "husky": "^9.0.3",
100
100
  "lint-staged": "^15.2.0",
101
- "prettier": "^3.2.2",
102
- "stylelint": "^16.1.0",
101
+ "prettier": "^3.2.4",
102
+ "stylelint": "^16.2.0",
103
103
  "stylelint-config-standard-scss": "^13.0.0"
104
104
  }
105
105
  }
@@ -19,7 +19,7 @@
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 install"
22
+ "prepare": "husky"
23
23
  },
24
24
  "dependencies": {
25
25
  "lit": "^3.1.1"
@@ -37,7 +37,7 @@
37
37
  "concurrently": "^8.2.2",
38
38
  "sort-package-json": "^2.6.0",
39
39
  "ts-lit-plugin": "^2.0.2",
40
- "vite": "^5.0.11"
40
+ "vite": "^5.0.12"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -1,4 +1 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
1
  npx --no-install lint-staged
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "devDependencies": {
25
- "@typescript-eslint/eslint-plugin": "^6.19.0",
26
- "@typescript-eslint/parser": "^6.19.0"
25
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
26
+ "@typescript-eslint/parser": "^6.19.1"
27
27
  }
28
28
  }
@@ -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', () => {
@@ -10,7 +10,6 @@ suite('<%= className %>', () => {
10
10
  suite('Default', () => {
11
11
  setup(async () => {
12
12
  el = (await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`));
13
- await el.updateComplete;
14
13
  });
15
14
 
16
15
  test('has a default heading "Hey there" and counter 5', () => {
@@ -36,7 +35,6 @@ suite('<%= className %>', () => {
36
35
  suite('Events ', () => {
37
36
  setup(async () => {
38
37
  el = (await fixture(html`<<%= tagName %>></<%= tagName %>>`));
39
- await el.updateComplete;
40
38
  });
41
39
 
42
40
  test('increases the counter on button click', () => {
@@ -50,7 +48,6 @@ suite('<%= className %>', () => {
50
48
  setup(async () => {
51
49
  el = (await fixture(
52
50
  html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`));
53
- await el.updateComplete;
54
51
  });
55
52
 
56
53
  test('can override the heading via attribute', () => {
@@ -13,3 +13,7 @@ Generate `README.md` from a `custom-elements.json` file
13
13
  ```bash
14
14
  npm run analyze
15
15
  ```
16
+
17
+ Husky is pre-installed.
18
+
19
+ After `git init`; run `npm run prepare` to set up Husky and its Git hooks.
@@ -13,3 +13,7 @@ Generate `README.md` from a `custom-elements.json` file
13
13
  ```bash
14
14
  npm run analyze
15
15
  ```
16
+
17
+ Husky is pre-installed.
18
+
19
+ After `git init`; run `npm run prepare` to set up Husky and its Git hooks.
@@ -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
  }