swico 0.8.1-beta16 → 0.8.1-beta17
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 +1 -1
- package/src/command/build.js +1 -4
- package/src/command/start.js +16 -0
- package/src/utils/tools.d.ts +1 -0
- package/src/utils/tools.js +3 -0
package/package.json
CHANGED
package/src/command/build.js
CHANGED
|
@@ -42,11 +42,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
var webpack_1 = __importDefault(require("webpack"));
|
|
43
43
|
var webpack_prod_1 = __importDefault(require("../config/webpack.prod"));
|
|
44
44
|
var config_1 = require("../utils/config");
|
|
45
|
-
var chalk_1 = __importDefault(require("chalk"));
|
|
46
|
-
var ora_1 = __importDefault(require("ora"));
|
|
47
45
|
var tools_1 = require("../utils/tools");
|
|
48
46
|
var package_json_1 = __importDefault(require("../../package.json"));
|
|
49
|
-
var spinner = (0, ora_1.default)();
|
|
50
47
|
function default_1() {
|
|
51
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
52
49
|
var projectConfig, entryPath, templatePath, projectPath, customConfig, templateType, buildConfig, compiler;
|
|
@@ -86,7 +83,7 @@ function default_1() {
|
|
|
86
83
|
if (stats.hasWarnings()) {
|
|
87
84
|
tools_1.toast.warning(info.warnings.map(function (item) { return item.stack; }));
|
|
88
85
|
}
|
|
89
|
-
|
|
86
|
+
tools_1.toast.success('Building complete');
|
|
90
87
|
});
|
|
91
88
|
return [2];
|
|
92
89
|
}
|
package/src/command/start.js
CHANGED
|
@@ -164,6 +164,22 @@ function start() {
|
|
|
164
164
|
oriLogger = compiler.getInfrastructureLogger;
|
|
165
165
|
compiler.getInfrastructureLogger = getMockGetLogger(compiler);
|
|
166
166
|
devServer = new webpack_dev_server_1.default(__assign(__assign({}, startConfig.devServer), { port: availablePort }), compiler);
|
|
167
|
+
compiler.watch({}, function (err, stats) {
|
|
168
|
+
if (err) {
|
|
169
|
+
tools_1.toast.error(err.stack || err.toString());
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
var info = stats.toJson();
|
|
173
|
+
console.log('info', info.name);
|
|
174
|
+
if (stats.hasErrors()) {
|
|
175
|
+
tools_1.toast.error(info.errors.map(function (item) { return item.stack; }));
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (stats.hasWarnings()) {
|
|
179
|
+
tools_1.toast.warning(info.warnings.map(function (item) { return item.stack; }));
|
|
180
|
+
}
|
|
181
|
+
tools_1.toast.success('Building complete');
|
|
182
|
+
});
|
|
167
183
|
_b.label = 7;
|
|
168
184
|
case 7:
|
|
169
185
|
_b.trys.push([7, 9, , 10]);
|
package/src/utils/tools.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const getPort: () => Promise<number>;
|
|
|
5
5
|
export declare const themeColor = "#7888FCFF";
|
|
6
6
|
export declare const toast: {
|
|
7
7
|
info: (message: string) => void;
|
|
8
|
+
success: (message: string) => void;
|
|
8
9
|
error: (message: string | string[]) => void;
|
|
9
10
|
warning: (message: string | string[]) => void;
|
|
10
11
|
};
|
package/src/utils/tools.js
CHANGED
|
@@ -211,6 +211,9 @@ exports.toast = {
|
|
|
211
211
|
info: function (message) {
|
|
212
212
|
console.log("> ".concat(chalk_1.default.hex(exports.themeColor)(message), "\n"));
|
|
213
213
|
},
|
|
214
|
+
success: function (message) {
|
|
215
|
+
console.log("> ".concat(chalk_1.default.hex('#32f264')(message), "\n"));
|
|
216
|
+
},
|
|
214
217
|
error: function (message) {
|
|
215
218
|
console.log("\n> ".concat(chalk_1.default.hex(exports.themeColor)('There are some errors about Swico:'), " \n"));
|
|
216
219
|
if (Array.isArray(message)) {
|