swico 0.6.0-beta6 → 0.6.0-beta7
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 +1 -1
- package/src/command/start.js +1 -1
- package/src/utils/config.js +10 -9
- package/src/utils/tools.js +2 -2
package/package.json
CHANGED
package/src/command/build.js
CHANGED
|
@@ -54,7 +54,7 @@ function default_1() {
|
|
|
54
54
|
switch (_a.label) {
|
|
55
55
|
case 0:
|
|
56
56
|
process.env.SWICO_ENV = 'prod';
|
|
57
|
-
tools_1.toast.info("Swico V".concat(package_json_1.default.version));
|
|
57
|
+
tools_1.toast.info("> Swico V".concat(package_json_1.default.version));
|
|
58
58
|
spinner.start('Initializing Swico production config...');
|
|
59
59
|
return [4, (0, config_1.getProjectConfig)('prod')];
|
|
60
60
|
case 1:
|
package/src/command/start.js
CHANGED
|
@@ -131,7 +131,7 @@ function start() {
|
|
|
131
131
|
switch (_b.label) {
|
|
132
132
|
case 0:
|
|
133
133
|
process.env.SWICO_ENV = 'dev';
|
|
134
|
-
tools_1.toast.info("Swico V".concat(package_json_1.default.version));
|
|
134
|
+
tools_1.toast.info("> Swico V".concat(package_json_1.default.version));
|
|
135
135
|
spinner.start('Initializing Swico development config...');
|
|
136
136
|
if (!(envPort !== null && envPort !== void 0)) return [3, 1];
|
|
137
137
|
_a = envPort;
|
package/src/utils/config.js
CHANGED
|
@@ -283,7 +283,7 @@ var formatRouterConfig = function (_a, templateType, env) {
|
|
|
283
283
|
var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
284
284
|
var swicoPath = env === 'dev' ? '' : '/.prod';
|
|
285
285
|
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
286
|
-
var copyTargetPath, replaceIndexText, e_1, e_2, e_3;
|
|
286
|
+
var copyTargetPath, replaceIndexText, srcPath, e_1, e_2, e_3;
|
|
287
287
|
return __generator(this, function (_a) {
|
|
288
288
|
switch (_a.label) {
|
|
289
289
|
case 0:
|
|
@@ -303,30 +303,31 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
|
303
303
|
case 4:
|
|
304
304
|
_a.sent();
|
|
305
305
|
replaceIndexText = fs_extra_1.default.readFileSync(path_1.default.resolve(projectPath, "./src/.swico".concat(swicoPath, "/index.js")), 'utf8');
|
|
306
|
+
srcPath = env === 'dev' ? '..' : '../..';
|
|
306
307
|
_a.label = 5;
|
|
307
308
|
case 5:
|
|
308
309
|
_a.trys.push([5, 7, , 8]);
|
|
309
310
|
return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/global.ts'), fs_extra_1.default.constants.F_OK)];
|
|
310
311
|
case 6:
|
|
311
312
|
_a.sent();
|
|
312
|
-
replaceIndexText = replaceIndexText.replaceAll(
|
|
313
|
-
replaceIndexText =
|
|
313
|
+
replaceIndexText = replaceIndexText.replaceAll("require(\"".concat(srcPath, "/global\");"), '');
|
|
314
|
+
replaceIndexText = "require(\"".concat(srcPath, "/global\");\n").concat(replaceIndexText);
|
|
314
315
|
return [3, 8];
|
|
315
316
|
case 7:
|
|
316
317
|
e_1 = _a.sent();
|
|
317
|
-
replaceIndexText = replaceIndexText.replaceAll(
|
|
318
|
+
replaceIndexText = replaceIndexText.replaceAll("require(\"".concat(srcPath, "/global\");"), '');
|
|
318
319
|
return [3, 8];
|
|
319
320
|
case 8:
|
|
320
321
|
_a.trys.push([8, 10, , 11]);
|
|
321
322
|
return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/global.less'), fs_extra_1.default.constants.F_OK)];
|
|
322
323
|
case 9:
|
|
323
324
|
_a.sent();
|
|
324
|
-
replaceIndexText = replaceIndexText.replaceAll(
|
|
325
|
-
replaceIndexText =
|
|
325
|
+
replaceIndexText = replaceIndexText.replaceAll("require(\"".concat(srcPath, "/global.less\");"), '');
|
|
326
|
+
replaceIndexText = "require(\"".concat(srcPath, "/global.less\");\n").concat(replaceIndexText);
|
|
326
327
|
return [3, 11];
|
|
327
328
|
case 10:
|
|
328
329
|
e_2 = _a.sent();
|
|
329
|
-
replaceIndexText = replaceIndexText.replaceAll(
|
|
330
|
+
replaceIndexText = replaceIndexText.replaceAll("require(\"".concat(srcPath, "/global.less\");"), '');
|
|
330
331
|
return [3, 11];
|
|
331
332
|
case 11:
|
|
332
333
|
if (!(templateType === 'vue')) return [3, 13];
|
|
@@ -343,11 +344,11 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
|
343
344
|
return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/loading/index.tsx'), fs_extra_1.default.constants.F_OK)];
|
|
344
345
|
case 15:
|
|
345
346
|
_a.sent();
|
|
346
|
-
replaceIndexText = replaceIndexText.replace('"./loading"',
|
|
347
|
+
replaceIndexText = replaceIndexText.replace('"./loading"', "\"".concat(srcPath, "/loading\""));
|
|
347
348
|
return [3, 19];
|
|
348
349
|
case 16:
|
|
349
350
|
e_3 = _a.sent();
|
|
350
|
-
replaceIndexText = replaceIndexText.replace('"../loading"',
|
|
351
|
+
replaceIndexText = replaceIndexText.replace('"../loading"', "\"".concat(srcPath, "/loading\""));
|
|
351
352
|
return [3, 19];
|
|
352
353
|
case 17: return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, "./src/.swico".concat(swicoPath, "/index.js")), replaceIndexText)];
|
|
353
354
|
case 18:
|
package/src/utils/tools.js
CHANGED
|
@@ -105,7 +105,7 @@ exports.toast = {
|
|
|
105
105
|
console.log("\n".concat(chalk_1.default.hex('#5f72f5')(message), "\n"));
|
|
106
106
|
},
|
|
107
107
|
error: function (message) {
|
|
108
|
-
console.log("\n".concat(chalk_1.default.hex('#5f72f5')('There are some errors about Swico:'), " \n"));
|
|
108
|
+
console.log("\n> ".concat(chalk_1.default.hex('#5f72f5')('There are some errors about Swico:'), " \n"));
|
|
109
109
|
if (Array.isArray(message)) {
|
|
110
110
|
message.forEach(function (item) {
|
|
111
111
|
console.log(" > ".concat(chalk_1.default.red.bold(item), " \n"));
|
|
@@ -116,7 +116,7 @@ exports.toast = {
|
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
118
|
warning: function (message) {
|
|
119
|
-
console.log("\n".concat(chalk_1.default.hex('#5f72f5')('There are some warnings about Swico:'), " \n"));
|
|
119
|
+
console.log("\n> ".concat(chalk_1.default.hex('#5f72f5')('There are some warnings about Swico:'), " \n"));
|
|
120
120
|
if (Array.isArray(message)) {
|
|
121
121
|
message.forEach(function (item) {
|
|
122
122
|
console.log(" > ".concat(chalk_1.default.hex('#fb8918').bold(item), " \n"));
|