@blockquote/create-wc 1.30.0 → 1.50.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
@@ -111,8 +111,7 @@ export default ({
111
111
  testFramework: {
112
112
  config: {
113
113
  ui: 'tdd',
114
- timeout: 4000,
115
- reporter: 'html'
114
+ timeout: 4000
116
115
  },
117
116
  },
118
117
 
@@ -171,6 +170,17 @@ npm run sass:watch
171
170
  <hr>
172
171
  <br>
173
172
 
173
+ ## Custom Element Manifest
174
+
175
+ ### Generating README from custom-elements.json
176
+
177
+ ```bash
178
+ npm run analyze
179
+ ```
180
+
181
+ <hr>
182
+ <br>
183
+
174
184
  ## TypeScript
175
185
 
176
186
  ### build ts
@@ -190,7 +200,7 @@ npm run build
190
200
  npm start
191
201
  ```
192
202
 
193
- Example:
203
+ **Example:**
194
204
 
195
205
  ### [open-wc-vitejs-sass](https://github.com/oscarmarina/open-wc-vitejs-sass)
196
206
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockquote/create-wc",
3
- "version": "1.30.0",
3
+ "version": "1.50.0",
4
4
  "description": "Web component with Lit scaffolding - Extending Open Web Component",
5
5
  "keywords": [
6
6
  "LitElement",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@open-wc/eslint-config": "^12.0.0",
50
- "eslint": "^8.47.0",
50
+ "eslint": "^8.49.0",
51
51
  "eslint-config-prettier": "^9.0.0",
52
- "prettier": "^3.0.2"
52
+ "prettier": "^3.0.3"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=14.15.0"
@@ -89,13 +89,13 @@
89
89
  },
90
90
  "devDependencies": {
91
91
  "@open-wc/eslint-config": "^12.0.0",
92
- "eslint": "^8.47.0",
92
+ "eslint": "^8.49.0",
93
93
  "eslint-config-prettier": "^9.0.0",
94
94
  "eslint-plugin-log-filenames": "^1.0.6",
95
95
  "husky": "^8.0.3",
96
96
  "lint-staged": "^14.0.1",
97
- "prettier": "^3.0.2",
97
+ "prettier": "^3.0.3",
98
98
  "stylelint": "^15.10.3",
99
- "stylelint-config-standard-scss": "^10.0.0"
99
+ "stylelint-config-standard-scss": "^11.0.0"
100
100
  }
101
101
  }
@@ -25,19 +25,18 @@
25
25
  "lit": "^2.8.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@blockquote/rollup-plugin-total-bundlesize": "^2.0.1",
29
- "@blockquote/sass-style-template": "^3.0.1",
28
+ "@blockquote/cem-to-markdown-readme": "^1.0.0",
30
29
  "@blockquote/coverage-table-reporter": "^1.0.0",
30
+ "@blockquote/rollup-plugin-total-bundlesize": "^2.0.1",
31
+ "@blockquote/sass-style-template": "^3.0.2",
31
32
  "@custom-elements-manifest/analyzer": "^0.8.4",
32
33
  "@ungap/global-this": "^0.4.4",
33
- "@web/rollup-plugin-html": "^2.0.0",
34
- "@webcomponents/shadycss": "^1.11.2",
35
- "@webcomponents/webcomponentsjs": "^2.8.0",
34
+ "@web/rollup-plugin-html": "^2.0.1",
36
35
  "concurrently": "^8.2.1",
37
- "rollup-plugin-copy": "^3.4.0",
38
- "tiny-array-flat-polyfill": "^0.2.1",
39
- "vite": "^4.4.9",
40
- "sort-package-json": "^2.5.1"
36
+ "rollup-plugin-copy": "^3.5.0",
37
+ "sort-package-json": "^2.6.0",
38
+ "ts-lit-plugin": "^2.0.0-pre.1",
39
+ "vite": "^4.4.9"
41
40
  },
42
41
  "publishConfig": {
43
42
  "access": "public"
@@ -0,0 +1,5 @@
1
+ import { cemToMarkdownReadme } from '@blockquote/cem-to-markdown-readme';
2
+
3
+ export default {
4
+ plugins: [...cemToMarkdownReadme()],
5
+ };
@@ -10,34 +10,6 @@ const copyConfig = {
10
10
  src: 'node_modules/@ungap/global-this/index.js',
11
11
  dest: 'dev/web_modules/@ungap/global-this',
12
12
  },
13
- {
14
- src: 'node_modules/tiny-array-flat-polyfill/tiny-array-flat-polyfill.min.js',
15
- dest: 'dev/web_modules/tiny-array-flat-polyfill',
16
- },
17
- {
18
- src: 'node_modules/lit/polyfill-support.js',
19
- dest: 'dev/web_modules/lit',
20
- },
21
- {
22
- src: 'node_modules/lit/polyfill-support.js.map',
23
- dest: 'dev/web_modules/lit',
24
- },
25
- {
26
- src: 'node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js',
27
- dest: 'dev/web_modules/@webcomponents/webcomponentsjs',
28
- },
29
- {
30
- src: 'node_modules/@webcomponents/webcomponentsjs/bundles',
31
- dest: 'dev/web_modules/@webcomponents/webcomponentsjs',
32
- },
33
- {
34
- src: 'node_modules/@webcomponents/shadycss/custom-style-interface.min.js',
35
- dest: 'dev/web_modules/@webcomponents/shadycss',
36
- },
37
- {
38
- src: 'node_modules/@webcomponents/shadycss/custom-style-interface.min.js.map',
39
- dest: 'dev/web_modules/@webcomponents/shadycss',
40
- },
41
13
  ],
42
14
  hook: 'writeBundle',
43
15
  };
@@ -49,7 +21,7 @@ const copyConfig = {
49
21
 
50
22
  export default defineConfig({
51
23
  build: {
52
- target: ['edge18'],
24
+ target: ['chrome70'],
53
25
  outDir: 'dev',
54
26
  rollupOptions: {
55
27
  input: 'demo/*.html',
@@ -64,11 +36,7 @@ export default defineConfig({
64
36
  html.replace(
65
37
  '<meta charset="utf-8">',
66
38
  `<meta charset="utf-8">
67
- <script src="./web_modules/@ungap/global-this/index.js"></script>
68
- <script src="./web_modules/tiny-array-flat-polyfill/tiny-array-flat-polyfill.min.js"></script>
69
- <script src="./web_modules/lit/polyfill-support.js"></script>
70
- <script src="./web_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
71
- <script src="./web_modules/@webcomponents/shadycss/custom-style-interface.min.js"></script>`,
39
+ <script src="./web_modules/@ungap/global-this/index.js"></script>`,
72
40
  ),
73
41
  ],
