@airiot/cli 1.0.2 → 1.0.3
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/package.json +2 -1
- package/scripts/build.js +28 -2
- package/vite-plugin/externals.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airiot/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "AIRIOT平台前端包管理工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {},
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"pacote": "^21.0.3",
|
|
49
49
|
"path-browserify": "^1.0.1",
|
|
50
50
|
"portfinder": "^1.0.28",
|
|
51
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
51
52
|
"scp2": "^0.5.0",
|
|
52
53
|
"svg-inline-loader": "^0.8.2",
|
|
53
54
|
"terser": "^5.25.0",
|
package/scripts/build.js
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { build } from 'vite'
|
|
3
3
|
import paths from '../config/paths.js';
|
|
4
|
-
import
|
|
4
|
+
import getPlugins from '../vite-plugin/index.js';
|
|
5
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
5
6
|
|
|
6
7
|
;(async () => {
|
|
7
8
|
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
let analyze = false;
|
|
11
|
+
for (const arg of args) {
|
|
12
|
+
if (arg === '--analyze') {
|
|
13
|
+
analyze = true;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
if (arg.startsWith('--analyze=')) {
|
|
17
|
+
const val = arg.split('=')[1].toLowerCase();
|
|
18
|
+
analyze = !(val === 'false' || val === '0');
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
const input = { index: paths.appIndexJs }
|
|
9
24
|
if( fs.existsSync(paths.appFrontJs) ) {
|
|
10
25
|
input['front'] = paths.appFrontJs
|
|
11
26
|
}
|
|
27
|
+
|
|
28
|
+
const plugins = await getPlugins('build')
|
|
29
|
+
if (process.env.ANALYZE === 'true' || analyze) {
|
|
30
|
+
plugins.push(
|
|
31
|
+
visualizer({
|
|
32
|
+
filename: paths.appBuild + '/stats.html',
|
|
33
|
+
title: 'Build Analysis',
|
|
34
|
+
open: true,
|
|
35
|
+
})
|
|
36
|
+
)
|
|
37
|
+
}
|
|
12
38
|
|
|
13
39
|
await build({
|
|
14
40
|
configFile: false,
|
|
@@ -29,6 +55,6 @@ import plugins from '../vite-plugin/index.js';
|
|
|
29
55
|
}
|
|
30
56
|
}
|
|
31
57
|
},
|
|
32
|
-
plugins
|
|
58
|
+
plugins
|
|
33
59
|
})
|
|
34
60
|
})()
|