swico 0.8.1-beta16 → 0.8.1-beta18
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
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,21 @@ 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
|
+
if (stats.hasErrors()) {
|
|
174
|
+
tools_1.toast.error(info.errors.map(function (item) { return item.stack; }));
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (stats.hasWarnings()) {
|
|
178
|
+
tools_1.toast.warning(info.warnings.map(function (item) { return item.stack; }));
|
|
179
|
+
}
|
|
180
|
+
tools_1.toast.info("Compiled successfully in ".concat(info.time));
|
|
181
|
+
});
|
|
167
182
|
_b.label = 7;
|
|
168
183
|
case 7:
|
|
169
184
|
_b.trys.push([7, 9, , 10]);
|
|
@@ -65,8 +65,6 @@ var config_1 = require("../utils/config");
|
|
|
65
65
|
var html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
66
66
|
var fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
67
67
|
var webpack_1 = __importDefault(require("webpack"));
|
|
68
|
-
var webpackbar_1 = __importDefault(require("webpackbar"));
|
|
69
|
-
var tools_1 = require("../utils/tools");
|
|
70
68
|
function default_1(_a) {
|
|
71
69
|
var _b, _c, _d;
|
|
72
70
|
var projectPath = _a.projectPath, entryPath = _a.entryPath, env = _a.env, customConfig = _a.customConfig;
|
|
@@ -272,11 +270,6 @@ function default_1(_a) {
|
|
|
272
270
|
new mini_css_extract_plugin_1.default({
|
|
273
271
|
filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
274
272
|
ignoreOrder: true
|
|
275
|
-
}),
|
|
276
|
-
new webpackbar_1.default({
|
|
277
|
-
name: 'Swico',
|
|
278
|
-
color: tools_1.themeColor,
|
|
279
|
-
profile: false
|
|
280
273
|
})
|
|
281
274
|
], false), ((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins), true)
|
|
282
275
|
}];
|
|
@@ -66,8 +66,6 @@ var html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
|
66
66
|
var fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
67
67
|
var webpack_1 = __importDefault(require("webpack"));
|
|
68
68
|
var vue_loader_1 = require("vue-loader");
|
|
69
|
-
var webpackbar_1 = __importDefault(require("webpackbar"));
|
|
70
|
-
var tools_1 = require("../utils/tools");
|
|
71
69
|
function default_1(_a) {
|
|
72
70
|
var _b, _c, _d;
|
|
73
71
|
var projectPath = _a.projectPath, entryPath = _a.entryPath, env = _a.env, customConfig = _a.customConfig;
|
|
@@ -289,11 +287,6 @@ function default_1(_a) {
|
|
|
289
287
|
new mini_css_extract_plugin_1.default({
|
|
290
288
|
filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
291
289
|
ignoreOrder: true
|
|
292
|
-
}),
|
|
293
|
-
new webpackbar_1.default({
|
|
294
|
-
name: 'Swico',
|
|
295
|
-
color: tools_1.themeColor,
|
|
296
|
-
profile: false
|
|
297
290
|
})
|
|
298
291
|
], false), ((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins), true)
|
|
299
292
|
}];
|
|
@@ -89,6 +89,8 @@ var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
89
89
|
var config_1 = require("../utils/config");
|
|
90
90
|
var webpack_merge_1 = require("webpack-merge");
|
|
91
91
|
var esbuild_loader_1 = require("esbuild-loader");
|
|
92
|
+
var webpackbar_1 = __importDefault(require("webpackbar"));
|
|
93
|
+
var tools_1 = require("../utils/tools");
|
|
92
94
|
var BundleAnalyzerPlugin = webpack_bundle_analyzer_1.default.BundleAnalyzerPlugin;
|
|
93
95
|
var isAnalyze = process.env.ANALYZE === 'true';
|
|
94
96
|
function default_1(options) {
|
|
@@ -155,7 +157,7 @@ function default_1(options) {
|
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
},
|
|
158
|
-
plugins: __spreadArray(__spreadArray(__spreadArray([], (isPublicDirExist || copyConfig.length > 0
|
|
160
|
+
plugins: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], (isPublicDirExist || copyConfig.length > 0
|
|
159
161
|
? [
|
|
160
162
|
new copy_webpack_plugin_1.default({
|
|
161
163
|
patterns: __spreadArray(__spreadArray([], (isPublicDirExist ? [path_1.default.join(projectPath, '/public')] : []), true), copyConfig, true)
|
|
@@ -176,7 +178,13 @@ function default_1(options) {
|
|
|
176
178
|
logLevel: 'info'
|
|
177
179
|
})
|
|
178
180
|
]
|
|
179
|
-
: []), true),
|
|
181
|
+
: []), true), [
|
|
182
|
+
new webpackbar_1.default({
|
|
183
|
+
name: 'Swico',
|
|
184
|
+
color: tools_1.themeColor,
|
|
185
|
+
profile: false
|
|
186
|
+
})
|
|
187
|
+
], false), ((_g = (_f = customConfig.prod) === null || _f === void 0 ? void 0 : _f.plugins) !== null && _g !== void 0 ? _g : []), true)
|
|
180
188
|
})];
|
|
181
189
|
}
|
|
182
190
|
});
|
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)) {
|