swico 0.8.3 → 0.8.4-beta2
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/start.js
CHANGED
|
@@ -79,7 +79,7 @@ var handleWatch = function (projectPath, devServer) {
|
|
|
79
79
|
return __generator(this, function (_a) {
|
|
80
80
|
switch (_a.label) {
|
|
81
81
|
case 0:
|
|
82
|
-
tools_1.toast.warning('Swico configuration files have been modified. The devServer is being restarted...');
|
|
82
|
+
tools_1.toast.warning('Swico configuration files have been modified. The devServer is being restarted...', { inline: true });
|
|
83
83
|
return [4, devServer.stop()];
|
|
84
84
|
case 1:
|
|
85
85
|
_a.sent();
|
|
@@ -147,7 +147,7 @@ var createCompileListener = function (compiler) {
|
|
|
147
147
|
warnings.some(function (item) {
|
|
148
148
|
var msg = item.message || item.stack;
|
|
149
149
|
if (msg.startsWith('[eslint]')) {
|
|
150
|
-
tools_1.toast.warning(msg, 'ESLint errors');
|
|
150
|
+
tools_1.toast.warning(msg, { title: 'ESLint errors' });
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
});
|
|
@@ -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,15 +2,22 @@ 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
|
-
wrap
|
|
12
|
+
wrap?: boolean;
|
|
13
|
+
inline?: boolean;
|
|
14
|
+
title?: string;
|
|
8
15
|
}
|
|
9
16
|
export declare const toast: {
|
|
10
17
|
info: (message: string, options?: ToastOptions) => void;
|
|
11
18
|
success: (message: string, options?: ToastOptions) => void;
|
|
12
|
-
error: (message: string | string[],
|
|
13
|
-
warning: (message: string | string[],
|
|
19
|
+
error: (message: string | string[], options?: ToastOptions) => void;
|
|
20
|
+
warning: (message: string | string[], options?: ToastOptions) => void;
|
|
14
21
|
};
|
|
15
22
|
export declare const initIndexFile: () => Promise<void>;
|
|
16
23
|
export {};
|
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,37 +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
215
|
var _a = (options || {}).wrap, wrap = _a === void 0 ? true : _a;
|
|
211
|
-
console.log("".concat(chalk_1.default.hex(exports.
|
|
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
|
-
error: function (message,
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
console.log("> ".concat(chalk_1.default.red.bold(item)));
|
|
222
|
-
});
|
|
222
|
+
error: function (message, options) {
|
|
223
|
+
var _a = options || {}, inline = _a.inline, title = _a.title;
|
|
224
|
+
if (inline) {
|
|
225
|
+
console.log("".concat(chalk_1.default.red.bold('error'), " - ").concat(message, "\uFF1A}"));
|
|
223
226
|
}
|
|
224
|
-
else
|
|
225
|
-
console.log("
|
|
227
|
+
else {
|
|
228
|
+
console.log("".concat(chalk_1.default.red.bold('error'), " - ").concat(inline ? message : "".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
|
+
}
|
|
226
237
|
}
|
|
227
238
|
console.log('\n');
|
|
228
239
|
},
|
|
229
|
-
warning: function (message,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
});
|
|
240
|
+
warning: function (message, options) {
|
|
241
|
+
var _a = options || {}, inline = _a.inline, title = _a.title;
|
|
242
|
+
var color = exports.colorConfig.warning;
|
|
243
|
+
if (inline) {
|
|
244
|
+
console.log("".concat(chalk_1.default.hex(color).bold('warning'), " - ").concat(message, "\uFF1A}"));
|
|
235
245
|
}
|
|
236
|
-
else
|
|
237
|
-
console.log("
|
|
246
|
+
else {
|
|
247
|
+
console.log("".concat(chalk_1.default.hex(color).bold('warning'), " - ").concat(inline ? message : "".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
|
+
}
|
|
238
256
|
}
|
|
239
257
|
console.log('\n');
|
|
240
258
|
}
|