swico 1.3.0-beta.1 → 1.3.0-beta.10
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/README.md +21 -0
- package/package.json +1 -1
- package/src/command/start.js +53 -19
- package/src/utils/config.d.ts +4 -0
- package/src/utils/config.js +68 -36
- package/src/utils/tools.js +3 -9
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# SWICO介绍
|
|
2
|
+
|
|
3
|
+
Swico,发音近似于“斯威扣”。
|
|
4
|
+
|
|
5
|
+
为个人独立开发的一款实用的前端框架,它基于前端工程化最新技术栈实现了前端开发从创建项目,获取模板,本地开发,Git提交校验到打包构建的完整过程。
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 主要特性
|
|
9
|
+
|
|
10
|
+
- 构建工具基于Webpack5,并配合esbuild-loader和swc-loader提升编译构建速率。
|
|
11
|
+
|
|
12
|
+
- 提供Vue3和React18两种开发模板选择,默认集成TypeScript5。同时最大化统一这两种模板的开发API。
|
|
13
|
+
|
|
14
|
+
- 提供可配置化路由方案,基于React-Router6和Vue-Router4进行二次封装,支持路由嵌套,懒加载,动态参数,装饰校验等功能。
|
|
15
|
+
|
|
16
|
+
- 内置ESLint + Prettier + Husky三大前端编码风格以及代码提交规范约束插件,保证代码风格统一以及 Git 提交规范。
|
|
17
|
+
|
|
18
|
+
- 提供配置文件可对部分项目配置进行修改扩展,例如Alias映射,本地请求代理等。
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
官方文档:[SWICO 官方文档](https://scw1997.github.io/swico-docs)
|
package/package.json
CHANGED
package/src/command/start.js
CHANGED
|
@@ -61,8 +61,10 @@ var path_1 = __importDefault(require("path"));
|
|
|
61
61
|
var _a = process.env, SWICO_PORT = _a.SWICO_PORT, SWICO_RESTART = _a.SWICO_RESTART, SWICO_ROUTER_BASE = _a.SWICO_ROUTER_BASE;
|
|
62
62
|
var package_json_1 = __importDefault(require("../../package.json"));
|
|
63
63
|
var chalk_1 = __importDefault(require("chalk"));
|
|
64
|
+
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
64
65
|
var currentPort, currentRouterBase = '/';
|
|
65
|
-
var handleWatch = function (projectPath, devServer) {
|
|
66
|
+
var handleWatch = function (projectPath, devServer, env) {
|
|
67
|
+
var envPath = env === 'dev' ? '/.dev/' : '/.prod/';
|
|
66
68
|
var configFilesWatcher = chokidar_1.default
|
|
67
69
|
.watch([path_1.default.join(projectPath, '/config/*.ts'), path_1.default.join(projectPath, '/.eslintrc')], {
|
|
68
70
|
interval: 500,
|
|
@@ -88,33 +90,60 @@ var handleWatch = function (projectPath, devServer) {
|
|
|
88
90
|
}
|
|
89
91
|
});
|
|
90
92
|
}); });
|
|
91
|
-
var
|
|
92
|
-
path_1.default.join(projectPath, '/src/loading/index.tsx'),
|
|
93
|
+
var globalStyleFilesPathList = [
|
|
93
94
|
path_1.default.join(projectPath, '/src/global.css'),
|
|
94
95
|
path_1.default.join(projectPath, '/src/global.less'),
|
|
95
96
|
path_1.default.join(projectPath, '/src/global.scss')
|
|
96
97
|
];
|
|
98
|
+
var loadingFilePath = path_1.default.join(projectPath, '/src/loading/index.tsx');
|
|
97
99
|
var tsTypingsWatcher = chokidar_1.default
|
|
98
100
|
.watch([path_1.default.join(projectPath, '/src/**/*')], {
|
|
99
101
|
interval: 500,
|
|
100
102
|
binaryInterval: 500,
|
|
101
103
|
ignoreInitial: true
|
|
102
104
|
})
|
|
103
|
-
.on('all', function (eventName,
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
.on('all', function (eventName, filePath, stats) { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
+
var replaceIndexText, _a;
|
|
107
|
+
return __generator(this, function (_b) {
|
|
108
|
+
switch (_b.label) {
|
|
106
109
|
case 0:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return [4, devServer.stop()];
|
|
110
|
+
console.log('eventName', eventName, filePath);
|
|
111
|
+
return [4, fs_extra_1.default.readFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), 'utf8')];
|
|
110
112
|
case 1:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
replaceIndexText = _b.sent();
|
|
114
|
+
if (!['add', 'unlink'].includes(eventName)) return [3, 9];
|
|
115
|
+
_a = true;
|
|
116
|
+
switch (_a) {
|
|
117
|
+
case filePath.endsWith('.d.ts'): return [3, 2];
|
|
118
|
+
case globalStyleFilesPathList.includes(filePath): return [3, 5];
|
|
119
|
+
case filePath === loadingFilePath: return [3, 7];
|
|
120
|
+
}
|
|
121
|
+
return [3, 9];
|
|
113
122
|
case 2:
|
|
114
|
-
|
|
123
|
+
console.log('1');
|
|
124
|
+
return [4, devServer.stop()];
|
|
125
|
+
case 3:
|
|
126
|
+
_b.sent();
|
|
127
|
+
return [4, tsTypingsWatcher.close()];
|
|
128
|
+
case 4:
|
|
129
|
+
_b.sent();
|
|
115
130
|
restartServer();
|
|
116
|
-
|
|
117
|
-
case
|
|
131
|
+
return [3, 9];
|
|
132
|
+
case 5:
|
|
133
|
+
console.log('2');
|
|
134
|
+
replaceIndexText = (0, config_1.handleGlobalStyleFile)(replaceIndexText);
|
|
135
|
+
return [4, (0, config_1.updateIndexFileText)(envPath, replaceIndexText)];
|
|
136
|
+
case 6:
|
|
137
|
+
_b.sent();
|
|
138
|
+
return [3, 9];
|
|
139
|
+
case 7:
|
|
140
|
+
console.log('3');
|
|
141
|
+
replaceIndexText = (0, config_1.handleLoadingFile)(replaceIndexText, envPath);
|
|
142
|
+
return [4, (0, config_1.updateIndexFileText)(envPath, replaceIndexText)];
|
|
143
|
+
case 8:
|
|
144
|
+
_b.sent();
|
|
145
|
+
_b.label = 9;
|
|
146
|
+
case 9: return [2];
|
|
118
147
|
}
|
|
119
148
|
});
|
|
120
149
|
}); });
|
|
@@ -141,6 +170,11 @@ var getMockGetLogger = function (compiler) {
|
|
|
141
170
|
return __assign(__assign({}, logger), { log: log, debug: debug, error: error, warn: warn, info: function () { } });
|
|
142
171
|
};
|
|
143
172
|
};
|
|
173
|
+
var filterStyleFileList = [
|
|
174
|
+
"Can't resolve '../../global.less'",
|
|
175
|
+
"Can't resolve '../../global.css'",
|
|
176
|
+
"Can't resolve '../../global.scss'"
|
|
177
|
+
];
|
|
144
178
|
var createCompileListener = function (compiler) {
|
|
145
179
|
compiler.hooks.beforeCompile.tap('beforeCompile', function () {
|
|
146
180
|
tools_1.toast.info('Compiling...');
|
|
@@ -148,7 +182,7 @@ var createCompileListener = function (compiler) {
|
|
|
148
182
|
compiler.hooks.done.tap('done', function (stats) {
|
|
149
183
|
var info = stats === null || stats === void 0 ? void 0 : stats.toJson();
|
|
150
184
|
if (stats === null || stats === void 0 ? void 0 : stats.hasErrors()) {
|
|
151
|
-
tools_1.toast.error(info === null || info === void 0 ? void 0 : info.errors.map(function (item) { return item.message || item.stack; }));
|
|
185
|
+
tools_1.toast.error(info === null || info === void 0 ? void 0 : info.errors.map(function (item) { return item.message || item.stack; }).filter(function (item1) { return !filterStyleFileList.find(function (item2) { return item1.includes(item2); }); }));
|
|
152
186
|
return;
|
|
153
187
|
}
|
|
154
188
|
if (stats === null || stats === void 0 ? void 0 : stats.hasWarnings()) {
|
|
@@ -162,13 +196,13 @@ var createCompileListener = function (compiler) {
|
|
|
162
196
|
});
|
|
163
197
|
return;
|
|
164
198
|
}
|
|
165
|
-
tools_1.toast.info("Compiled
|
|
199
|
+
tools_1.toast.info("Compiled successfully in ".concat(info === null || info === void 0 ? void 0 : info.time, "ms"));
|
|
166
200
|
});
|
|
167
201
|
};
|
|
168
202
|
function start() {
|
|
169
203
|
var _a, _b, _c, _d, _e, _f;
|
|
170
204
|
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
var availablePort, _g, projectConfig, projectPath, customConfig, newRouterBase, startConfig, compiler, oriLogger, devServer, e_1, strErr;
|
|
205
|
+
var availablePort, _g, projectConfig, projectPath, customConfig, env, newRouterBase, startConfig, compiler, oriLogger, devServer, e_1, strErr;
|
|
172
206
|
return __generator(this, function (_h) {
|
|
173
207
|
switch (_h.label) {
|
|
174
208
|
case 0:
|
|
@@ -192,7 +226,7 @@ function start() {
|
|
|
192
226
|
return [4, (0, config_1.getProjectConfig)('dev')];
|
|
193
227
|
case 5:
|
|
194
228
|
projectConfig = _h.sent();
|
|
195
|
-
projectPath = projectConfig.projectPath, customConfig = projectConfig.customConfig;
|
|
229
|
+
projectPath = projectConfig.projectPath, customConfig = projectConfig.customConfig, env = projectConfig.env;
|
|
196
230
|
newRouterBase = (_f = (_c = (_b = (_a = customConfig['dev']) === null || _a === void 0 ? void 0 : _a.router) === null || _b === void 0 ? void 0 : _b.base) !== null && _c !== void 0 ? _c : (_e = (_d = customConfig['base']) === null || _d === void 0 ? void 0 : _d.router) === null || _e === void 0 ? void 0 : _e.base) !== null && _f !== void 0 ? _f : '/';
|
|
197
231
|
return [4, (0, webpack_dev_1.default)(projectConfig)];
|
|
198
232
|
case 6:
|
|
@@ -210,7 +244,7 @@ function start() {
|
|
|
210
244
|
process.env.SWICO_PORT = availablePort.toString();
|
|
211
245
|
createCompileListener(compiler);
|
|
212
246
|
compiler.getInfrastructureLogger = oriLogger;
|
|
213
|
-
handleWatch(projectPath, devServer);
|
|
247
|
+
handleWatch(projectPath, devServer, env);
|
|
214
248
|
if (SWICO_RESTART !== 'true' ||
|
|
215
249
|
(SWICO_RESTART === 'true' && newRouterBase !== SWICO_ROUTER_BASE)) {
|
|
216
250
|
tools_1.toast.info("Project is running at\uFF1A".concat(chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort).concat(newRouterBase))));
|
package/src/utils/config.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type ConfigRoutesItemType = {
|
|
|
5
5
|
redirect?: string;
|
|
6
6
|
name?: string;
|
|
7
7
|
decorator?: string;
|
|
8
|
+
custom?: any;
|
|
8
9
|
[key: string]: any;
|
|
9
10
|
};
|
|
10
11
|
export type ConfigRouterType = {
|
|
@@ -43,5 +44,8 @@ export interface GlobalData {
|
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
export declare const getProjectConfig: (env: GlobalData['env']) => Promise<GlobalData>;
|
|
47
|
+
export declare const handleLoadingFile: (replaceIndexText: any, envPath: any) => Promise<any>;
|
|
48
|
+
export declare const handleGlobalStyleFile: (replaceIndexText: any) => any;
|
|
49
|
+
export declare const updateIndexFileText: (envPath: any, newFileText: any) => Promise<void>;
|
|
46
50
|
export declare const getFormatDefineVars: (defineVarsConfigData: any) => Promise<{}>;
|
|
47
51
|
export declare const initConfig: Omit<GlobalSwicoConfigType, 'template'>;
|
package/src/utils/config.js
CHANGED
|
@@ -73,7 +73,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
73
73
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
74
74
|
};
|
|
75
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
-
exports.initConfig = exports.getFormatDefineVars = exports.getProjectConfig = void 0;
|
|
76
|
+
exports.initConfig = exports.getFormatDefineVars = exports.updateIndexFileText = exports.handleGlobalStyleFile = exports.handleLoadingFile = exports.getProjectConfig = void 0;
|
|
77
77
|
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
78
78
|
var path_1 = __importDefault(require("path"));
|
|
79
79
|
var chalk_1 = __importDefault(require("chalk"));
|
|
@@ -185,6 +185,7 @@ var getProjectConfig = function (env) { return __awaiter(void 0, void 0, void 0,
|
|
|
185
185
|
entryPath = path_1.default.resolve(projectPath, "./src/.swico/".concat(envPath, "index.js"));
|
|
186
186
|
templatePath = path_1.default.join(projectPath, '/src/index.ejs');
|
|
187
187
|
return [2, {
|
|
188
|
+
env: env,
|
|
188
189
|
projectPath: projectPath,
|
|
189
190
|
entryPath: entryPath,
|
|
190
191
|
templatePath: templatePath,
|
|
@@ -286,12 +287,59 @@ var getGlobalStyleFilePath = function () {
|
|
|
286
287
|
}
|
|
287
288
|
return { filePath: filePath, fileType: fileType };
|
|
288
289
|
};
|
|
290
|
+
var handleLoadingFile = function (replaceIndexText, envPath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
291
|
+
var newReplaceIndexText, e_1;
|
|
292
|
+
return __generator(this, function (_a) {
|
|
293
|
+
switch (_a.label) {
|
|
294
|
+
case 0:
|
|
295
|
+
newReplaceIndexText = replaceIndexText;
|
|
296
|
+
_a.label = 1;
|
|
297
|
+
case 1:
|
|
298
|
+
_a.trys.push([1, 3, , 4]);
|
|
299
|
+
return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/loading/index.tsx'), fs_extra_1.default.constants.F_OK)];
|
|
300
|
+
case 2:
|
|
301
|
+
_a.sent();
|
|
302
|
+
newReplaceIndexText = newReplaceIndexText.replace('"../loading"', '"../../loading"');
|
|
303
|
+
return [3, 4];
|
|
304
|
+
case 3:
|
|
305
|
+
e_1 = _a.sent();
|
|
306
|
+
newReplaceIndexText = newReplaceIndexText.replace('"../../loading"', '"../loading"');
|
|
307
|
+
return [3, 4];
|
|
308
|
+
case 4: return [2, newReplaceIndexText];
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}); };
|
|
312
|
+
exports.handleLoadingFile = handleLoadingFile;
|
|
313
|
+
var handleGlobalStyleFile = function (replaceIndexText) {
|
|
314
|
+
var _a = getGlobalStyleFilePath(), styleFilePath = _a.filePath, styleFileType = _a.fileType;
|
|
315
|
+
var newReplaceIndexText = replaceIndexText;
|
|
316
|
+
if (styleFilePath) {
|
|
317
|
+
newReplaceIndexText = newReplaceIndexText.replaceAll("require(\"../../global.".concat(styleFileType, "\");"), '');
|
|
318
|
+
newReplaceIndexText = "require(\"../../global.".concat(styleFileType, "\");\n").concat(replaceIndexText);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
newReplaceIndexText = newReplaceIndexText.replaceAll(/require\("\.\.\/\.\.\/global.(less|scss|css)"\);/g, '');
|
|
322
|
+
}
|
|
323
|
+
return newReplaceIndexText;
|
|
324
|
+
};
|
|
325
|
+
exports.handleGlobalStyleFile = handleGlobalStyleFile;
|
|
326
|
+
var updateIndexFileText = function (envPath, newFileText) { return __awaiter(void 0, void 0, void 0, function () {
|
|
327
|
+
return __generator(this, function (_a) {
|
|
328
|
+
switch (_a.label) {
|
|
329
|
+
case 0: return [4, fs_extra_1.default.writeFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), newFileText)];
|
|
330
|
+
case 1:
|
|
331
|
+
_a.sent();
|
|
332
|
+
return [2];
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}); };
|
|
336
|
+
exports.updateIndexFileText = updateIndexFileText;
|
|
289
337
|
var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
290
338
|
var envPath = env === 'dev' ? '/.dev/' : '/.prod/';
|
|
291
339
|
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
292
|
-
var copyTargetPath, replaceIndexText, hooksFilePath, replaceHooksText,
|
|
293
|
-
return __generator(this, function (
|
|
294
|
-
switch (
|
|
340
|
+
var copyTargetPath, replaceIndexText, hooksFilePath, replaceHooksText, newReplaceIndexText;
|
|
341
|
+
return __generator(this, function (_a) {
|
|
342
|
+
switch (_a.label) {
|
|
295
343
|
case 0:
|
|
296
344
|
copyTargetPath = path_1.default.resolve(projectPath, "./src/.swico".concat(envPath));
|
|
297
345
|
return [4, (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, "../template/".concat(templateType, "/$env")), copyTargetPath, function (fileName) {
|
|
@@ -301,59 +349,43 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
|
|
|
301
349
|
: !['react-hooks.js'].includes(fileName));
|
|
302
350
|
})];
|
|
303
351
|
case 1:
|
|
304
|
-
|
|
352
|
+
_a.sent();
|
|
305
353
|
return [4, (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, "../template/".concat(templateType)), path_1.default.resolve(projectPath, './src/.swico'), function (fileName) {
|
|
306
354
|
return ['react-hooks.js', 'vue-hooks.js', 'loading.js', 'Container.vue'].includes(fileName);
|
|
307
355
|
})];
|
|
308
356
|
case 2:
|
|
309
|
-
|
|
357
|
+
_a.sent();
|
|
310
358
|
return [4, formatRouterConfig(routerConfig, templateType, env)];
|
|
311
359
|
case 3:
|
|
312
|
-
|
|
360
|
+
_a.sent();
|
|
313
361
|
return [4, fs_extra_1.default.readFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), 'utf8')];
|
|
314
362
|
case 4:
|
|
315
|
-
replaceIndexText =
|
|
363
|
+
replaceIndexText = _a.sent();
|
|
316
364
|
hooksFilePath = path_1.default.resolve(projectPath, "./src/.swico/".concat(templateType, "-hooks.js"));
|
|
317
365
|
return [4, fs_extra_1.default.readFile(hooksFilePath, 'utf8')];
|
|
318
366
|
case 5:
|
|
319
|
-
replaceHooksText =
|
|
367
|
+
replaceHooksText = _a.sent();
|
|
320
368
|
replaceHooksText = replaceHooksText.replaceAll('$env', ".".concat(env));
|
|
321
369
|
return [4, fs_extra_1.default.writeFile(hooksFilePath, replaceHooksText)];
|
|
322
370
|
case 6:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (styleFilePath) {
|
|
326
|
-
replaceIndexText = replaceIndexText.replaceAll("require(\"../../global.".concat(styleFileType, "\");"), '');
|
|
327
|
-
replaceIndexText = "require(\"../../global.".concat(styleFileType, "\");\n").concat(replaceIndexText);
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
replaceIndexText = replaceIndexText.replaceAll(/require\("\.\.\/\.\.\/global.(less|scss|css)"\);/g, '');
|
|
331
|
-
}
|
|
371
|
+
_a.sent();
|
|
372
|
+
replaceIndexText = (0, exports.handleGlobalStyleFile)(replaceIndexText);
|
|
332
373
|
if (!(templateType === 'vue')) return [3, 8];
|
|
333
374
|
replaceIndexText = replaceIndexText.replace('"../Container"', '"../Container.vue"');
|
|
334
|
-
return [4,
|
|
375
|
+
return [4, (0, exports.updateIndexFileText)(envPath, replaceIndexText)];
|
|
335
376
|
case 7:
|
|
336
|
-
|
|
337
|
-
return [3,
|
|
377
|
+
_a.sent();
|
|
378
|
+
return [3, 11];
|
|
338
379
|
case 8:
|
|
339
|
-
if (!(templateType === 'react')) return [3,
|
|
340
|
-
|
|
380
|
+
if (!(templateType === 'react')) return [3, 11];
|
|
381
|
+
return [4, (0, exports.handleLoadingFile)(replaceIndexText, envPath)];
|
|
341
382
|
case 9:
|
|
342
|
-
|
|
343
|
-
return [4,
|
|
383
|
+
newReplaceIndexText = _a.sent();
|
|
384
|
+
return [4, (0, exports.updateIndexFileText)(envPath, newReplaceIndexText)];
|
|
344
385
|
case 10:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return [3, 14];
|
|
386
|
+
_a.sent();
|
|
387
|
+
_a.label = 11;
|
|
348
388
|
case 11:
|
|
349
|
-
e_1 = _b.sent();
|
|
350
|
-
replaceIndexText = replaceIndexText.replace('"../../loading"', '"../loading"');
|
|
351
|
-
return [3, 14];
|
|
352
|
-
case 12: return [4, fs_extra_1.default.writeFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), replaceIndexText)];
|
|
353
|
-
case 13:
|
|
354
|
-
_b.sent();
|
|
355
|
-
return [7];
|
|
356
|
-
case 14:
|
|
357
389
|
resolve(null);
|
|
358
390
|
return [2];
|
|
359
391
|
}
|
package/src/utils/tools.js
CHANGED
|
@@ -170,7 +170,7 @@ var copyDirFiles = function (src, dest, filter) { return __awaiter(void 0, void
|
|
|
170
170
|
exports.copyDirFiles = copyDirFiles;
|
|
171
171
|
var getFormatRouter = function (projectPath, routes, templateType) {
|
|
172
172
|
var _main = function (item) {
|
|
173
|
-
var
|
|
173
|
+
var component = item.component, name = item.name, children = item.children, redirect = item.redirect, decorator = item.decorator;
|
|
174
174
|
return decorator
|
|
175
175
|
? __assign(__assign({}, item), { component: "()=>import('".concat(projectPath, "/src/pages/").concat(decorator).concat(templateType === 'vue' ? '.vue' : '', "')"), children: [
|
|
176
176
|
{
|
|
@@ -182,15 +182,9 @@ var getFormatRouter = function (projectPath, routes, templateType) {
|
|
|
182
182
|
redirect: redirect,
|
|
183
183
|
children: children ? children === null || children === void 0 ? void 0 : children.map(function (item) { return _main(item); }) : undefined
|
|
184
184
|
}
|
|
185
|
-
] }) : {
|
|
186
|
-
path: path,
|
|
187
|
-
component: component
|
|
185
|
+
] }) : __assign(__assign({}, item), { component: component
|
|
188
186
|
? "()=>import('".concat(projectPath, "/src/pages/").concat(component).concat(templateType === 'vue' ? '.vue' : '', "')")
|
|
189
|
-
: undefined,
|
|
190
|
-
name: name,
|
|
191
|
-
redirect: redirect,
|
|
192
|
-
children: children ? children === null || children === void 0 ? void 0 : children.map(function (item) { return _main(item); }) : undefined
|
|
193
|
-
};
|
|
187
|
+
: undefined, name: name, redirect: redirect, children: children ? children === null || children === void 0 ? void 0 : children.map(function (item) { return _main(item); }) : undefined });
|
|
194
188
|
};
|
|
195
189
|
return routes.map(function (item) {
|
|
196
190
|
return _main(item);
|