swico 0.8.1-beta12 → 0.8.1-beta14
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
|
@@ -10,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
13
36
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
37
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
38
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -60,6 +83,8 @@ var path_1 = __importDefault(require("path"));
|
|
|
60
83
|
var cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
61
84
|
var _a = process.env, envPort = _a.PORT, RESTART = _a.RESTART;
|
|
62
85
|
var package_json_1 = __importDefault(require("../../package.json"));
|
|
86
|
+
var process = __importStar(require("node:process"));
|
|
87
|
+
var chalk_1 = __importDefault(require("chalk"));
|
|
63
88
|
var handleWatch = function (projectPath, devServer) {
|
|
64
89
|
var configFilesWatcher = chokidar_1.default
|
|
65
90
|
.watch([
|
|
@@ -163,6 +188,9 @@ function start() {
|
|
|
163
188
|
oriLogger = compiler.getInfrastructureLogger;
|
|
164
189
|
compiler.getInfrastructureLogger = getMockGetLogger(compiler);
|
|
165
190
|
devServer = new webpack_dev_server_1.default(__assign(__assign({}, startConfig.devServer), { port: availablePort }), compiler);
|
|
191
|
+
devServer.stopCallback(function () {
|
|
192
|
+
process.exit(1);
|
|
193
|
+
});
|
|
166
194
|
_b.label = 7;
|
|
167
195
|
case 7:
|
|
168
196
|
_b.trys.push([7, 9, , 10]);
|
|
@@ -171,7 +199,7 @@ function start() {
|
|
|
171
199
|
_b.sent();
|
|
172
200
|
compiler.getInfrastructureLogger = oriLogger;
|
|
173
201
|
handleWatch(projectPath, devServer);
|
|
174
|
-
tools_1.toast.info("Project is running at\uFF1A".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, "/"))));
|
|
175
203
|
return [3, 10];
|
|
176
204
|
case 9:
|
|
177
205
|
e_1 = _b.sent();
|
|
@@ -66,6 +66,7 @@ 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 webpackbar_1 = __importDefault(require("webpackbar"));
|
|
69
|
+
var tools_1 = require("../utils/tools");
|
|
69
70
|
function default_1(_a) {
|
|
70
71
|
var _b, _c, _d;
|
|
71
72
|
var projectPath = _a.projectPath, entryPath = _a.entryPath, env = _a.env, customConfig = _a.customConfig;
|
|
@@ -274,7 +275,7 @@ function default_1(_a) {
|
|
|
274
275
|
}),
|
|
275
276
|
new webpackbar_1.default({
|
|
276
277
|
name: 'Swico',
|
|
277
|
-
color:
|
|
278
|
+
color: tools_1.themeColor,
|
|
278
279
|
profile: false
|
|
279
280
|
})
|
|
280
281
|
], false), ((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins), true)
|
|
@@ -63,10 +63,10 @@ var path_1 = __importDefault(require("path"));
|
|
|
63
63
|
var mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
64
64
|
var config_1 = require("../utils/config");
|
|
65
65
|
var html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
66
|
-
var fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
67
66
|
var webpack_1 = __importDefault(require("webpack"));
|
|
68
67
|
var vue_loader_1 = require("vue-loader");
|
|
69
68
|
var webpackbar_1 = __importDefault(require("webpackbar"));
|
|
69
|
+
var tools_1 = require("../utils/tools");
|
|
70
70
|
function default_1(_a) {
|
|
71
71
|
var _b, _c, _d;
|
|
72
72
|
var projectPath = _a.projectPath, entryPath = _a.entryPath, env = _a.env, customConfig = _a.customConfig;
|
|
@@ -277,21 +277,13 @@ function default_1(_a) {
|
|
|
277
277
|
},
|
|
278
278
|
hash: true
|
|
279
279
|
}),
|
|
280
|
-
new fork_ts_checker_webpack_plugin_1.default({
|
|
281
|
-
typescript: {
|
|
282
|
-
diagnosticOptions: {
|
|
283
|
-
semantic: true,
|
|
284
|
-
syntactic: true
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}),
|
|
288
280
|
new mini_css_extract_plugin_1.default({
|
|
289
281
|
filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
290
282
|
ignoreOrder: true
|
|
291
283
|
}),
|
|
292
284
|
new webpackbar_1.default({
|
|
293
285
|
name: 'Swico',
|
|
294
|
-
color:
|
|
286
|
+
color: tools_1.themeColor,
|
|
295
287
|
profile: false
|
|
296
288
|
})
|
|
297
289
|
], false), ((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins), true)
|
package/src/utils/tools.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ 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 themeColor = "#7888FCFF";
|
|
5
6
|
export declare const toast: {
|
|
6
7
|
info: (message: string) => void;
|
|
7
8
|
error: (message: string | string[]) => void;
|
package/src/utils/tools.js
CHANGED
|
@@ -80,12 +80,14 @@ 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.getPort = exports.getFormatRouter = exports.copyDirFiles = void 0;
|
|
83
|
+
exports.initIndexFile = exports.toast = exports.themeColor = 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"));
|
|
87
87
|
var chalk_1 = __importDefault(require("chalk"));
|
|
88
88
|
var process = __importStar(require("process"));
|
|
89
|
+
var ora_1 = __importDefault(require("ora"));
|
|
90
|
+
var spinner = (0, ora_1.default)();
|
|
89
91
|
var copyDirFiles = function (src, dest, filter) { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
92
|
var _copy, e_1;
|
|
91
93
|
return __generator(this, function (_a) {
|
|
@@ -204,12 +206,13 @@ var getPort = function () {
|
|
|
204
206
|
});
|
|
205
207
|
};
|
|
206
208
|
exports.getPort = getPort;
|
|
209
|
+
exports.themeColor = '#7888FCFF';
|
|
207
210
|
exports.toast = {
|
|
208
211
|
info: function (message) {
|
|
209
|
-
console.log("> ".concat(chalk_1.default.hex(
|
|
212
|
+
console.log("> ".concat(chalk_1.default.hex(exports.themeColor)(message), "\n"));
|
|
210
213
|
},
|
|
211
214
|
error: function (message) {
|
|
212
|
-
console.log("\n> ".concat(chalk_1.default.hex(
|
|
215
|
+
console.log("\n> ".concat(chalk_1.default.hex(exports.themeColor)('There are some errors about Swico:'), " \n"));
|
|
213
216
|
if (Array.isArray(message)) {
|
|
214
217
|
message.forEach(function (item) {
|
|
215
218
|
console.log(" > ".concat(chalk_1.default.red.bold(item), " \n"));
|
|
@@ -220,7 +223,7 @@ exports.toast = {
|
|
|
220
223
|
}
|
|
221
224
|
},
|
|
222
225
|
warning: function (message) {
|
|
223
|
-
console.log("\n> ".concat(chalk_1.default.hex(
|
|
226
|
+
console.log("\n> ".concat(chalk_1.default.hex(exports.themeColor)('There are some warnings about Swico:'), " \n"));
|
|
224
227
|
if (Array.isArray(message)) {
|
|
225
228
|
message.forEach(function (item) {
|
|
226
229
|
console.log(" > ".concat(chalk_1.default.hex('#fb8918').bold(item), " \n"));
|