swico 0.8.0-beta2 → 0.8.0-beta3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "0.8.0-beta2",
3
+ "version": "0.8.0-beta3",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -56,7 +56,7 @@ function default_1() {
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
- return [4, (0, tools_1.initIndexFile)('prod')];
59
+ return [4, (0, tools_1.initIndexFile)()];
60
60
  case 1:
61
61
  _a.sent();
62
62
  return [4, (0, config_1.getProjectConfig)('prod')];
@@ -133,7 +133,7 @@ function start() {
133
133
  tools_1.toast.info("Swico v".concat(package_json_1.default.version));
134
134
  tools_1.toast.info('Initializing Swico development config...');
135
135
  }
136
- return [4, (0, tools_1.initIndexFile)('dev')];
136
+ return [4, (0, tools_1.initIndexFile)()];
137
137
  case 1:
138
138
  _b.sent();
139
139
  if (!(envPort !== null && envPort !== void 0)) return [3, 2];
@@ -1,4 +1,4 @@
1
- import { ConfigRouterType, GlobalData } from './config';
1
+ import { ConfigRouterType } from './config';
2
2
  export declare const copyDirFiles: (src: any, dest: any, filter?: (fileName: any) => boolean) => Promise<void>;
3
3
  export declare const getFormatRouter: (projectPath: string, routes: ConfigRouterType['routes'], templateType: any) => any[];
4
4
  export declare const getPort: () => Promise<number>;
@@ -7,4 +7,4 @@ export declare const toast: {
7
7
  error: (message: string | string[]) => void;
8
8
  warning: (message: string | string[]) => void;
9
9
  };
10
- export declare const initIndexFile: (env: GlobalData['env']) => Promise<void>;
10
+ export declare const initIndexFile: () => Promise<void>;
@@ -231,8 +231,8 @@ exports.toast = {
231
231
  }
232
232
  }
233
233
  };
234
- var initIndexFile = function (env) { return __awaiter(void 0, void 0, void 0, function () {
235
- var fileText, targetPath, formatHooksPath, formatHistoryPath;
234
+ var initIndexFile = function () { return __awaiter(void 0, void 0, void 0, function () {
235
+ var fileText, targetPath, formatHooksPath, formatDevHistoryPath, formatProdHistoryPath;
236
236
  return __generator(this, function (_a) {
237
237
  switch (_a.label) {
238
238
  case 0: return [4, fs_extra_1.default.readFile(path_1.default.resolve(__dirname, '../index.js'), 'utf8')];
@@ -249,16 +249,26 @@ var initIndexFile = function (env) { return __awaiter(void 0, void 0, void 0, fu
249
249
  _a.sent();
250
250
  _a.label = 3;
251
251
  case 3:
252
- formatHistoryPath = path_1.default
253
- .resolve(process.cwd(), "./src/.swico/.".concat(env, "/history"))
252
+ formatDevHistoryPath = path_1.default
253
+ .resolve(process.cwd(), './src/.swico/.dev/history')
254
254
  .replaceAll('\\', '/');
255
- if (!fileText.includes("require(\"".concat(formatHistoryPath, "\");"))) return [3, 5];
256
- fileText = fileText.replaceAll("require(\"".concat(formatHistoryPath, "\");"), 'require("./mock-history");');
255
+ formatProdHistoryPath = path_1.default
256
+ .resolve(process.cwd(), './src/.swico/.prod/history')
257
+ .replaceAll('\\', '/');
258
+ if (!fileText.includes("require(\"".concat(formatDevHistoryPath, "\");"))) return [3, 5];
259
+ fileText = fileText.replaceAll("require(\"".concat(formatDevHistoryPath, "\");"), 'require("./mock-history");');
257
260
  return [4, fs_extra_1.default.writeFile(targetPath, fileText)];
258
261
  case 4:
259
262
  _a.sent();
260
- _a.label = 5;
261
- case 5: return [2];
263
+ return [3, 7];
264
+ case 5:
265
+ if (!fileText.includes("require(\"".concat(formatProdHistoryPath, "\");"))) return [3, 7];
266
+ fileText = fileText.replaceAll("require(\"".concat(formatProdHistoryPath, "\");"), 'require("./mock-history");');
267
+ return [4, fs_extra_1.default.writeFile(targetPath, fileText)];
268
+ case 6:
269
+ _a.sent();
270
+ _a.label = 7;
271
+ case 7: return [2];
262
272
  }
263
273
  });
264
274
  }); };