swico 0.5.0-beta21 → 0.5.0-beta23
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/template/react/hooks.d.ts +1 -10
- package/src/utils/config.js +7 -4
package/package.json
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const useLocation: () => {
|
|
3
|
-
name: string;
|
|
4
|
-
path: string;
|
|
5
|
-
pathname: string;
|
|
6
|
-
search: string;
|
|
7
|
-
query: qs.ParsedQs;
|
|
8
|
-
hash: string;
|
|
9
|
-
params: Readonly<import("react-router-dom").Params<string>>;
|
|
10
|
-
};
|
|
1
|
+
export declare const useLocation: UseLocationType;
|
package/src/utils/config.js
CHANGED
|
@@ -220,7 +220,7 @@ var getFormatRouter = function (routes, templateType) {
|
|
|
220
220
|
});
|
|
221
221
|
};
|
|
222
222
|
var initCliIndexFile = function (templateType) { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
-
var targetPath, targetTypesPath, replaceFileText, fileTypesText;
|
|
223
|
+
var targetPath, targetTypesPath, replaceFileText, fileTypesText, formatHooksPath;
|
|
224
224
|
return __generator(this, function (_a) {
|
|
225
225
|
switch (_a.label) {
|
|
226
226
|
case 0:
|
|
@@ -229,8 +229,11 @@ var initCliIndexFile = function (templateType) { return __awaiter(void 0, void 0
|
|
|
229
229
|
replaceFileText = fs_extra_1.default.readFileSync(path_1.default.resolve(__dirname, "../index.".concat(templateType, ".js")), 'utf8');
|
|
230
230
|
fileTypesText = fs_extra_1.default.readFileSync(path_1.default.resolve(__dirname, "../index.".concat(templateType, ".d.ts")), 'utf8');
|
|
231
231
|
if (templateType === 'react') {
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
formatHooksPath = path_1.default
|
|
233
|
+
.resolve(projectPath, './src/.swico/hooks')
|
|
234
|
+
.replaceAll('\\', '/');
|
|
235
|
+
console.log('formatHooksPath', formatHooksPath);
|
|
236
|
+
replaceFileText = replaceFileText.replaceAll('require("./template/react/hooks");', "require(\"".concat(formatHooksPath, "\");"));
|
|
234
237
|
}
|
|
235
238
|
return [4, (0, tools_1.writeFile)(targetPath, replaceFileText)];
|
|
236
239
|
case 1:
|
|
@@ -250,7 +253,7 @@ var formatRouterConfig = function (_a, templateType) {
|
|
|
250
253
|
switch (_a.label) {
|
|
251
254
|
case 0:
|
|
252
255
|
formatRouter = getFormatRouter(routes, templateType);
|
|
253
|
-
textData = "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.
|
|
256
|
+
textData = "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = ".concat(JSON.stringify(formatRouter), ";");
|
|
254
257
|
modifiedText = textData.replace(/"(\(\)=>import\('[^']+'\))"/g, '$1');
|
|
255
258
|
return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/routes.js'), modifiedText)];
|
|
256
259
|
case 1:
|