swico 0.6.0-beta23 → 0.6.0-beta24
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 +8 -9
- package/src/utils/tools.js +1 -0
package/package.json
CHANGED
package/src/command/build.js
CHANGED
|
@@ -55,7 +55,7 @@ function default_1() {
|
|
|
55
55
|
case 0:
|
|
56
56
|
process.env.SWICO_ENV = 'prod';
|
|
57
57
|
tools_1.toast.info("Swico v".concat(package_json_1.default.version));
|
|
58
|
-
|
|
58
|
+
tools_1.toast.info('Initializing Swico production config...');
|
|
59
59
|
return [4, (0, tools_1.initIndexFile)()];
|
|
60
60
|
case 1:
|
|
61
61
|
_a.sent();
|
package/src/command/start.js
CHANGED
|
@@ -132,7 +132,7 @@ function start() {
|
|
|
132
132
|
case 0:
|
|
133
133
|
process.env.SWICO_ENV = 'dev';
|
|
134
134
|
tools_1.toast.info("Swico v".concat(package_json_1.default.version));
|
|
135
|
-
|
|
135
|
+
tools_1.toast.info('Initializing Swico development config...\n');
|
|
136
136
|
return [4, (0, tools_1.initIndexFile)()];
|
|
137
137
|
case 1:
|
|
138
138
|
_b.sent();
|
package/src/utils/config.js
CHANGED
|
@@ -299,14 +299,6 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
|
299
299
|
_a.sent();
|
|
300
300
|
replaceIndexText = fs_extra_1.default.readFileSync(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), 'utf8');
|
|
301
301
|
replaceIndexText = replaceIndexText.replaceAll('require("../global");', '');
|
|
302
|
-
if (env === 'prod') {
|
|
303
|
-
if (templateType === 'react') {
|
|
304
|
-
replaceIndexText = replaceIndexText.replaceAll('require("../layout")', 'require("../../layout")');
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
replaceIndexText = replaceIndexText.replaceAll('require("../layout/Layout")', 'require("../../layout/Layout")');
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
302
|
envAncPath = env === 'dev' ? '..' : '../..';
|
|
311
303
|
_a.label = 3;
|
|
312
304
|
case 3:
|
|
@@ -336,6 +328,9 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
|
336
328
|
case 9:
|
|
337
329
|
if (!(templateType === 'vue')) return [3, 11];
|
|
338
330
|
replaceIndexText = replaceIndexText.replace('"./Container"', '"./Container.vue"');
|
|
331
|
+
if (env === 'prod') {
|
|
332
|
+
replaceIndexText = replaceIndexText.replaceAll('require("../layout/Layout")', 'require("../../layout/Layout")');
|
|
333
|
+
}
|
|
339
334
|
return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), replaceIndexText)];
|
|
340
335
|
case 10:
|
|
341
336
|
_a.sent();
|
|
@@ -354,7 +349,11 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
|
354
349
|
e_3 = _a.sent();
|
|
355
350
|
replaceIndexText = replaceIndexText.replace('"../loading"', '"./loading"');
|
|
356
351
|
return [3, 17];
|
|
357
|
-
case 15:
|
|
352
|
+
case 15:
|
|
353
|
+
if (env === 'prod') {
|
|
354
|
+
replaceIndexText = replaceIndexText.replaceAll('require("../layout")', 'require("../../layout")');
|
|
355
|
+
}
|
|
356
|
+
return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), replaceIndexText)];
|
|
358
357
|
case 16:
|
|
359
358
|
_a.sent();
|
|
360
359
|
return [7];
|
package/src/utils/tools.js
CHANGED
|
@@ -176,6 +176,7 @@ var initIndexFile = function () { return __awaiter(void 0, void 0, void 0, funct
|
|
|
176
176
|
formatHooksPath = path_1.default
|
|
177
177
|
.resolve(process.cwd(), './src/.swico/hooks')
|
|
178
178
|
.replaceAll('\\', '/');
|
|
179
|
+
console.log('replace', "require(\"".concat(formatHooksPath, "\");"));
|
|
179
180
|
fileText = fileText.replaceAll("require(\"".concat(formatHooksPath, "\");"), 'require("./template/react/hooks");');
|
|
180
181
|
return [4, (0, exports.writeFile)(targetPath, fileText)];
|
|
181
182
|
case 1:
|