@blockquote/create-wc 1.1.0 → 1.2.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.
Files changed (58) hide show
  1. package/README.md +39 -53
  2. package/package.json +20 -20
  3. package/src/Generator.js +3 -1
  4. package/src/app/gatherMixins.js +26 -9
  5. package/src/app/index.js +10 -1
  6. package/src/common-linting/index.js +18 -0
  7. package/src/common-linting/templates/package.json +41 -0
  8. package/src/common-repo/index.js +7 -0
  9. package/src/common-repo/templates/gitignore +1 -0
  10. package/src/common-repo/templates/package.json +17 -16
  11. package/src/{wc-lit-element → common-repo}/templates/static/index.html +1 -1
  12. package/src/{wc-lit-element → common-repo}/templates/static/vite.config.js +19 -26
  13. package/src/{wc-lit-element → common-repo}/templates/static/web-dev-server.config.mjs +0 -0
  14. package/src/{wc-lit-element → common-repo}/templates/styles/MyEl.scss +1 -0
  15. package/src/common-testing-wtr/index.js +14 -0
  16. package/src/common-testing-wtr/templates/static/web-test-runner.config.mjs +69 -0
  17. package/src/linting/index.js +27 -0
  18. package/src/linting/templates/package.json +1 -0
  19. package/src/linting-eslint/index.js +17 -0
  20. package/src/linting-eslint/templates/package.json +1 -0
  21. package/src/linting-eslint-ts/index.js +17 -0
  22. package/src/linting-eslint-ts/templates/package.json +17 -0
  23. package/src/linting-prettier/index.js +17 -0
  24. package/src/linting-prettier/templates/package.json +1 -0
  25. package/src/linting-prettier-ts/index.js +17 -0
  26. package/src/linting-prettier-ts/templates/package.json +1 -0
  27. package/src/linting-ts/index.js +21 -0
  28. package/src/linting-ts/templates/package.json +1 -0
  29. package/src/testing/templates/my-el.test.js +1 -1
  30. package/src/testing/templates/package.json +2 -1
  31. package/src/testing-ts/index.js +32 -0
  32. package/src/testing-ts/templates/my-el.test.ts +62 -0
  33. package/src/testing-ts/templates/package.json +6 -0
  34. package/src/testing-wtr/index.js +1 -1
  35. package/src/testing-wtr/templates/package.json +3 -6
  36. package/src/testing-wtr/templates/static/{web-test-runner.config.mjs → _web-test-runner.config.mjs} +0 -0
  37. package/src/testing-wtr-ts/index.js +19 -0
  38. package/src/testing-wtr-ts/templates/package.json +6 -0
  39. package/src/testing-wtr-ts/templates/static/_web-test-runner.config.mjs +67 -0
  40. package/src/wc-lit-element/index.js +0 -6
  41. package/src/wc-lit-element/templates/MyEl.js +27 -8
  42. package/src/wc-lit-element/templates/my-el.js +1 -1
  43. package/src/wc-lit-element/templates/package.json +5 -12
  44. package/src/wc-lit-element/templates/static/README.md +3 -3
  45. package/src/wc-lit-element/templates/static/demo/index.html +21 -25
  46. package/src/wc-lit-element/templates/styles/MyEl-styles.js +15 -11
  47. package/src/wc-lit-element-ts/index.js +91 -0
  48. package/src/wc-lit-element-ts/templates/MyEl.ts +46 -0
  49. package/src/wc-lit-element-ts/templates/my-el.ts +3 -0
  50. package/src/wc-lit-element-ts/templates/package.json +24 -0
  51. package/src/wc-lit-element-ts/templates/partials/README.demoing.md +13 -0
  52. package/src/wc-lit-element-ts/templates/partials/README.linting.md +13 -0
  53. package/src/wc-lit-element-ts/templates/partials/README.testing.md +13 -0
  54. package/src/wc-lit-element-ts/templates/static/README.md +35 -0
  55. package/src/wc-lit-element-ts/templates/static/demo/index.html +25 -0
  56. package/src/wc-lit-element-ts/templates/static/index.ts +1 -0
  57. package/src/wc-lit-element-ts/templates/styles/MyEl-styles.ts +20 -0
  58. package/src/wc-lit-element-ts/templates/tsconfig.json +27 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Web Component with Lit project scaffolding
