swico 2.4.0-beta.1 → 2.4.0-beta.2
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/utils/config.js +19 -1
package/package.json
CHANGED
package/src/utils/config.js
CHANGED
|
@@ -143,6 +143,18 @@ const initCliIndexFile = (templateType, env) => __awaiter(void 0, void 0, void 0
|
|
|
143
143
|
.replaceAll('\\', '/');
|
|
144
144
|
replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/react-hooks");', `require("${formatHooksPath}");`);
|
|
145
145
|
}
|
|
146
|
+
if (templateType === 'react') {
|
|
147
|
+
const formatHooksPath = path_1.default
|
|
148
|
+
.resolve(projectPath, './.swico/react-hooks')
|
|
149
|
+
.replaceAll('\\', '/');
|
|
150
|
+
replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/react-hooks");', `require("${formatHooksPath}");`);
|
|
151
|
+
}
|
|
152
|
+
if (templateType === 'react') {
|
|
153
|
+
const formatLinkComponentPath = path_1.default
|
|
154
|
+
.resolve(projectPath, './.swico/Link')
|
|
155
|
+
.replaceAll('\\', '/');
|
|
156
|
+
replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/Link");', `require("${formatLinkComponentPath}");`);
|
|
157
|
+
}
|
|
146
158
|
const formatHistoryPath = path_1.default
|
|
147
159
|
.resolve(projectPath, `./.swico/.${env}/history`)
|
|
148
160
|
.replaceAll('\\', '/');
|
|
@@ -240,7 +252,13 @@ const initTemplateConfig = (routerConfig, templateType, env) => {
|
|
|
240
252
|
(templateType === 'vue'
|
|
241
253
|
? !['Container.js', 'vue-hooks.js'].includes(fileName)
|
|
242
254
|
: !['react-hooks.js'].includes(fileName)));
|
|
243
|
-
yield (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, `../project-path/.swico-${templateType}`), path_1.default.resolve(projectPath, './.swico'), (fileName) => [
|
|
255
|
+
yield (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, `../project-path/.swico-${templateType}`), path_1.default.resolve(projectPath, './.swico'), (fileName) => [
|
|
256
|
+
'react-hooks.js',
|
|
257
|
+
'vue-hooks.js',
|
|
258
|
+
'Link.js',
|
|
259
|
+
'loading.js',
|
|
260
|
+
'Container.vue'
|
|
261
|
+
].includes(fileName));
|
|
244
262
|
yield formatRouterConfig(routerConfig, templateType, env);
|
|
245
263
|
let replaceIndexText = yield fs_extra_1.default.readFile(path_1.default.resolve(projectPath, `./.swico${envPath}index.js`), 'utf8');
|
|
246
264
|
const hooksFilePath = path_1.default.resolve(projectPath, `./.swico/${templateType}-hooks.js`);
|