swico 0.8.4-beta1 → 0.8.4-beta3
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 +2 -2
- package/src/command/start.js +4 -4
- package/src/config/webpack.prod.js +1 -1
- package/src/utils/tools.d.ts +6 -1
- package/src/utils/tools.js +35 -19
package/package.json
CHANGED
package/src/command/build.js
CHANGED
|
@@ -51,8 +51,8 @@ function default_1() {
|
|
|
51
51
|
switch (_a.label) {
|
|
52
52
|
case 0:
|
|
53
53
|
process.env.SWICO_ENV = 'prod';
|
|
54
|
-
tools_1.toast.info("v".concat(package_json_1.default.version)
|
|
55
|
-
tools_1.toast.info('Initializing production config...'
|
|
54
|
+
tools_1.toast.info("v".concat(package_json_1.default.version));
|
|
55
|
+
tools_1.toast.info('Initializing production config...');
|
|
56
56
|
return [4, (0, tools_1.initIndexFile)()];
|
|
57
57
|
case 1:
|
|
58
58
|
_a.sent();
|
package/src/command/start.js
CHANGED
|
@@ -134,7 +134,7 @@ var getMockGetLogger = function (compiler) {
|
|
|
134
134
|
};
|
|
135
135
|
var createCompileListener = function (compiler) {
|
|
136
136
|
compiler.hooks.beforeCompile.tap('beforeCompile', function () {
|
|
137
|
-
tools_1.toast.info('Compiling...'
|
|
137
|
+
tools_1.toast.info('Compiling...');
|
|
138
138
|
});
|
|
139
139
|
compiler.hooks.done.tap('done', function (stats) {
|
|
140
140
|
var info = stats === null || stats === void 0 ? void 0 : stats.toJson();
|
|
@@ -164,8 +164,8 @@ function start() {
|
|
|
164
164
|
case 0:
|
|
165
165
|
process.env.SWICO_ENV = 'dev';
|
|
166
166
|
if (RESTART !== 'true') {
|
|
167
|
-
tools_1.toast.info("v".concat(package_json_1.default.version)
|
|
168
|
-
tools_1.toast.info('Initializing development config...'
|
|
167
|
+
tools_1.toast.info("v".concat(package_json_1.default.version));
|
|
168
|
+
tools_1.toast.info('Initializing development config...');
|
|
169
169
|
}
|
|
170
170
|
return [4, (0, tools_1.initIndexFile)()];
|
|
171
171
|
case 1:
|
|
@@ -199,7 +199,7 @@ function start() {
|
|
|
199
199
|
createCompileListener(compiler);
|
|
200
200
|
compiler.getInfrastructureLogger = oriLogger;
|
|
201
201
|
handleWatch(projectPath, devServer);
|
|
202
|
-
tools_1.toast.info("Project is running at\uFF1A".concat(chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort, "/")))
|
|
202
|
+
tools_1.toast.info("Project is running at\uFF1A".concat(chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort, "/"))));
|
|
203
203
|
return [3, 10];
|
|
204
204
|
case 9:
|
|
205
205
|
e_1 = _b.sent();
|
|
@@ -181,7 +181,7 @@ function default_1(options) {
|
|
|
181
181
|
: []), true), [
|
|
182
182
|
new webpackbar_1.default({
|
|
183
183
|
name: 'Swico',
|
|
184
|
-
color: tools_1.
|
|
184
|
+
color: tools_1.colorConfig.theme,
|
|
185
185
|
profile: false
|
|
186
186
|
})
|
|
187
187
|
], false), ((_g = (_f = customConfig.prod) === null || _f === void 0 ? void 0 : _f.plugins) !== null && _g !== void 0 ? _g : []), true)
|
package/src/utils/tools.d.ts
CHANGED
|
@@ -2,7 +2,12 @@ import { ConfigRouterType } from './config';
|
|
|
2
2
|
export declare const copyDirFiles: (src: any, dest: any, filter?: (fileName: any) => boolean) => Promise<void>;
|
|
3
3
|
export declare const getFormatRouter: (projectPath: string, routes: ConfigRouterType['routes'], templateType: any) => any[];
|
|
4
4
|
export declare const getPort: () => Promise<number>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const colorConfig: {
|
|
6
|
+
theme: string;
|
|
7
|
+
warning: string;
|
|
8
|
+
success: string;
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
6
11
|
interface ToastOptions {
|
|
7
12
|
wrap?: boolean;
|
|
8
13
|
inline?: boolean;
|
package/src/utils/tools.js
CHANGED
|
@@ -80,7 +80,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
80
80
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
81
81
|
};
|
|
82
82
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
|
-
exports.initIndexFile = exports.toast = exports.
|
|
83
|
+
exports.initIndexFile = exports.toast = exports.colorConfig = exports.getPort = exports.getFormatRouter = exports.copyDirFiles = void 0;
|
|
84
84
|
var portfinder_1 = __importDefault(require("portfinder"));
|
|
85
85
|
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
86
86
|
var path_1 = __importDefault(require("path"));
|
|
@@ -204,39 +204,55 @@ var getPort = function () {
|
|
|
204
204
|
});
|
|
205
205
|
};
|
|
206
206
|
exports.getPort = getPort;
|
|
207
|
-
exports.
|
|
207
|
+
exports.colorConfig = {
|
|
208
|
+
theme: '#7888FCFF',
|
|
209
|
+
warning: '#fb8918',
|
|
210
|
+
success: '#32f264',
|
|
211
|
+
error: '#ff0000'
|
|
212
|
+
};
|
|
208
213
|
exports.toast = {
|
|
209
214
|
info: function (message, options) {
|
|
210
|
-
var _a = (options || {}).wrap, wrap = _a === void 0 ?
|
|
211
|
-
console.log("".concat(chalk_1.default.hex(exports.
|
|
215
|
+
var _a = (options || {}).wrap, wrap = _a === void 0 ? false : _a;
|
|
216
|
+
console.log("".concat(chalk_1.default.hex(exports.colorConfig.theme).bold('swico'), " - ").concat(message).concat(wrap ? '\n' : ''));
|
|
212
217
|
},
|
|
213
218
|
success: function (message, options) {
|
|
214
219
|
var _a = (options || {}).wrap, wrap = _a === void 0 ? true : _a;
|
|
215
|
-
console.log("".concat(chalk_1.default.hex(
|
|
220
|
+
console.log("".concat(chalk_1.default.hex(exports.colorConfig.success).bold('swico'), " - ").concat(message).concat(wrap ? '\n' : ''));
|
|
216
221
|
},
|
|
217
222
|
error: function (message, options) {
|
|
218
223
|
var _a = options || {}, inline = _a.inline, title = _a.title;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
message.forEach(function (item) {
|
|
222
|
-
console.log("> ".concat(chalk_1.default.red.bold(item)));
|
|
223
|
-
});
|
|
224
|
+
if (inline) {
|
|
225
|
+
console.log("".concat(chalk_1.default.red.bold('error'), " - ").concat(message));
|
|
224
226
|
}
|
|
225
|
-
else
|
|
226
|
-
console.log("
|
|
227
|
+
else {
|
|
228
|
+
console.log("".concat(chalk_1.default.red.bold('error'), " - ").concat(title || 'There are some errors about Swico', "\uFF1A"));
|
|
229
|
+
if (Array.isArray(message)) {
|
|
230
|
+
message.forEach(function (item) {
|
|
231
|
+
console.log("> ".concat(chalk_1.default.red.bold(item)));
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
else if (message) {
|
|
235
|
+
console.log("> ".concat(chalk_1.default.red.bold(message)));
|
|
236
|
+
}
|
|
227
237
|
}
|
|
228
238
|
console.log('\n');
|
|
229
239
|
},
|
|
230
240
|
warning: function (message, options) {
|
|
231
241
|
var _a = options || {}, inline = _a.inline, title = _a.title;
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
|
|
235
|
-
console.log("> ".concat(chalk_1.default.hex('#fb8918').bold(item)));
|
|
236
|
-
});
|
|
242
|
+
var color = exports.colorConfig.warning;
|
|
243
|
+
if (inline) {
|
|
244
|
+
console.log("".concat(chalk_1.default.hex(color).bold('warning'), " - ").concat(message));
|
|
237
245
|
}
|
|
238
|
-
else
|
|
239
|
-
console.log("
|
|
246
|
+
else {
|
|
247
|
+
console.log("".concat(chalk_1.default.hex(color).bold('warning'), " - ").concat(title || 'There are some warnings about Swico', "\uFF1A"));
|
|
248
|
+
if (Array.isArray(message)) {
|
|
249
|
+
message.forEach(function (item) {
|
|
250
|
+
console.log("> ".concat(chalk_1.default.hex(color).bold(item)));
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
else if (message) {
|
|
254
|
+
console.log("> ".concat(chalk_1.default.hex(color).bold(message)));
|
|
255
|
+
}
|
|
240
256
|
}
|
|
241
257
|
console.log('\n');
|
|
242
258
|
}
|