@tuya-sat/micro-script 3.0.18-beta.3 → 3.0.18
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/dist/config/webpack.common.js +5 -0
- package/dist/scripts/build.js +42 -29
- package/package.json +4 -4
package/dist/scripts/build.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -7,34 +16,38 @@ const webpack_1 = __importDefault(require("webpack"));
|
|
|
7
16
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
17
|
const ora_1 = __importDefault(require("ora"));
|
|
9
18
|
const webpack_config_1 = __importDefault(require("../config/webpack.config"));
|
|
10
|
-
const
|
|
11
|
-
const
|
|
19
|
+
const template_1 = __importDefault(require("../template"));
|
|
20
|
+
const BUILD_FAIL_TIP = '糟糕:打包失败了,下面是具体信息';
|
|
21
|
+
const spinner = (0, ora_1.default)('building').start();
|
|
12
22
|
const config = (0, webpack_config_1.default)();
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield (0, template_1.default)();
|
|
25
|
+
(0, webpack_1.default)(config).run((err, stats) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
spinner.fail();
|
|
28
|
+
console.log(chalk_1.default.red(BUILD_FAIL_TIP));
|
|
29
|
+
console.log(err.stack || err);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
const { version, assets, warnings, errors } = stats.toJson();
|
|
33
|
+
if (stats.hasErrors()) {
|
|
34
|
+
spinner.fail();
|
|
35
|
+
console.log(chalk_1.default.red(BUILD_FAIL_TIP));
|
|
36
|
+
console.log(errors);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
spinner.succeed();
|
|
40
|
+
if (stats.hasWarnings()) {
|
|
41
|
+
console.log(chalk_1.default.yellow('难受:有告警信息,下面是具体信息'));
|
|
42
|
+
console.log(warnings.map((item) => item.message).join('\n'));
|
|
43
|
+
}
|
|
44
|
+
console.log(chalk_1.default.yellow(`当前打包工具:webpack@${version}`));
|
|
45
|
+
console.log(chalk_1.default.blue('资源清单:'));
|
|
46
|
+
const assetsInfo = assets.map(({ size, name }) => {
|
|
47
|
+
return ` ${name} ${chalk_1.default.white(size > 1024 ? `~${Math.floor(size / 1024)}KB` : `${size}B`)}`;
|
|
48
|
+
});
|
|
49
|
+
assetsInfo.map((item) => {
|
|
50
|
+
console.log(chalk_1.default.blue(item));
|
|
51
|
+
});
|
|
39
52
|
});
|
|
40
|
-
});
|
|
53
|
+
}))();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.0.18
|
|
3
|
+
"version": "3.0.18",
|
|
4
4
|
"bin": "./dist/bin/cli.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@babel/preset-typescript": "7.16.7",
|
|
24
24
|
"@babel/traverse": "^7.20.13",
|
|
25
25
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
|
26
|
-
"@tuya-sat/micro-dev-loader": "3.0.18
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.0.18
|
|
28
|
-
"@tuya-sat/micro-utils": "3.0.18
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.0.18",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.0.18",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.0.18",
|
|
29
29
|
"@types/kill-port": "^2.0.0",
|
|
30
30
|
"babel-loader": "8.2.4",
|
|
31
31
|
"babel-plugin-import": "1.13.3",
|