@blockquote/create-wc 1.100.0 → 1.102.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 +4 -7
- package/package.json +4 -4
- package/src/app/executeViaOptions.js +2 -2
- package/src/app/gatherMixins.js +6 -6
- package/src/app/index.js +6 -6
- package/src/common-linting/index.js +3 -3
- package/src/common-linting/templates/package.json +7 -7
- package/src/common-repo/index.js +8 -8
- package/src/common-repo/templates/eslint.config.js +1 -0
- package/src/common-repo/templates/gitignore +1 -0
- package/src/common-repo/templates/package.json +2 -2
- package/src/common-repo/templates/prettierignore +1 -0
- package/src/common-testing-wtr/index.js +2 -2
- package/src/create.js +3 -3
- package/src/testing/index.js +6 -6
- package/src/testing/templates/my-el.test.js +1 -1
- package/src/testing-ts/index.js +6 -6
- package/src/testing-ts/templates/my-el.test.ts +2 -2
- package/src/testing-wtr/index.js +3 -3
- package/src/testing-wtr-ts/index.js +3 -3
- package/src/wc-lit-element/index.js +12 -15
- package/src/wc-lit-element/templates/MyEl.js +5 -5
- package/src/wc-lit-element/templates/index.js +1 -1
- package/src/wc-lit-element/templates/my-el.js +1 -1
- package/src/wc-lit-element/templates/static/demo/index.html +4 -4
- package/src/wc-lit-element-ts/index.js +13 -16
- package/src/wc-lit-element-ts/templates/MyEl.ts +6 -6
- package/src/wc-lit-element-ts/templates/index.ts +1 -1
- package/src/wc-lit-element-ts/templates/my-el.ts +1 -1
- package/src/wc-lit-element-ts/templates/package.json +1 -1
- package/src/wc-lit-element-ts/templates/static/demo/index.html +4 -4
- package/src/wc-lit-element-ts/templates/tsconfig.json +13 -7
- package/src/wc-lit-element/templates/static/demo/favicon.svg +0 -12
- package/src/wc-lit-element-ts/templates/static/demo/favicon.svg +0 -12
package/README.md
CHANGED
|
@@ -67,9 +67,9 @@ npm run format
|
|
|
67
67
|
### web-test-runner.config
|
|
68
68
|
|
|
69
69
|
```js
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
70
|
+
import {playwrightLauncher} from '@web/test-runner-playwright';
|
|
71
|
+
import {defaultReporter, summaryReporter} from '@web/test-runner';
|
|
72
|
+
import {coverageTableReporter} from '@blockquote/coverage-table-reporter';
|
|
73
73
|
|
|
74
74
|
const filteredLogs = ['in dev mode'];
|
|
75
75
|
const outDir = process.env.OUTDIR || '.';
|
|
@@ -77,10 +77,7 @@ const outDir = process.env.OUTDIR || '.';
|
|
|
77
77
|
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
78
78
|
files: [`${outDir}/test/**/*.test.js`],
|
|
79
79
|
nodeResolve: true,
|
|
80
|
-
browsers: [
|
|
81
|
-
playwrightLauncher({ product: 'chromium' }),
|
|
82
|
-
playwrightLauncher({ product: 'webkit' }),
|
|
83
|
-
],
|
|
80
|
+
browsers: [playwrightLauncher({product: 'chromium'}), playwrightLauncher({product: 'webkit'})],
|
|
84
81
|
concurrentBrowsers: 2,
|
|
85
82
|
concurrency: 1,
|
|
86
83
|
reporters: [summaryReporter({}), defaultReporter(), coverageTableReporter()],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote/create-wc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.102.0",
|
|
4
4
|
"description": "Web component with Lit scaffolding - Extending Open Web Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"LitElement",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"start": "node ./src/create.js"
|
|
34
34
|
},
|
|
35
35
|
"prettier": {
|
|
36
|
-
"arrowParens": "avoid",
|
|
37
36
|
"bracketSameLine": true,
|
|
38
37
|
"htmlWhitespaceSensitivity": "ignore",
|
|
39
|
-
"printWidth": 100,
|
|
40
38
|
"singleQuote": true,
|
|
41
|
-
"
|
|
39
|
+
"bracketSpacing": false,
|
|
40
|
+
"trailingComma": "es5",
|
|
41
|
+
"printWidth": 100,
|
|
42
42
|
"overrides": [
|
|
43
43
|
{
|
|
44
44
|
"files": "*.{scss,css}",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {executeMixinGenerator} from '@open-wc/create/dist/core.js';
|
|
2
|
+
import {gatherMixins} from './gatherMixins.js';
|
|
3
3
|
import Generator from '../Generator.js';
|
|
4
4
|
|
|
5
5
|
export async function executeViaOptions(options) {
|
package/src/app/gatherMixins.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// js
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {CommonLintingMixin} from '../common-linting/index.js';
|
|
3
|
+
import {CommonTestingWtrMixin} from '../common-testing-wtr/index.js';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import {WcLitElementPackageMixin} from '../wc-lit-element/index.js';
|
|
6
|
+
import {TestingMixin, TestingScaffoldMixin} from '../testing/index.js';
|
|
7
7
|
|
|
8
8
|
// ts
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import {TsWcLitElementPackageMixin} from '../wc-lit-element-ts/index.js';
|
|
10
|
+
import {TsTestingMixin, TsTestingScaffoldMixin} from '../testing-ts/index.js';
|
|
11
11
|
|
|
12
12
|
export function gatherMixins(options) {
|
|
13
13
|
const mixins = [];
|
package/src/app/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import prompts from 'prompts';
|
|
3
3
|
// import commandLineArgs from 'command-line-args';
|
|
4
|
-
import {
|
|
4
|
+
import {executeMixinGenerator} from '@open-wc/create/dist/core.js';
|
|
5
5
|
|
|
6
6
|
import header from './header.js';
|
|
7
|
-
import {
|
|
7
|
+
import {gatherMixins} from './gatherMixins.js';
|
|
8
8
|
import Generator from '../Generator.js';
|
|
9
9
|
|
|
10
10
|
export const AppMixin = (subclass) =>
|
|
@@ -34,8 +34,8 @@ export const AppMixin = (subclass) =>
|
|
|
34
34
|
name: 'nameSpaceSelect',
|
|
35
35
|
message: 'Would you like to use namespace (without @)?',
|
|
36
36
|
choices: [
|
|
37
|
-
{
|
|
38
|
-
{
|
|
37
|
+
{title: 'Yes', value: 'true'},
|
|
38
|
+
{title: 'No', value: 'false'},
|
|
39
39
|
],
|
|
40
40
|
},
|
|
41
41
|
{
|
|
@@ -49,8 +49,8 @@ export const AppMixin = (subclass) =>
|
|
|
49
49
|
name: 'typescript',
|
|
50
50
|
message: 'Would you like to use typescript?',
|
|
51
51
|
choices: [
|
|
52
|
-
{
|
|
53
|
-
{
|
|
52
|
+
{title: 'No', value: 'false'},
|
|
53
|
+
{title: 'Yes', value: 'true'},
|
|
54
54
|
],
|
|
55
55
|
},
|
|
56
56
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {fileURLToPath} from 'url';
|
|
3
|
+
import {dirname} from 'path';
|
|
4
4
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = dirname(__filename);
|
|
@@ -12,7 +12,7 @@ export const CommonLintingMixin = (subclass) =>
|
|
|
12
12
|
// extend package.json
|
|
13
13
|
this.copyTemplateJsonInto(
|
|
14
14
|
`${__dirname}/templates/package.json`,
|
|
15
|
-
this.destinationPath('package.json')
|
|
15
|
+
this.destinationPath('package.json')
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"prettier": {
|
|
24
|
-
"arrowParens": "avoid",
|
|
25
|
-
"printWidth": 100,
|
|
26
24
|
"singleQuote": true,
|
|
27
|
-
"
|
|
25
|
+
"bracketSpacing": false,
|
|
26
|
+
"trailingComma": "es5",
|
|
27
|
+
"printWidth": 100,
|
|
28
28
|
"overrides": [
|
|
29
29
|
{
|
|
30
30
|
"files": "*.{scss,css}",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"@html-eslint/parser": "^0.26.0",
|
|
51
51
|
"eslint": "^8.57.0",
|
|
52
52
|
"eslint-config-prettier": "^9.1.0",
|
|
53
|
-
"typescript-eslint": "^8.
|
|
54
|
-
"husky": "^9.1.
|
|
55
|
-
"lint-staged": "^15.2.
|
|
53
|
+
"typescript-eslint": "^8.4.0",
|
|
54
|
+
"husky": "^9.1.5",
|
|
55
|
+
"lint-staged": "^15.2.10",
|
|
56
56
|
"prettier": "^3.3.3",
|
|
57
|
-
"stylelint": "^16.
|
|
57
|
+
"stylelint": "^16.9.0",
|
|
58
58
|
"stylelint-config-standard-scss": "^13.1.0"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/common-repo/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import path, {
|
|
1
|
+
import {fileURLToPath} from 'url';
|
|
2
|
+
import path, {dirname} from 'path';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -16,17 +16,17 @@ export const CommonRepoMixin = (subclass) =>
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
await super.execute();
|
|
19
|
-
const {
|
|
19
|
+
const {tagName} = this.templateData;
|
|
20
20
|
|
|
21
21
|
this.copyTemplateJsonInto(
|
|
22
22
|
`${__dirname}/templates/package.json`,
|
|
23
|
-
this.destinationPath('package.json')
|
|
23
|
+
this.destinationPath('package.json')
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
// write & rename el scss template
|
|
27
27
|
this.copyTemplate(
|
|
28
28
|
`${__dirname}/templates/styles/my-el.scss`,
|
|
29
|
-
this.destinationPath(`src/styles/${tagName}.scss`)
|
|
29
|
+
this.destinationPath(`src/styles/${tagName}.scss`)
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
// write and rename .gitignore
|
|
@@ -35,12 +35,12 @@ export const CommonRepoMixin = (subclass) =>
|
|
|
35
35
|
// write and rename .prettierignore
|
|
36
36
|
this.copyTemplate(
|
|
37
37
|
`${__dirname}/templates/prettierignore`,
|
|
38
|
-
this.destinationPath(`.prettierignore`)
|
|
38
|
+
this.destinationPath(`.prettierignore`)
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
this.copyTemplate(
|
|
42
42
|
`${__dirname}/templates/eslint.config.js`,
|
|
43
|
-
this.destinationPath(`eslint.config.js
|
|
43
|
+
this.destinationPath(`eslint.config.js`)
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
// copy all other files
|
|
@@ -50,7 +50,7 @@ export const CommonRepoMixin = (subclass) =>
|
|
|
50
50
|
async end() {
|
|
51
51
|
await super.end();
|
|
52
52
|
|
|
53
|
-
const {
|
|
53
|
+
const {destinationPath} = this.options;
|
|
54
54
|
|
|
55
55
|
if (destinationPath) {
|
|
56
56
|
const huskyPreCommit = path.join(this.options.destinationPath, '.husky/pre-commit');
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@web/test-runner-playwright": "^0.11.0",
|
|
38
38
|
"@web/rollup-plugin-html": "^2.3.0",
|
|
39
39
|
"concurrently": "^8.2.2",
|
|
40
|
-
"sort-package-json": "^2.10.
|
|
40
|
+
"sort-package-json": "^2.10.1",
|
|
41
41
|
"ts-lit-plugin": "^2.0.2",
|
|
42
|
-
"vite": "^5.4.
|
|
42
|
+
"vite": "^5.4.3"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {fileURLToPath} from 'url';
|
|
3
|
+
import {dirname} from 'path';
|
|
4
4
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = dirname(__filename);
|
package/src/create.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import semver from 'semver';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
|
-
import {
|
|
7
|
+
import {executeMixinGenerator} from '@open-wc/create/dist/core.js';
|
|
8
8
|
import Generator from './Generator.js';
|
|
9
|
-
import {
|
|
9
|
+
import {AppMixin} from './app/index.js';
|
|
10
10
|
|
|
11
11
|
(async () => {
|
|
12
12
|
try {
|
|
@@ -14,7 +14,7 @@ import { AppMixin } from './app/index.js';
|
|
|
14
14
|
await executeMixinGenerator([AppMixin], {}, Generator);
|
|
15
15
|
} else {
|
|
16
16
|
console.log(
|
|
17
|
-
chalk.bgRed('\nUh oh! Looks like you dont have Node v14.15.0 or higher installed!\n')
|
|
17
|
+
chalk.bgRed('\nUh oh! Looks like you dont have Node v14.15.0 or higher installed!\n')
|
|
18
18
|
);
|
|
19
19
|
console.log(`You can do this by going to ${chalk.underline.blue(`https://nodejs.org/`)}
|
|
20
20
|
|
package/src/testing/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import {fileURLToPath} from 'url';
|
|
3
|
+
import {dirname} from 'path';
|
|
4
|
+
import {TestingWebTestRunnerMixin} from '../testing-wtr/index.js';
|
|
5
5
|
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = dirname(__filename);
|
|
@@ -12,7 +12,7 @@ export const TestingMixin = (subclass) =>
|
|
|
12
12
|
await super.execute();
|
|
13
13
|
this.copyTemplateJsonInto(
|
|
14
14
|
`${__dirname}/templates/package.json`,
|
|
15
|
-
this.destinationPath('package.json')
|
|
15
|
+
this.destinationPath('package.json')
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -22,10 +22,10 @@ export const TestingScaffoldMixin = (subclass) =>
|
|
|
22
22
|
async execute() {
|
|
23
23
|
await super.execute();
|
|
24
24
|
|
|
25
|
-
const {
|
|
25
|
+
const {tagName} = this.templateData;
|
|
26
26
|
this.copyTemplate(
|
|
27
27
|
`${__dirname}/templates/my-el.test.js`,
|
|
28
|
-
this.destinationPath(`test/${tagName}.test.js`)
|
|
28
|
+
this.destinationPath(`test/${tagName}.test.js`)
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
};
|
package/src/testing-ts/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import {fileURLToPath} from 'url';
|
|
3
|
+
import {dirname} from 'path';
|
|
4
|
+
import {TsTestingWebTestRunnerMixin} from '../testing-wtr-ts/index.js';
|
|
5
5
|
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = dirname(__filename);
|
|
@@ -13,7 +13,7 @@ export const TsTestingMixin = (subclass) =>
|
|
|
13
13
|
|
|
14
14
|
this.copyTemplateJsonInto(
|
|
15
15
|
`${__dirname}/templates/package.json`,
|
|
16
|
-
this.destinationPath('package.json')
|
|
16
|
+
this.destinationPath('package.json')
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
@@ -23,10 +23,10 @@ export const TsTestingScaffoldMixin = (subclass) =>
|
|
|
23
23
|
async execute() {
|
|
24
24
|
await super.execute();
|
|
25
25
|
|
|
26
|
-
const {
|
|
26
|
+
const {tagName} = this.templateData;
|
|
27
27
|
this.copyTemplate(
|
|
28
28
|
`${__dirname}/templates/my-el.test.ts`,
|
|
29
|
-
this.destinationPath(`test/${tagName}.test.ts`)
|
|
29
|
+
this.destinationPath(`test/${tagName}.test.ts`)
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {html, fixture, assert, expect, fixtureCleanup} from '@open-wc/testing';
|
|
2
|
+
import {<%= className %>} from '../src/<%= className %>.js';
|
|
3
3
|
import '../define/<%= tagName %>.js';
|
|
4
4
|
|
|
5
5
|
suite('<%= className %>', () => {
|
package/src/testing-wtr/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {fileURLToPath} from 'url';
|
|
2
|
+
import {dirname} from 'path';
|
|
3
3
|
|
|
4
4
|
const __filename = fileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = dirname(__filename);
|
|
@@ -11,7 +11,7 @@ export const TestingWebTestRunnerMixin = (subclass) =>
|
|
|
11
11
|
|
|
12
12
|
this.copyTemplateJsonInto(
|
|
13
13
|
`${__dirname}/templates/package.json`,
|
|
14
|
-
this.destinationPath('package.json')
|
|
14
|
+
this.destinationPath('package.json')
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
// await this.copyTemplates(`${__dirname}/templates/static/**/*`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {fileURLToPath} from 'url';
|
|
2
|
+
import {dirname} from 'path';
|
|
3
3
|
|
|
4
4
|
const __filename = fileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = dirname(__filename);
|
|
@@ -11,7 +11,7 @@ export const TsTestingWebTestRunnerMixin = (subclass) =>
|
|
|
11
11
|
|
|
12
12
|
this.copyTemplateJsonInto(
|
|
13
13
|
`${__dirname}/templates/package.json`,
|
|
14
|
-
this.destinationPath('package.json')
|
|
14
|
+
this.destinationPath('package.json')
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
// await this.copyTemplates(`${__dirname}/templates/static/**/*`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import {fileURLToPath} from 'url';
|
|
3
|
+
import {join, dirname} from 'path';
|
|
4
|
+
import {processTemplate, readFileFromPath} from '@open-wc/create/dist/core.js';
|
|
5
|
+
import {CommonRepoMixin} from '../common-repo/index.js';
|
|
6
6
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = dirname(__filename);
|
|
@@ -11,7 +11,7 @@ const compose = (...fns) =>
|
|
|
11
11
|
fns.reduce(
|
|
12
12
|
(f, g) =>
|
|
13
13
|
(...args) =>
|
|
14
|
-
f(g(...args))
|
|
14
|
+
f(g(...args))
|
|
15
15
|
);
|
|
16
16
|
const safeReduce = (f, initial) => (xs) => (Array.isArray(xs) ? xs.reduce(f, initial) : xs);
|
|
17
17
|
|
|
@@ -35,30 +35,27 @@ export const WcLitElementMixin = (subclass) =>
|
|
|
35
35
|
this.templateData.featureReadmes = safeFeatureReadme(this.options.features);
|
|
36
36
|
|
|
37
37
|
await super.execute();
|
|
38
|
-
const {
|
|
38
|
+
const {tagName, className} = this.templateData;
|
|
39
39
|
|
|
40
40
|
// write & rename index template
|
|
41
|
-
this.copyTemplate(
|
|
42
|
-
`${__dirname}/templates/index.js`,
|
|
43
|
-
this.destinationPath(`src/index.js`),
|
|
44
|
-
);
|
|
41
|
+
this.copyTemplate(`${__dirname}/templates/index.js`, this.destinationPath(`src/index.js`));
|
|
45
42
|
|
|
46
43
|
// write & rename el class template
|
|
47
44
|
this.copyTemplate(
|
|
48
45
|
`${__dirname}/templates/MyEl.js`,
|
|
49
|
-
this.destinationPath(`src/${className}.js`)
|
|
46
|
+
this.destinationPath(`src/${className}.js`)
|
|
50
47
|
);
|
|
51
48
|
|
|
52
49
|
// write & rename el styles template
|
|
53
50
|
this.copyTemplate(
|
|
54
51
|
`${__dirname}/templates/styles/my-el-styles.css.js`,
|
|
55
|
-
this.destinationPath(`src/styles/${tagName}-styles.css.js`)
|
|
52
|
+
this.destinationPath(`src/styles/${tagName}-styles.css.js`)
|
|
56
53
|
);
|
|
57
54
|
|
|
58
55
|
// write & rename el registration template
|
|
59
56
|
this.copyTemplate(
|
|
60
57
|
`${__dirname}/templates/my-el.js`,
|
|
61
|
-
this.destinationPath(`define/${tagName}.js`)
|
|
58
|
+
this.destinationPath(`define/${tagName}.js`)
|
|
62
59
|
);
|
|
63
60
|
|
|
64
61
|
await this.copyTemplates(`${__dirname}/templates/static/**/*`);
|
|
@@ -72,11 +69,11 @@ export const WcLitElementPackageMixin = (subclass) =>
|
|
|
72
69
|
// write & rename package.json
|
|
73
70
|
this.copyTemplateJsonInto(
|
|
74
71
|
`${__dirname}/templates/package.json`,
|
|
75
|
-
this.destinationPath('package.json')
|
|
72
|
+
this.destinationPath('package.json')
|
|
76
73
|
);
|
|
77
74
|
this.copyTemplate(
|
|
78
75
|
`${__dirname}/templates/custom-elements.json`,
|
|
79
|
-
this.destinationPath('custom-elements.json')
|
|
76
|
+
this.destinationPath('custom-elements.json')
|
|
80
77
|
);
|
|
81
78
|
}
|
|
82
79
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {html, LitElement} from 'lit';
|
|
2
|
+
import {styles} from './styles/<%= tagName %>-styles.css.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 
|
|
@@ -25,12 +25,12 @@ export class <%= className %> extends LitElement {
|
|
|
25
25
|
/**
|
|
26
26
|
* The heading to say "Hello" to.
|
|
27
27
|
*/
|
|
28
|
-
heading: {
|
|
28
|
+
heading: {type: String},
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* The number of times the button has been clicked.
|
|
32
32
|
*/
|
|
33
|
-
counter: {
|
|
33
|
+
counter: {type: Number},
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
constructor() {
|
|
@@ -53,7 +53,7 @@ export class <%= className %> extends LitElement {
|
|
|
53
53
|
|
|
54
54
|
#onClick() {
|
|
55
55
|
this.counter += 1;
|
|
56
|
-
this.dispatchEvent(new CustomEvent('counterchange', {
|
|
56
|
+
this.dispatchEvent(new CustomEvent('counterchange', {detail: this.counter}));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {<%= className %>} from './<%= className %>.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title>Demo - <%= tagName %></title>
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
<link rel="icon" href="
|
|
7
|
+
<link rel="icon" href="data:image/x-icon;base64,B" />
|
|
8
8
|
<meta name="description" content="<%= tagName %>" />
|
|
9
9
|
<style>
|
|
10
10
|
html,
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
<div id="demo"></div>
|
|
20
20
|
|
|
21
21
|
<script type="module">
|
|
22
|
-
import {
|
|
22
|
+
import {html, render} from 'lit';
|
|
23
23
|
import '../define/<%= tagName %>.js';
|
|
24
24
|
|
|
25
25
|
const heading = 'World!';
|
|
26
26
|
render(
|
|
27
27
|
html`<<%= tagName %>
|
|
28
|
-
@counterchange="${ev => console.log('==>', ev.detail)}" .heading=${heading}
|
|
28
|
+
@counterchange="${(ev) => console.log('==>', ev.detail)}" .heading=${heading}
|
|
29
29
|
>some light-dom</<%= tagName %>
|
|
30
30
|
>`,
|
|
31
|
-
document.querySelector('#demo')
|
|
31
|
+
document.querySelector('#demo')
|
|
32
32
|
);
|
|
33
33
|
</script>
|
|
34
34
|
</body>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import {fileURLToPath} from 'url';
|
|
3
|
+
import {join, dirname} from 'path';
|
|
4
|
+
import {processTemplate, readFileFromPath} from '@open-wc/create/dist/core.js';
|
|
5
|
+
import {CommonRepoMixin} from '../common-repo/index.js';
|
|
6
6
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = dirname(__filename);
|
|
@@ -11,7 +11,7 @@ const compose = (...fns) =>
|
|
|
11
11
|
fns.reduce(
|
|
12
12
|
(f, g) =>
|
|
13
13
|
(...args) =>
|
|
14
|
-
f(g(...args))
|
|
14
|
+
f(g(...args))
|
|
15
15
|
);
|
|
16
16
|
const safeReduce = (f, initial) => (xs) => (Array.isArray(xs) ? xs.reduce(f, initial) : xs);
|
|
17
17
|
|
|
@@ -35,30 +35,27 @@ export const TsWcLitElementMixin = (subclass) =>
|
|
|
35
35
|
this.templateData.featureReadmes = safeFeatureReadme(this.options.features);
|
|
36
36
|
|
|
37
37
|
await super.execute();
|
|
38
|
-
const {
|
|
38
|
+
const {tagName, className} = this.templateData;
|
|
39
39
|
|
|
40
40
|
// write & rename index template
|
|
41
|
-
this.copyTemplate(
|
|
42
|
-
`${__dirname}/templates/index.ts`,
|
|
43
|
-
this.destinationPath(`src/index.ts`),
|
|
44
|
-
);
|
|
41
|
+
this.copyTemplate(`${__dirname}/templates/index.ts`, this.destinationPath(`src/index.ts`));
|
|
45
42
|
|
|
46
43
|
// write & rename el class template
|
|
47
44
|
this.copyTemplate(
|
|
48
45
|
`${__dirname}/templates/MyEl.ts`,
|
|
49
|
-
this.destinationPath(`src/${className}.ts`)
|
|
46
|
+
this.destinationPath(`src/${className}.ts`)
|
|
50
47
|
);
|
|
51
48
|
|
|
52
49
|
// write & rename el styles template
|
|
53
50
|
this.copyTemplate(
|
|
54
51
|
`${__dirname}/templates/styles/my-el-styles.css.ts`,
|
|
55
|
-
this.destinationPath(`src/styles/${tagName}-styles.css.ts`)
|
|
52
|
+
this.destinationPath(`src/styles/${tagName}-styles.css.ts`)
|
|
56
53
|
);
|
|
57
54
|
|
|
58
55
|
// write & rename el registration template
|
|
59
56
|
this.copyTemplate(
|
|
60
57
|
`${__dirname}/templates/my-el.ts`,
|
|
61
|
-
this.destinationPath(`define/${tagName}.ts`)
|
|
58
|
+
this.destinationPath(`define/${tagName}.ts`)
|
|
62
59
|
);
|
|
63
60
|
|
|
64
61
|
await this.copyTemplates(`${__dirname}/templates/static/**/*`);
|
|
@@ -72,15 +69,15 @@ export const TsWcLitElementPackageMixin = (subclass) =>
|
|
|
72
69
|
// write & rename package.json
|
|
73
70
|
this.copyTemplateJsonInto(
|
|
74
71
|
`${__dirname}/templates/package.json`,
|
|
75
|
-
this.destinationPath('package.json')
|
|
72
|
+
this.destinationPath('package.json')
|
|
76
73
|
);
|
|
77
74
|
this.copyTemplate(
|
|
78
75
|
`${__dirname}/templates/custom-elements.json`,
|
|
79
|
-
this.destinationPath('custom-elements.json')
|
|
76
|
+
this.destinationPath('custom-elements.json')
|
|
80
77
|
);
|
|
81
78
|
this.copyTemplate(
|
|
82
79
|
`${__dirname}/templates/tsconfig.json`,
|
|
83
|
-
this.destinationPath('tsconfig.json')
|
|
80
|
+
this.destinationPath('tsconfig.json')
|
|
84
81
|
);
|
|
85
82
|
}
|
|
86
83
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {html, LitElement} from 'lit';
|
|
2
|
+
import {property} from 'lit/decorators.js';
|
|
3
|
+
import {styles} from './styles/<%= tagName %>-styles.css.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 
|
|
@@ -19,13 +19,13 @@ export class <%= className %> extends LitElement {
|
|
|
19
19
|
/**
|
|
20
20
|
* The heading to say "Hello" to.
|
|
21
21
|
*/
|
|
22
|
-
@property({
|
|
22
|
+
@property({type: String})
|
|
23
23
|
heading = 'Hey there';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The number of times the button has been clicked.
|
|
27
27
|
*/
|
|
28
|
-
@property({
|
|
28
|
+
@property({type: Number})
|
|
29
29
|
counter = 5;
|
|
30
30
|
|
|
31
31
|
override render() {
|
|
@@ -39,7 +39,7 @@ export class <%= className %> extends LitElement {
|
|
|
39
39
|
|
|
40
40
|
#onClick() {
|
|
41
41
|
this.counter += 1;
|
|
42
|
-
this.dispatchEvent(new CustomEvent('counterchange', {
|
|
42
|
+
this.dispatchEvent(new CustomEvent('counterchange', {detail: this.counter}));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {<%= className %>} from './<%= className %>.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title>Demo - <%= tagName %></title>
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
<link rel="icon" href="
|
|
7
|
+
<link rel="icon" href="data:image/x-icon;base64,B" />
|
|
8
8
|
<meta name="description" content="<%= tagName %>" />
|
|
9
9
|
<style>
|
|
10
10
|
html,
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
<div id="demo"></div>
|
|
20
20
|
|
|
21
21
|
<script type="module">
|
|
22
|
-
import {
|
|
22
|
+
import {html, render} from 'lit';
|
|
23
23
|
import '../define/<%= tagName %>.ts';
|
|
24
24
|
|
|
25
25
|
const heading = 'World!';
|
|
26
26
|
render(
|
|
27
27
|
html`<<%= tagName %>
|
|
28
|
-
@counterchange="${ev => console.log('==>', ev.detail)}" .heading=${heading}
|
|
28
|
+
@counterchange="${(ev) => console.log('==>', ev.detail)}" .heading=${heading}
|
|
29
29
|
>some light-dom</<%= tagName %>
|
|
30
30
|
>`,
|
|
31
|
-
document.querySelector('#demo')
|
|
31
|
+
document.querySelector('#demo')
|
|
32
32
|
);
|
|
33
33
|
</script>
|
|
34
34
|
</body>
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"incremental": true,
|
|
4
|
+
"composite": true,
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
7
|
"experimentalDecorators": true,
|
|
6
|
-
"module": "
|
|
7
|
-
"moduleResolution": "
|
|
8
|
+
"module": "ES2022",
|
|
9
|
+
"moduleResolution": "Bundler",
|
|
10
|
+
"resolvePackageJsonExports": true,
|
|
11
|
+
"resolvePackageJsonImports": true,
|
|
8
12
|
"resolveJsonModule": true,
|
|
13
|
+
"allowArbitraryExtensions": true,
|
|
9
14
|
"declaration": true,
|
|
10
15
|
"declarationMap": true,
|
|
11
16
|
"sourceMap": true,
|
|
12
17
|
"outDir": "./dist",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
18
|
+
"stripInternal": true,
|
|
19
|
+
"verbatimModuleSyntax": true,
|
|
20
|
+
"esModuleInterop": true,
|
|
16
21
|
"forceConsistentCasingInFileNames": true,
|
|
17
22
|
"strict": true,
|
|
18
23
|
"noImplicitAny": true,
|
|
@@ -20,6 +25,7 @@
|
|
|
20
25
|
"noUnusedLocals": true,
|
|
21
26
|
"noUnusedParameters": true,
|
|
22
27
|
"noImplicitReturns": true,
|
|
28
|
+
"useDefineForClassFields": false,
|
|
23
29
|
"noFallthroughCasesInSwitch": true,
|
|
24
30
|
"noImplicitOverride": true,
|
|
25
31
|
"plugins": [
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<svg width="96" height="96" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<style>
|
|
3
|
-
.square1 { fill: #888888; }
|
|
4
|
-
.square2 { fill: #D2D2D2; }
|
|
5
|
-
@media (prefers-color-scheme: dark) {
|
|
6
|
-
.square1 { fill: #D2D2D2; }
|
|
7
|
-
.square2 { fill: #888888; }
|
|
8
|
-
}
|
|
9
|
-
</style>
|
|
10
|
-
<rect class="square1" x="24" y="24" width="48" height="48" />
|
|
11
|
-
<rect class="square2" x="33" y="33" width="30" height="30" />
|
|
12
|
-
</svg>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<svg width="96" height="96" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<style>
|
|
3
|
-
.square1 { fill: #888888; }
|
|
4
|
-
.square2 { fill: #D2D2D2; }
|
|
5
|
-
@media (prefers-color-scheme: dark) {
|
|
6
|
-
.square1 { fill: #D2D2D2; }
|
|
7
|
-
.square2 { fill: #888888; }
|
|
8
|
-
}
|
|
9
|
-
</style>
|
|
10
|
-
<rect class="square1" x="24" y="24" width="48" height="48" />
|
|
11
|
-
<rect class="square2" x="33" y="33" width="30" height="30" />
|
|
12
|
-
</svg>
|