swico 0.6.0-beta24 → 0.6.0-beta25

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.6.0-beta24",
3
+ "version": "0.6.0-beta25",
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)()];
59
+ return [4, (0, tools_1.initIndexFile)('prod')];
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
  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
- return [4, (0, tools_1.initIndexFile)()];
136
+ return [4, (0, tools_1.initIndexFile)('dev')];
137
137
  case 1:
138
138
  _b.sent();
139
139
  if (!(envPort !== null && envPort !== void 0)) return [3, 2];
@@ -1,3 +1,4 @@
1
+ import { GlobalData } from './config';
1
2
  export declare const copyDirFiles: (src: any, dest: any, filter?: (fileName: any) => boolean) => Promise<any>;
2
3
  export declare const getPort: () => Promise<number>;
3
4
  export declare const toast: {
@@ -6,4 +7,4 @@ export declare const toast: {
6
7
  warning: (message: string | string[]) => void;
7
8
  };
8
9
  export declare const writeFile: (sourcePath: any, text: any) => Promise<unknown>;
9
- export declare const initIndexFile: () => Promise<void>;
10
+ export declare const initIndexFile: (env: GlobalData['env']) => Promise<void>;
@@ -166,15 +166,16 @@ var writeFile = function (sourcePath, text) {
166
166
  });
167
167
  };
168
168
  exports.writeFile = writeFile;
169
- var initIndexFile = function () { return __awaiter(void 0, void 0, void 0, function () {
170
- var fileText, targetPath, formatHooksPath;
169
+ var initIndexFile = function (env) { return __awaiter(void 0, void 0, void 0, function () {
170
+ var envPath, fileText, targetPath, formatHooksPath;
171
171
  return __generator(this, function (_a) {
172
172
  switch (_a.label) {
173
173
  case 0:
174
+ envPath = env === 'dev' ? '/' : '/.prod/';
174
175
  fileText = fs_extra_1.default.readFileSync(path_1.default.resolve(__dirname, '../index.js'), 'utf8');
175
176
  targetPath = path_1.default.resolve(__dirname, '../index.js');
176
177
  formatHooksPath = path_1.default
177
- .resolve(process.cwd(), './src/.swico/hooks')
178
+ .resolve(process.cwd(), "./src/.swico".concat(envPath, "hooks.js"))
178
179
  .replaceAll('\\', '/');
179
180
  console.log('replace', "require(\"".concat(formatHooksPath, "\");"));
180
181
  fileText = fileText.replaceAll("require(\"".concat(formatHooksPath, "\");"), 'require("./template/react/hooks");');