@blueprintui/cli 0.8.1 → 0.10.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/.nvmrc +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +3 -3
- package/package.json +20 -17
- package/src/custom-elements-manifest.config.mjs +12 -2
- package/src/index.mjs +17 -3
- package/src/project/tsconfig.json +1 -1
- package/src/project/tsconfig.lib.json +1 -1
- package/src/rollup.config.mjs +1 -22
- package/src/utils.mjs +8 -3
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
22.8.0
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/@blueprintui%2Fcli)
|
|
4
4
|
|
|
5
|
-
## Opinionated CLI for creating Web Component Libraries
|
|
5
|
+
## Opinionated Minimal CLI for creating Web Component Libraries
|
|
6
6
|
|
|
7
7
|
Blueprint CLI provides an out-of-the-box tool kit for compiling and creating
|
|
8
8
|
Web Component libraries. This project is still an experimental work in progress.
|
|
@@ -48,10 +48,10 @@ Below are the default values unless otherwise specified.
|
|
|
48
48
|
export default {
|
|
49
49
|
library: {
|
|
50
50
|
externals: [],
|
|
51
|
-
assets: ['./README.md', './LICENSE.md'
|
|
51
|
+
assets: ['./README.md', './LICENSE.md'],
|
|
52
52
|
customElementsManifestLockFile: './custom-elements.lock.json',
|
|
53
53
|
baseDir: './src',
|
|
54
|
-
outDir: './dist
|
|
54
|
+
outDir: './dist',
|
|
55
55
|
entryPoints: ['./src/**/index.ts'],
|
|
56
56
|
tsconfig: './tsconfig.lib.json',
|
|
57
57
|
sourcemap: false,
|
package/package.json
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueprintui/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./index.mjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"bp": "./src/index.mjs"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"start": "cd docs && lite-server",
|
|
12
|
-
"deploy": "firebase deploy --only hosting:blueprintui-cli"
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": "22.8.0"
|
|
13
11
|
},
|
|
14
12
|
"author": "Crylan Software",
|
|
15
13
|
"license": "MIT",
|
|
16
14
|
"dependencies": {
|
|
17
|
-
"@custom-elements-manifest/analyzer": "0.10.
|
|
15
|
+
"@custom-elements-manifest/analyzer": "0.10.3",
|
|
18
16
|
"@lit/ts-transformers": "2.0.1",
|
|
19
17
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
20
18
|
"@rollup/plugin-replace": "5.0.7",
|
|
21
19
|
"@rollup/plugin-typescript": "11.1.6",
|
|
22
20
|
"@rollup/plugin-virtual": "3.0.2",
|
|
23
|
-
"@
|
|
24
|
-
"
|
|
25
|
-
"acorn-import-assertions": "1.9.0",
|
|
26
|
-
"browserslist": "4.23.1",
|
|
21
|
+
"@rollup/pluginutils": "5.1.0",
|
|
22
|
+
"browserslist": "4.23.2",
|
|
27
23
|
"commander": "12.1.0",
|
|
24
|
+
"custom-element-vs-code-integration": "1.4.1",
|
|
28
25
|
"glob": "10.4.1",
|
|
29
26
|
"lightningcss": "1.25.1",
|
|
30
27
|
"minify-html-literals": "1.3.5",
|
|
31
28
|
"path": "0.12.7",
|
|
32
|
-
"
|
|
29
|
+
"publint": "0.2.10",
|
|
30
|
+
"rollup": "4.21.3",
|
|
33
31
|
"rollup-plugin-copy": "3.5.0",
|
|
34
32
|
"rollup-plugin-css-modules": "0.1.2",
|
|
35
|
-
"rollup-plugin-delete": "2.
|
|
33
|
+
"rollup-plugin-delete": "2.1.0",
|
|
36
34
|
"rollup-plugin-shell": "1.0.9",
|
|
37
|
-
"terser": "5.
|
|
38
|
-
"tslib": "2.
|
|
39
|
-
"typescript": "~5.
|
|
40
|
-
"zx": "8.1.
|
|
35
|
+
"terser": "5.32.0",
|
|
36
|
+
"tslib": "2.7.0",
|
|
37
|
+
"typescript": "~5.6.2",
|
|
38
|
+
"zx": "8.1.6"
|
|
41
39
|
},
|
|
42
40
|
"devDependencies": {
|
|
43
41
|
"lite-server": "2.6.1"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"bp": "./src/index.mjs",
|
|
45
|
+
"start": "cd docs && lite-server",
|
|
46
|
+
"deploy": "firebase deploy --only hosting:blueprintui-cli"
|
|
44
47
|
}
|
|
45
|
-
}
|
|
48
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
|
+
import { customElementVsCodePlugin } from 'custom-element-vs-code-integration';
|
|
2
3
|
|
|
3
4
|
const cwd = process.cwd();
|
|
4
5
|
const baseSrc = resolve(cwd, 'src');
|
|
@@ -10,7 +11,7 @@ if (process.env.BLUEPRINTUI_CONFIG) {
|
|
|
10
11
|
|
|
11
12
|
const config = {
|
|
12
13
|
baseDir: './src',
|
|
13
|
-
outDir: './dist
|
|
14
|
+
outDir: './dist',
|
|
14
15
|
...userConfig?.default?.library
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -26,7 +27,16 @@ export default {
|
|
|
26
27
|
],
|
|
27
28
|
outdir: config.outDir,
|
|
28
29
|
litelement: true,
|
|
29
|
-
plugins: [
|
|
30
|
+
plugins: [
|
|
31
|
+
tsExtension(),
|
|
32
|
+
baseDir(),
|
|
33
|
+
orderElements(),
|
|
34
|
+
metadata({ tags: ['docs', 'spec', 'status'] }),
|
|
35
|
+
customElementVsCodePlugin({
|
|
36
|
+
outdir: config.outDir,
|
|
37
|
+
hideLogs: true
|
|
38
|
+
})
|
|
39
|
+
],
|
|
30
40
|
};
|
|
31
41
|
|
|
32
42
|
function orderElements() {
|
package/src/index.mjs
CHANGED
|
@@ -10,6 +10,8 @@ import { cp, lstat, readdir } from 'fs/promises';
|
|
|
10
10
|
import { readFileSync, writeFileSync } from 'fs';
|
|
11
11
|
import { join, resolve } from 'path';
|
|
12
12
|
import { getUserConfig } from './utils.mjs';
|
|
13
|
+
import { publint } from 'publint';
|
|
14
|
+
import { formatMessage } from 'publint/utils';
|
|
13
15
|
|
|
14
16
|
const deepReadDir = async (dirPath) => await Promise.all(
|
|
15
17
|
(await readdir(dirPath)).map(async (entity) => {
|
|
@@ -35,7 +37,7 @@ program
|
|
|
35
37
|
.action(async (options, command) => {
|
|
36
38
|
process.env.BLUEPRINTUI_BUILD = !options.watch ? 'production' : 'development';
|
|
37
39
|
process.env.BLUEPRINTUI_CONFIG = command.args[0] ? path.resolve(command.args[0]) : path.resolve('./blueprint.config.js');
|
|
38
|
-
buildRollup(options);
|
|
40
|
+
await buildRollup(options);
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
program
|
|
@@ -85,7 +87,7 @@ program
|
|
|
85
87
|
program.parse();
|
|
86
88
|
|
|
87
89
|
function buildRollup(args) {
|
|
88
|
-
loadConfigFile(path.resolve(__dirname, './rollup.config.mjs'), {}).then(
|
|
90
|
+
return loadConfigFile(path.resolve(__dirname, './rollup.config.mjs'), {}).then(
|
|
89
91
|
async ({ options, warnings }) => {
|
|
90
92
|
if (warnings.count) {
|
|
91
93
|
console.log(`${warnings.count} warnings`);
|
|
@@ -106,8 +108,20 @@ function buildRollup(args) {
|
|
|
106
108
|
}
|
|
107
109
|
if (bundle) {
|
|
108
110
|
const end = Date.now();
|
|
109
|
-
console.log(status.success, `Completed in ${(end - start) / 1000} seconds 🎉`);
|
|
110
111
|
await bundle.close();
|
|
112
|
+
|
|
113
|
+
const { messages } = await spinner('Verifying Package...', async () => await publint({
|
|
114
|
+
strict: true
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
if (messages.length) {
|
|
118
|
+
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
|
|
119
|
+
for (const message of messages) {
|
|
120
|
+
console.log(formatMessage(message, pkg))
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
console.log(status.success, `Success in ${(end - start) / 1000} seconds 🎉`);
|
|
124
|
+
}
|
|
111
125
|
}
|
|
112
126
|
process.exit(buildFailed ? 1 : 0);
|
|
113
127
|
}
|
package/src/rollup.config.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import replace from '@rollup/plugin-replace';
|
|
|
4
4
|
import virtual from '@rollup/plugin-virtual';
|
|
5
5
|
import copy from 'rollup-plugin-copy';
|
|
6
6
|
import del from 'rollup-plugin-delete';
|
|
7
|
-
import execute from 'rollup-plugin-shell';
|
|
8
7
|
import { fs, glob, path } from 'zx';
|
|
9
8
|
import { idiomaticDecoratorsTransformer, constructorCleanupTransformer } from '@lit/ts-transformers';
|
|
10
9
|
import { fileURLToPath } from 'url';
|
|
@@ -53,15 +52,12 @@ export default [
|
|
|
53
52
|
createEntrypoints(),
|
|
54
53
|
nodeResolve({ exportConditions: [project.prod ? 'production' : 'development'] }),
|
|
55
54
|
compileTypescript(),
|
|
56
|
-
typeCheck(),
|
|
57
55
|
project.prod ? [] : writeCache(project),
|
|
58
56
|
project.prod ? minifyHTML() : [],
|
|
59
57
|
project.prod ? minifyJavaScript() : [],
|
|
60
58
|
project.prod ? inlinePackageVersion() : [],
|
|
61
59
|
project.prod ? postClean(): [],
|
|
62
|
-
project.prod ?
|
|
63
|
-
project.prod ? customElementsAnalyzer(project) : [],
|
|
64
|
-
project.prod ? cleanPackageJson() : []
|
|
60
|
+
project.prod ? customElementsAnalyzer(project) : []
|
|
65
61
|
],
|
|
66
62
|
},
|
|
67
63
|
];
|
|
@@ -91,10 +87,6 @@ function compileTypescript() {
|
|
|
91
87
|
});
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
function typeCheck() {
|
|
95
|
-
return execute({ commands: [`tsc --noEmit --project ${project.tsconfig}`], hook: 'buildEnd' });
|
|
96
|
-
}
|
|
97
|
-
|
|
98
90
|
function inlinePackageVersion() {
|
|
99
91
|
return replace({ preventAssignment: false, values: { PACKAGE_VERSION: project.packageJSON.version } });
|
|
100
92
|
}
|
|
@@ -102,16 +94,3 @@ function inlinePackageVersion() {
|
|
|
102
94
|
function postClean() {
|
|
103
95
|
return del({ targets: [`${project.outDir}/**/.tsbuildinfo`, `${project.outDir}/**/_virtual`], hook: 'writeBundle' });
|
|
104
96
|
}
|
|
105
|
-
|
|
106
|
-
function packageCheck() {
|
|
107
|
-
return execute({ commands: [`package-check --cwd ${project.outDir}`], sync: true, hook: 'writeBundle' });
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
function cleanPackageJson() {
|
|
111
|
-
return {
|
|
112
|
-
name: 'clean-package-json',
|
|
113
|
-
writeBundle: async () => {
|
|
114
|
-
await fs.writeFile(`${project.outDir}/package.json`, JSON.stringify({ ...project.packageJSON, scripts: undefined, devDependencies: undefined }, null, 2));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
package/src/utils.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { cli } from '@custom-elements-manifest/analyzer/cli.js';
|
|
2
2
|
|
|
3
3
|
export async function runCustomElementsAnalyzer(customElementsManifestConfig) {
|
|
4
|
-
|
|
4
|
+
// disable noisy log output from custom-elements-manifest
|
|
5
|
+
const log = console.log;
|
|
6
|
+
console.log = () => {};
|
|
7
|
+
const result = await cli({ argv: ['analyze', '--quiet', '--config', customElementsManifestConfig] });
|
|
8
|
+
console.log = log;
|
|
9
|
+
return result;
|
|
5
10
|
}
|
|
6
11
|
|
|
7
12
|
export async function getUserConfig() {
|
|
@@ -12,10 +17,10 @@ export async function getUserConfig() {
|
|
|
12
17
|
|
|
13
18
|
return {
|
|
14
19
|
externals: [],
|
|
15
|
-
assets: [
|
|
20
|
+
assets: [],
|
|
16
21
|
customElementsManifestLockFile: './custom-elements.lock.json',
|
|
17
22
|
baseDir: './src',
|
|
18
|
-
outDir: './dist
|
|
23
|
+
outDir: './dist',
|
|
19
24
|
entryPoints: ['./src/**/index.ts'],
|
|
20
25
|
tsconfig: './tsconfig.lib.json',
|
|
21
26
|
sourcemap: false,
|