1
+ # Web Component with Lit - Scaffolding
2
2
 
3
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
 
@@ -14,12 +14,17 @@ This scaffold generator extends and customizes the core parts of [@open-wc/creat
14
14
  - ### [vitejs](https://vitejs.dev/)
15
15
 
16
16
  - Dev Server
17
- - Optimized Build
17
+ - Static demo
18
18
  - TypeScript
19
19
 
20
20
  - ### [sass](https://github.com/oscarmarina/sass-style-template)
21
21
  - SCSS watcher with autoprefixer
22
22
 
23
+ - ### miscellany
24
+ - [tsconfig](https://github.com/lit/lit/blob/main/packages/lit-starter-ts/tsconfig.json)
25
+ - [Custom Elements Manifest](https://custom-elements-manifest.open-wc.org/blog/intro/)
26
+ - [ESLint 8 - decorators](https://github.com/eslint/eslint/issues/15299#issuecomment-968099681)
27
+
23
28
  <hr>
24
29
 
25
30
  ## Installation
@@ -61,12 +66,23 @@ npm run format
61
66
  import { defaultReporter } from '@web/test-runner';
62
67
  import { mochaStyleReporter } from '@blockquote/test-runner-mocha-style-reporter';
63
68
 
64
- export default {
65
- reporters: [defaultReporter(), mochaStyleReporter()],
69
+ const outDir = process.env.OUTDIR || '.';
70
+
71
+ export default ({
72
+ files: [`${outDir}/test/**/*.test.js`],
73
+
74
+ nodeResolve: {
75
+ exportConditions: ['browser', 'development'],
76
+ },
77
+
78
+ reporters: [
79
+ defaultReporter(),
80
+ mochaStyleReporter(),
81
+ ],
66
82
 
67
83
  coverageConfig: {
68
84
  report: true,
69
- reportDir: 'test/coverage',
85
+ reportDir: `${outDir}/test/coverage`,
70
86
  threshold: {
71
87
  statements: 80,
72
88
  branches: 80,
@@ -80,6 +96,8 @@ export default {
80
96
  ui: 'tdd',
81
97
  },
82
98
  },
99
+
100
+ ...
83
101
  };
84
102
  ```
85
103
 
@@ -102,20 +120,22 @@ npm run test:watch
102
120
 
103
121
  ### dev server
104
122
 
123
+ - Vite supports importing .ts files out of the box ([4848](https://github.com/vitejs/vite/issues/4848), [3040](https://github.com/vitejs/vite/issues/3040#issuecomment-940697809))
124
+
105
125
  ```bash
106
126
  npm run vite
107
127
  ```
108
128
 
109
- ### build command
110
-
129
+ ### For hosting a static demo purposes only - [Do not bundle](https://justinfagnani.com/2019/11/01/how-to-publish-web-components-to-npm/#do-not-bundle)
111
130
 
112
131
  ```bash
113
- npm run vite-build
132
+ npm run dev:vite
114
133
  ```
115
- - [vitejs - server static-deploy](https://vitejs.dev/guide/static-deploy.html)
134
+
135
+ ### [server static-deploy](https://vitejs.dev/guide/static-deploy.html)
116
136
 
117
137
  ```bash
118
- npm run vite-previes
138
+ npm run preview:vite
119
139
  ```
120
140
 
121
141
  <hr>
@@ -131,7 +151,6 @@ npm run sass:watch
131
151
 
132
152
  <hr>
133
153
  <br>
134
- <br>
135
154
 
136
155
  ### Start:
137
156
 
@@ -141,43 +160,15 @@ npm run sass:watch
141
160
  npm start
142
161
  ```
143
162
 
144
- <hr>
145
-
146
- ## scripts - package.json
147
-
148
- ```json
149
- "scripts": {
150
- "analyze": "cem analyze --litelement --globs \"{src,define}/**/*.{js,ts}\" \"index.js\"",
151
- "format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.js\" --write --ignore-path .gitignore",
152
- "postinstall": "npm run sort:package",
153
- "lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.js\" --check --ignore-path .gitignore",
154
- "openwc": "web-dev-server",
155
- "sass:watch": "sass-style-template",
156
- "sort:package": "npx sort-package-json",
157
- "start": "concurrently -k -r \"npm:sass:watch\" \"npm:vite\"",
158
- "start:openwc": "concurrently -k -r \"npm:sass:watch\" \"npm:openwc\"",
159
- "test": "web-test-runner --coverage",
160
- "test:watch": "web-test-runner --watch",
161
- "vite": "vite",
162
- "vite-build": "vite build",
163
- "vite-preview": "vite preview",
164
- "wca": "wca analyze \"{src,define}/**/*.{js,ts}\" \"index.js\" --visibility private --outFile custom-elements-wca.json && wca analyze \"{src,define}/**/*.{js,ts}\" \"index.js\" --outFile README.md"
165
- },
166
- ```
167
-
168
163
  <hr>
169
164
  <br>
170
165
 
171
166
  ## Different major versions:
172
167
 
173
- blockquote scaffold
174
-
175
168
  ```json
176
169
  "devDependencies": {
177
170
  "eslint": "^8.0.0",
178
171
  "@open-wc/eslint-config": "^7.0.0",
179
- "husky": "^7.0.0",
180
- "lint-staged": "^11.0.0",
181
172
  ...
182
173
  }
183
174
 
@@ -189,8 +180,6 @@ open-wc scaffold
189
180
  "devDependencies": {
190
181
  "eslint": "^7.32.0",
191
182
  "@open-wc/eslint-config": "^4.3.0",
192
- "husky": "^4.3.8",
193
- "lint-staged": "^10.5.4",
194
183
  ...
195
184
  }
196
185
 
@@ -198,26 +187,26 @@ open-wc scaffold
198
187
 
199
188
  <hr>
200
189
 
201
- ## File structure
190
+ ## File structure JS & TS
202
191
 
203
192
  ```css
204
193
  ./
205
194
  ├── my-el/
206
195
  │ ├── define/
207
- │ │ └── my-el.js
196
+ │ │ └── my-el.{js,ts}
208
197
  │ ├── demo/
209
198
  │ │ └── index.html
210
199
  │ ├── src/
211
200
  │ │ ├── styles/
212
- │ │ │ ├── MyEl-styles.js
201
+ │ │ │ ├── MyEl-styles.{js,ts}
213
202
  │ │ │ └── MyEl.scss
214
- │ │ └── MyEl.js
203
+ │ │ └── MyEl.{js,ts}
215
204
  │ ├── test/
216
- │ │ └── my-el.test.js
205
+ │ │ └── my-el.test.{js,ts}
217
206
  │ ├── .editorconfig
218
207
  │ ├── .gitignore
219
208
  │ ├── index.html
220
- │ ├── index.js
209
+ │ ├── index.{js,ts}
221
210
  │ ├── LICENSE
222
211
  │ ├── package.json
223
212
  │ ├── README.md
@@ -226,15 +215,12 @@ open-wc scaffold
226
215
  │ └── web-test-runner.config.mjs
227
216
  ```
228
217
 
218
+ <hr>
219
+
229
220
  ### the component definition is generated in its own folder
230
221
  ```css
231
222
  ./
232
223
  ├── my-el/
233
224
  │ ├── define/
234
- │ │ └── my-el.js
235
- ```
236
- ```js
237
- import { MyEl } from '../src/MyEl.js';
238
-
239
- customElements.define(MyEl.is, MyEl);
225
+ │ │ └── my-el.{js,ts}
240
226
  ```
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@blockquote/create-wc",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
+ "description": "Web component with Lit scaffolding - Extending Open Web Component",
4
5
  "keywords": [
5
6
  "LitElement",
6
7
  "web-component",
@@ -10,33 +11,32 @@
10
11
  "openwc",
11
12
  "generator"
12
13
  ],
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "description": "Web component with Lit scaffolding - Extending Open Web Component",
17
- "license": "MIT",
18
- "type": "module",
14
+ "homepage": "https://github.com/oscarmarina/create",
19
15
  "repository": {
20
16
  "type": "git",
21
17
  "url": "https://github.com/oscarmarina/create.git"
22
18
  },
23
- "homepage": "https://github.com/oscarmarina/create",
19
+ "license": "MIT",
24
20
  "author": "Oscar Marina",
21
+ "type": "module",
25
22
  "bin": {
26
23
  "create-blockquote-wc": "./src/create.js"
27
24
  },
25
+ "files": [
26
+ "/src/"
27
+ ],
28
28
  "scripts": {
29
- "start": "node ./src/create.js",
29
+ "format": "eslint --ext .ts,.js,.mjs,.cjs --fix && prettier \"**/*.{ts,js,mjs,cjs,md}\" --check --ignore-path .eslintignore --write",
30
30
  "lint": "npm run lint:eslint && npm run lint:prettier",
31
31
  "lint:eslint": "eslint --ext .js,.mjs,.cjs .",
32
32
  "lint:prettier": "prettier \"**/*.{js,mjs,cjs,md.json}\" --check --ignore-path .eslintignore",
33
- "format": "eslint --ext .ts,.js,.mjs,.cjs --fix && prettier \"**/*.{ts,js,mjs,cjs,md}\" --check --ignore-path .eslintignore --write"
33
+ "start": "node ./src/create.js"
34
34
  },
35
- "files": [
36
- "/src/"
37
- ],
38
- "engines": {
39
- "node": ">=14.15.0"
35
+ "prettier": {
36
+ "arrowParens": "always",
37
+ "printWidth": 100,
38
+ "singleQuote": true,
39
+ "trailingComma": "all"
40
40
  },
41
41
  "dependencies": {
42
42
  "@open-wc/create": "^0.37.95",
@@ -51,10 +51,10 @@
51
51
  "eslint-config-prettier": "^8.2.0",
52
52
  "prettier": "^2.2.1"
53
53
  },
54
- "prettier": {
55
- "singleQuote": true,
56
- "arrowParens": "always",
57
- "printWidth": 100,
58
- "trailingComma": "all"
54
+ "engines": {
55
+ "node": ">=14.15.0"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
59
  }
60
60
  }
package/src/Generator.js CHANGED
@@ -4,9 +4,11 @@ import _Generator from '@open-wc/create/dist/Generator.js';
4
4
  /**
5
5
  * Options for the generator
6
6
  * @typedef {object} GeneratorOptions
7
- * @property {string} [name] the workshop name
7
+ * @property {string} [tagName] the dash-case tag name
8
8
  * @property {string} [destinationPath='auto'] path to output to. default value 'auto' will output to current working directory
9
+ * @property {'scaffold'} [type='scaffold'] path to output to. default value 'auto' will output to current working directory
9
10
  * @property {'true'|'false'} [writeToDisk] whether to write to disk
11
+ * @property {'yarn'|'npm'|'false'} [installDependencies] whether and with which tool to install dependencies
10
12
  */
11
13
 
12
14
  class Generator extends _Generator.default {
@@ -1,17 +1,34 @@
1
- import { LintingMixin } from '@open-wc/create/dist/generators/linting/index.js';
1
+ // js
2
+ import { CommonLintingMixin } from '../common-linting/index.js';
3
+ import { CommonTestingWtrMixin } from '../common-testing-wtr/index.js';
4
+
5
+
6
+ import { LintingMixin } from '../linting/index.js';
2
7
  import { WcLitElementPackageMixin } from '../wc-lit-element/index.js';
3
8
  import { TestingMixin, TestingScaffoldMixin } from '../testing/index.js';
4
9
 
10
+ // ts
11
+ import { TsLintingMixin } from '../linting-ts/index.js';
12
+ import { TsWcLitElementPackageMixin } from '../wc-lit-element-ts/index.js';
13
+ import { TsTestingMixin, TsTestingScaffoldMixin } from '../testing-ts/index.js';
14
+
5
15
  export function gatherMixins(options) {
6
16
  const mixins = [];
7
- switch (options.type) {
8
- case 'scaffold':
9
- mixins.push(LintingMixin);
10
- mixins.push(TestingMixin);
11
- mixins.push(TestingScaffoldMixin);
12
- mixins.push(WcLitElementPackageMixin);
13
- break;
14
- // no default
17
+ if (options.typescript === 'true') {
18
+ mixins.push(CommonLintingMixin);
19
+ mixins.push(TsLintingMixin);
20
+ mixins.push(CommonTestingWtrMixin);
21
+ mixins.push(TsTestingMixin);
22
+ mixins.push(TsTestingScaffoldMixin);
23
+ mixins.push(TsWcLitElementPackageMixin);
24
+ } else {
25
+ mixins.push(CommonLintingMixin);
26
+ mixins.push(LintingMixin);
27
+ mixins.push(CommonTestingWtrMixin);
28
+ mixins.push(TestingMixin);
29
+ mixins.push(TestingScaffoldMixin);
30
+ mixins.push(WcLitElementPackageMixin);
15
31
  }
32
+
16
33
  return mixins;
17
34
  }
package/src/app/index.js CHANGED
@@ -47,6 +47,15 @@ export const AppMixin = (subclass) =>
47
47
  ? 'Without @'
48
48
  : true,
49
49
  },
50
+ {
51
+ type: 'select',
52
+ name: 'typescript',
53
+ message: 'Would you like to use typescript?',
54
+ choices: [
55
+ { title: 'No', value: 'false' },
56
+ { title: 'Yes', value: 'true' },
57
+ ],
58
+ },
50
59
  ];
51
60
 
52
61
  this.options = await prompts(questions, {
@@ -55,7 +64,7 @@ export const AppMixin = (subclass) =>
55
64
  },
56
65
  });
57
66
 
58
- // simulate prompts open-wc,
67
+ // simulate 'scaffold' option - @open-wc,
59
68
  this.options.type = 'scaffold';
60
69
 
61
70
  const mixins = gatherMixins(this.options);
@@ -0,0 +1,18 @@
1
+ /* eslint-disable no-console */
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname } from 'path';
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ export const CommonLintingMixin = (subclass) =>
9
+ class extends subclass {
10
+ async execute() {
11
+ await super.execute();
12
+ // extend package.json
13
+ this.copyTemplateJsonInto(
14
+ `${__dirname}/templates/package.json`,
15
+ this.destinationPath('package.json'),
16
+ );
17
+ }
18
+ };
@@ -0,0 +1,41 @@
1
+ {
2
+ "husky": {
3
+ "hooks": {
4
+ "pre-commit": "lint-staged"
5
+ }
6
+ },
7
+ "lint-staged": {
8
+ "**/*.{js,ts,json,html}": [
9
+ "npm run format"
10
+ ]
11
+ },
12
+ "eslintConfig": {
13
+ "extends": [
14
+ "prettier",
15
+ "@open-wc"
16
+ ],
17
+ "rules": {
18
+ "import/no-unresolved": "off",
19
+ "class-methods-use-this": "off",
20
+ "object-curly-newline": "off",
21
+ "import/extensions": ["error", "always", { "ignorePackages": true }]
22
+ }
23
+ },
24
+ "prettier": {
25
+ "arrowParens": "avoid",
26
+ "singleQuote": true,
27
+ "trailingComma": "all"
28
+ },
29
+ "scripts": {
30
+ "format": "eslint \"{src,define,test}/**/*.{js,ts,json,html}\" \"index.*\" . --fix --ignore-path .gitignore && prettier \"**/*.{js,ts,json,html,md}\" --write --ignore-path .gitignore",
31
+ "lint": "eslint \"{src,define,test}/**/*.{js,ts,json,html}\" \"index.*\" . --ignore-path .gitignore && prettier \"**/*.{js,ts,json,html,md}\" --check --ignore-path .gitignore"
32
+ },
33
+ "devDependencies": {
34
+ "eslint": "^8.0.0",
35
+ "@open-wc/eslint-config": "^7.0.0",
36
+ "husky": "^4.3.8",
37
+ "lint-staged": "^12.0.0",
38
+ "prettier": "^2.4.1",
39
+ "eslint-config-prettier": "^8.3.0"
40
+ }
41
+ }
@@ -15,12 +15,19 @@ export const CommonRepoMixin = (subclass) =>
15
15
  };
16
16
 
17
17
  await super.execute();
18
+ const { className } = this.templateData;
18
19
 
19
20
  this.copyTemplateJsonInto(
20
21
  `${__dirname}/templates/package.json`,
21
22
  this.destinationPath('package.json'),
22
23
  );
23
24
 
25
+ // write & rename el scss template
26
+ this.copyTemplate(
27
+ `${__dirname}/templates/styles/MyEl.scss`,
28
+ this.destinationPath(`src/styles/${className}.scss`),
29
+ );
30
+
24
31
  // write and rename .gitignore
25
32
  this.copyTemplate(`${__dirname}/templates/gitignore`, this.destinationPath(`.gitignore`));
26
33
 
@@ -22,6 +22,7 @@ __snapshots__
22
22
  *.config.js
23
23
  /_site/
24
24
  /dist/
25
+ /dev/
25
26
  /build/
26
27
  /out-tsc/
27
28
 
@@ -4,39 +4,40 @@
4
4
  "description": "Webcomponent <%= tagName %> following open-wc recommendations",
5
5
  "keywords": [
6
6
  "lit",
7
- "web-component"
7
+ "web-component",
8
+ "lit-element"
8
9
  ],
9
10
  "author": "<%= tagName %>",
10
11
  "license": "MIT",
11
12
  "customElements": "custom-elements.json",
12
13
  "scripts": {
13
- "start:openwc": "concurrently -k -r \"npm:sass:watch\" \"npm:openwc\"",
14
- "openwc": "web-dev-server",
15
- "vite-build": "vite build",
16
- "vite-preview": "vite preview",
14
+ "start": "concurrently -k -r \"npm:sass:watch\" \"npm:vite\"",
15
+ "vite": "vite",
16
+ "dev:vite": "vite build",
17
+ "preview:vite": "vite preview",
17
18
  "analyze": "cem analyze --litelement --globs \"{src,define}/**/*.{js,ts}\" \"index.js\"",
18
- "wca": "wca analyze \"{src,define}/**/*.{js,ts}\" \"index.js\" --visibility private --outFile custom-elements-wca.json && wca analyze \"{src,define}/**/*.{js,ts}\" \"index.js\" --outFile README.md",
19
- "sort:package" : "npx sort-package-json",
19
+ "analyze:watch": "cem analyze --litelement --globs \"{src,define}/**/*.{js,ts}\" \"index.js\" --watch",
20
+ "sort:package": "npx sort-package-json",
20
21
  "postinstall": "npm run sort:package"
21
22
  },
23
+ "dependencies": {
24
+ "lit": "^2.0.2"
25
+ },
22
26
  "devDependencies": {
23
27
  "@blockquote/sass-style-template": "^2.0.0",
24
28
  "@blockquote/test-runner-mocha-style-reporter": "^1.0.0",
25
29
  "@custom-elements-manifest/analyzer": "^0.5.3",
30
+ "@custom-elements-manifest/to-markdown": "^0.1.0",
26
31
  "@ungap/global-this": "^0.4.4",
32
+ "@web/dev-server": "^0.1.25",
27
33
  "@web/rollup-plugin-html": "^1.10.1",
28
34
  "@webcomponents/shadycss": "^1.11.0",
29
35
  "@webcomponents/webcomponentsjs": "^2.6.0",
30
- "concurrently": "^6.2.1",
36
+ "concurrently": "^6.4.0",
31
37
  "rollup-plugin-copy": "^3.4.0",
32
- "rollup-plugin-filesize": "^9.1.1",
38
+ "rollup-plugin-summary": "^1.3.0",
33
39
  "rollup-plugin-minify-html-literals": "^1.2.6",
34
- "vite": "^2.6.7",
35
- "web-component-analyzer": "^2.0.0-next.3",
36
- "sort-package-json": "^1.52.0",
37
- "eslint": "^8.0.0",
38
- "@open-wc/eslint-config": "^7.0.0",
39
- "husky": "^7.0.0",
40
- "lint-staged": "^11.0.0"
40
+ "vite": "^2.7.0-beta.7",
41
+ "sort-package-json": "^1.52.0"
41
42
  }
42
43
  }
@@ -8,4 +8,4 @@
8
8
  <meta http-equiv="refresh" content="0; url=demo/index.html" />
9
9
  </head>
10
10
  <body></body>
11
- </html>
11
+ </html>
@@ -1,7 +1,7 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import pluginHtml from '@web/rollup-plugin-html';
3
3
  import copy from 'rollup-plugin-copy';
4
- import filesize from 'rollup-plugin-filesize';
4
+ import summary from 'rollup-plugin-summary';
5
5
  import minifyHTML from 'rollup-plugin-minify-html-literals';
6
6
 
7
7
  const minifyHTMLLiteralsConfig = {
@@ -12,41 +12,35 @@ const minifyHTMLLiteralsConfig = {
12
12
  },
13
13
  };
14
14
 
15
- const filesizeConfig = {
16
- showGzippedSize: true,
17
- showBrotliSize: false,
18
- showMinifiedSize: false,
19
- };
20
-
21
15
  const copyConfig = {
22
16
  targets: [
23
17
  {
24
18
  src: 'node_modules/@ungap/global-this/index.js',
25
- dest: 'dist/web_modules/@ungap/global-this',
19
+ dest: 'dev/web_modules/@ungap/global-this',
26
20
  },
27
21
  {
28
22
  src: 'node_modules/lit/polyfill-support.js',
29
- dest: 'dist/web_modules/lit',
23
+ dest: 'dev/web_modules/lit',
30
24
  },
31
25
  {
32
26
  src: 'node_modules/lit/polyfill-support.js.map',
33
- dest: 'dist/web_modules/lit',
27
+ dest: 'dev/web_modules/lit',
34
28
  },
35
29
  {
36
30
  src: 'node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js',
37
- dest: 'dist/web_modules/@webcomponents/webcomponentsjs',
31
+ dest: 'dev/web_modules/@webcomponents/webcomponentsjs',
38
32
  },
39
33
  {
40
34
  src: 'node_modules/@webcomponents/webcomponentsjs/bundles',
41
- dest: 'dist/web_modules/@webcomponents/webcomponentsjs',
35
+ dest: 'dev/web_modules/@webcomponents/webcomponentsjs',
42
36
  },
43
37
  {
44
38
  src: 'node_modules/@webcomponents/shadycss/custom-style-interface.min.js',
45
- dest: 'dist/web_modules/@webcomponents/shadycss',
39
+ dest: 'dev/web_modules/@webcomponents/shadycss',
46
40
  },
47
41
  {
48
42
  src: 'node_modules/@webcomponents/shadycss/custom-style-interface.min.js.map',
49
- dest: 'dist/web_modules/@webcomponents/shadycss',
43
+ dest: 'dev/web_modules/@webcomponents/shadycss',
50
44
  },
51
45
  ],
52
46
  hook: 'writeBundle',
@@ -58,28 +52,27 @@ export default defineConfig({
58
52
  plugins: [
59
53
  pluginHtml({
60
54
  transformHtml: [
61
- (html) =>
62
- html.replace(
63
- '<meta charset="utf-8">',
64
- `
65
- <meta charset="utf-8">
66
- <script src="./web_modules/@ungap/global-this/index.js"></script>
67
- <script src="./web_modules/lit/polyfill-support.js"></script>
68
- <script src="./web_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
69
- <script src="./web_modules/@webcomponents/shadycss/custom-style-interface.min.js"></script>`,
70
- ),
55
+ html => html.replace(
56
+ '<meta charset="utf-8">',
57
+ `<meta charset="utf-8">
58
+ <script src="./web_modules/@ungap/global-this/index.js"></script>
59
+ <script src="./web_modules/lit/polyfill-support.js"></script>
60
+ <script src="./web_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
61
+ <script src="./web_modules/@webcomponents/shadycss/custom-style-interface.min.js"></script>`,
62
+ ),
71
63
  ],
72
64
  }),
73
65
 
74
66
  minifyHTML(minifyHTMLLiteralsConfig),
75
67
  copy(copyConfig),
76
- filesize(filesizeConfig),
68
+ summary(),
77
69
  ],
78
70
  build: {
71
+ outDir: 'dev',
79
72
  rollupOptions: {
80
73
  input: 'demo/*.html',
81
74
  output: {
82
- dir: 'dist/',
75
+ dir: 'dev/',
83
76
  format: 'es',
84
77
  },
85
78
  },
@@ -9,4 +9,5 @@
9
9
 
10
10
  *, *:before, *:after {
11
11
  box-sizing: inherit;
12
+ white-space: nowrap;
12
13
  }
@@ -0,0 +1,14 @@
1
+ /* eslint-disable no-console */
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname } from 'path';
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ export const CommonTestingWtrMixin = (subclass) =>
9
+ class extends subclass {
10
+ async execute() {
11
+ await super.execute();
12
+ await this.copyTemplates(`${__dirname}/templates/static/**/*`);
13
+ }
14
+ };