swico 0.8.4-beta1 → 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 +1 -1
- package/src/config/webpack.prod.js +1 -1
- package/src/utils/tools.d.ts +6 -1
- package/src/utils/tools.js +34 -18
package/package.json
CHANGED
|
@@ -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
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
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, "\uFF1A}"));
|
|
224
226
|
}
|
|
225
|
-
else
|
|
226
|
-
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
|
+
}
|
|
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, "\uFF1A}"));
|
|
237
245
|
}
|
|
238
|
-
else
|
|
239
|
-
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
|
+
}
|
|
240
256
|
}
|
|
241
257
|
console.log('\n');
|
|
242
258
|
}
|