74
42
  }),
@@ -29,9 +29,12 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
29
29
  concurrency: 1,
30
30
 
31
31
  reporters: [summaryReporter(), defaultReporter(), coverageTableReporter()],
32
+
33
+ preserveSymlinks: true,
32
34
 
33
35
  coverage: true,
34
36
  coverageConfig: {
37
+ // https://github.com/istanbuljs/v8-to-istanbul#ignoring-uncovered-lines
35
38
  reportDir: `${outDir}/test/coverage`,
36
39
  reporters: ['lcov', 'lcovonly', 'json'],
37
40
  threshold: {
@@ -44,6 +47,7 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
44
47
  },
45
48
 
46
49
  testFramework: {
50
+ // https://mochajs.org/api/mocha
47
51
  config: {
48
52
  ui: 'tdd',
49
53
  timeout: 4000
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "devDependencies": {
25
- "@typescript-eslint/eslint-plugin": "^6.4.1",
26
- "@typescript-eslint/parser": "^6.4.1"
25
+ "@typescript-eslint/eslint-plugin": "^6.7.0",
26
+ "@typescript-eslint/parser": "^6.7.0"
27
27
  }
28
28
  }
@@ -1,15 +1,17 @@
1
- import { html, fixture, assert, fixtureCleanup } from '@open-wc/testing';
2
-
1
+ import { html, fixture, assert, expect, fixtureCleanup } from '@open-wc/testing';
3
2
  import '../define/<%= tagName %>.js';
4
3
 
5
4
  suite('<%= className %>', () => {
5
+ /**
6
+ * @type {import('../index').<%= className %>}
7
+ */
6
8
  let el;
7
9
 
8
10
  teardown(() => fixtureCleanup());
9
11
 
10
12
  suite('Default', () => {
11
13
  setup(async () => {
12
- el = await fixture(html` <<%= tagName %>>light-dom</<%= tagName %>> `);
14
+ el = await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`);
13
15
  await el.updateComplete;
14
16
  });
15
17
 
@@ -20,11 +22,11 @@ suite('<%= className %>', () => {
20
22
 
21
23
  suite('Semantic Dom and a11y', () => {
22
24
  test('SHADOW DOM - Structure test', async () => {
23
- await assert.shadowDom.equalSnapshot(el, { ignoreAttributes: ['id'] });
25
+ await expect(el).shadowDom.to.equalSnapshot();
24
26
  });
25
27
 
26
28
  test('LIGHT DOM - Structure test', async () => {
27
- await assert.lightDom.equalSnapshot(el, { ignoreAttributes: ['id'] });
29
+ await expect(el).lightDom.to.equalSnapshot();
28
30
  });
29
31
  test('a11y', async () => {
30
32
  await assert.isAccessible(el);
@@ -34,19 +36,19 @@ suite('<%= className %>', () => {
34
36
 
35
37
  suite('Events ', () => {
36
38
  setup(async () => {
37
- el = await fixture(html` <<%= tagName %>></<%= tagName %>> `);
39
+ el = await fixture(html`<<%= tagName %>></<%= tagName %>>`);
38
40
  await el.updateComplete;
39
41
  });
40
42
 
41
43
  test('increases the counter on button click', () => {
42
- el.shadowRoot.querySelector('button').click();
44
+ el.shadowRoot?.querySelector('button')?.click();
43
45
  assert.equal(el.counter, 6);
44
46
  });
45
47
  });
46
48
 
47
49
  suite('Override ', () => {
48
50
  setup(async () => {
49
- el = await fixture(html` <<%= tagName %> heading="attribute heading"></<%= tagName %>> `);
51
+ el = await fixture(html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`);
50
52
  await el.updateComplete;
51
53
  });
52
54
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "devDependencies": {
3
3
  "@open-wc/testing": "^3.2.0",
4
- "@web/test-runner": "^0.17.0",
4
+ "@web/test-runner": "^0.17.1",
5
5
  "@web/test-runner-playwright": "^0.10.1"
6
6
  }
7
7
  }
@@ -1,7 +1,5 @@
1
1
  import { html, fixture, assert, fixtureCleanup } from '@open-wc/testing';
2
-
3
2
  import { <%= className %> } from '../src/<%= className %>.js';
4
-
5
3
  import '../define/<%= tagName %>.js';
6
4
 
7
5
  suite('<%= className %>', () => {
@@ -11,7 +9,7 @@ suite('<%= className %>', () => {
11
9
 
12
10
  suite('Default', () => {
13
11
  setup(async () => {
14
- el = (await fixture(html` <<%= tagName %>>light-dom</<%= tagName %>> `)) as <%= className %>;
12
+ el = (await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`));
15
13
  await el.updateComplete;
16
14
  });
17
15
 
@@ -36,7 +34,7 @@ suite('<%= className %>', () => {
36
34
 
37
35
  suite('Events ', () => {
38
36
  setup(async () => {
39
- el = (await fixture(html` <<%= tagName %>></<%= tagName %>> `)) as <%= className %>;
37
+ el = (await fixture(html`<<%= tagName %>></<%= tagName %>>`));
40
38
  await el.updateComplete;
41
39
  });
42
40
 
@@ -50,7 +48,7 @@ suite('<%= className %>', () => {
50
48
  suite('Override ', () => {
51
49
  setup(async () => {
52
50
  el = (await fixture(
53
- html` <<%= tagName %> heading="attribute heading"></<%= tagName %>> `)) as <%= className %>;
51
+ html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`));
54
52
  await el.updateComplete;
55
53
  });
56
54
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "devDependencies": {
3
3
  "@open-wc/testing": "^3.2.0",
4
- "@web/test-runner": "^0.17.0",
4
+ "@web/test-runner": "^0.17.1",
5
5
  "@web/test-runner-playwright": "^0.10.1"
6
6
  }
7
7
  }
@@ -1,21 +1,28 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { styles } from './styles/<%= tagName %>-styles.css.js';
3
3
 
4
+ /**
5
+ * ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
6
+ *
7
+ * ## `<<%= tagName %>>`
8
+ * An example element.
9
+ *
10
+ * @attr heading
11
+ * @attr counter
12
+ * @fires counterchange - Indicates when the count changes
13
+ * @slot - This element has a slot
14
+ */
4
15
  export class <%= className %> extends LitElement {
5
- static is = '<%= tagName %>';
6
-
7
16
  static styles = [styles];
8
17
 
9
18
  static properties = {
10
19
  /**
11
20
  * The heading to say "Hello" to.
12
- * @type {string}
13
21
  */
14
22
  heading: { type: String },
15
23
 
16
24
  /**
17
25
  * The number of times the button has been clicked.
18
- * @type {number}
19
26
  */
20
27
  counter: { type: Number },
21
28
  };
@@ -1,3 +1,3 @@
1
1
  import { <%= className %> } from '../src/<%= className %>.js';
2
2
 
3
- window.customElements.define(<%= className %>.is, <%= className %>);
3
+ window.customElements.define('<%= tagName %>', <%= className %>);
@@ -1,35 +1,15 @@
1
- # \<<%= tagName %>>
1
+ ### \<<%= tagName %>>
2
2
 
3
- ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
3
+ #### Usage
4
4
 
5
- This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
6
-
7
- ## Installation
5
+ Install
8
6
 
9
7
  ```bash
10
- npm i <%= tagName %>
11
- ```
12
-
13
- ## Usage
14
-
15
- ```html
16
- <script type="module">
17
- import '<%= tagName %>/<%= tagName %>.js';
18
- </script>
19
-
20
- <<%= tagName %>></<%= tagName %>>
8
+ npm i
21
9
  ```
22
10
 
23
- ## Tooling configs
24
-
25
- For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
26
-
27
- If you customize the configuration a lot, you can consider moving them to individual files.
28
-
29
- ## Local Demo with `vite`
11
+ Generate `README.md` from a `custom-elements.json` file
30
12
 
31
13
  ```bash
32
- npm start
14
+ npm run analyze
33
15
  ```
34
-
35
- To run a local development server that serves the basic demo located in demo/index.html
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2021",
4
+ "lib": ["es2021", "DOM", "DOM.Iterable"],
5
+ "module": "es2020",
6
+ "moduleResolution": "node",
7
+ "allowJs": true,
8
+ "declaration": true,
9
+ "emitDeclarationOnly": true,
10
+ "noEmit": false,
11
+ "checkJs": true,
12
+ "strict": false,
13
+ "noImplicitThis": true,
14
+ "alwaysStrict": true,
15
+ "outDir": "./types",
16
+ "allowSyntheticDefaultImports": true,
17
+ "plugins": [
18
+ {
19
+ "name": "ts-lit-plugin",
20
+ "rules": {
21
+ "no-unknown-slot": "warning",
22
+ "no-unknown-attribute": "warning",
23
+ "no-unknown-property": "warning",
24
+ "no-unknown-event": "warning"
25
+ }
26
+ }
27
+ ]
28
+ },
29
+ "include": ["src/**/*.js"]
30
+ }
@@ -2,9 +2,16 @@ import { html, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import { styles } from './styles/<%= tagName %>-styles.css.js';
4
4
 
5
+ /**
6
+ * ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
7
+ *
8
+ * ## `<<%= tagName %>>`
9
+ * An example element.
10
+ *
11
+ * @fires counterchange - Indicates when the count changes
12
+ * @slot - This element has a slot
13
+ */
5
14
  export class <%= className %> extends LitElement {
6
- static is: string = '<%= tagName %>';
7
-
8
15
  static override styles = [styles];
9
16
 
10
17
  /**
@@ -1,3 +1,3 @@
1
1
  import { <%= className %> } from '../src/<%= className %>.js';
2
2
 
3
- window.customElements.define(<%= className %>.is, <%= className %>);
3
+ window.customElements.define('<%= tagName %>', <%= className %>);
@@ -1,35 +1,15 @@
1
- # \<<%= tagName %>>
1
+ ### \<<%= tagName %>>
2
2
 
3
- ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
3
+ #### Usage
4
4
 
5
- This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
6
-
7
- ## Installation
5
+ Install
8
6
 
9
7
  ```bash
10
- npm i <%= tagName %>
11
- ```
12
-
13
- ## Usage
14
-
15
- ```html
16
- <script type="module">
17
- import '<%= tagName %>/<%= tagName %>.js';
18
- </script>
19
-
20
- <<%= tagName %>></<%= tagName %>>
8
+ npm i
21
9
  ```
22
10
 
23
- ## Tooling configs
24
-
25
- For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
26
-
27
- If you customize the configuration a lot, you can consider moving them to individual files.
28
-
29
- ## Local Demo with `vite`
11
+ Generate `README.md` from a `custom-elements.json` file
30
12
 
31
13
  ```bash
32
- npm start
14
+ npm run analyze
33
15
  ```
34
-
35
- To run a local development server that serves the basic demo located in demo/index.html
@@ -4,7 +4,7 @@
4
4
  "lib": ["es2021", "DOM", "DOM.Iterable"],
5
5
  "experimentalDecorators": true,
6
6
  "module": "es2020",
7
- "moduleResolution": "bundler",
7
+ "moduleResolution": "node",
8
8
  "rootDirs": ["./src", "./define", ".test/"],
9
9
  "resolveJsonModule": true,
10
10
  "declaration": true,
@@ -23,7 +23,17 @@
23
23
  "noImplicitReturns": true,
24
24
  "noFallthroughCasesInSwitch": true,
25
25
  "noImplicitOverride": true,
26
- "skipLibCheck": true
26
+ "plugins": [
27
+ {
28
+ "name": "ts-lit-plugin",
29
+ "rules": {
30
+ "no-unknown-slot": "warning",
31
+ "no-unknown-attribute": "warning",
32
+ "no-unknown-property": "warning",
33
+ "no-unknown-event": "warning"
34
+ }
35
+ }
36
+ ]
27
37
  },
28
38
  "include": ["src/**/*.ts", "define/**/*.ts", "test/**/*.ts", "./index.ts", "types/**/*.d.ts"]
29
39
  }