swico 0.6.0-beta18 → 0.6.0-beta19

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-beta18",
3
+ "version": "0.6.0-beta19",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -56,6 +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
  spinner.start('Initializing Swico production config...');
59
+ (0, tools_1.initIndexFile)();
59
60
  return [4, (0, config_1.getProjectConfig)('prod')];
60
61
  case 1:
61
62
  projectConfig = _a.sent();
@@ -133,6 +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
  spinner.start('Initializing Swico development config...');
136
+ (0, tools_1.initIndexFile)();
136
137
  if (!(envPort !== null && envPort !== void 0)) return [3, 1];
137
138
  _a = envPort;
138
139
  return [3, 3];
@@ -171,7 +171,6 @@ var getProjectConfig = function (env) { return __awaiter(void 0, void 0, void 0,
171
171
  return [3, 1];
172
172
  case 4:
173
173
  templateType = customConfig['base'].template;
174
- (0, tools_1.initIndexFile)(templateType);
175
174
  routerConfig = __assign(__assign(__assign({}, exports.initConfig.router), customConfig['base'].router), customConfig[env].router);
176
175
  return [4, initTemplateConfig(routerConfig, templateType, env)];
177
176
  case 5:
@@ -6,4 +6,4 @@ export declare const toast: {
6
6
  warning: (message: string | string[]) => void;
7
7
  };
8
8
  export declare const writeFile: (sourcePath: any, text: any) => Promise<unknown>;
9
- export declare const initIndexFile: (tempalteType: any) => Promise<void>;
9
+ export declare const initIndexFile: () => Promise<void>;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -44,6 +67,7 @@ var portfinder_1 = __importDefault(require("portfinder"));
44
67
  var fs_extra_1 = __importDefault(require("fs-extra"));
45
68
  var path_1 = __importDefault(require("path"));
46
69
  var chalk_1 = __importDefault(require("chalk"));
70
+ var process = __importStar(require("process"));
47
71
  var copyDirFiles = function (src, dest, filter) { return __awaiter(void 0, void 0, void 0, function () {
48
72
  var _copy, e_1;
49
73
  return __generator(this, function (_a) {
@@ -142,19 +166,21 @@ var writeFile = function (sourcePath, text) {
142
166
  });
143
167
  };
144
168
  exports.writeFile = writeFile;
145
- var initIndexFile = function (tempalteType) { return __awaiter(void 0, void 0, void 0, function () {
146
- var fileText, targetPath;
169
+ var initIndexFile = function () { return __awaiter(void 0, void 0, void 0, function () {
170
+ var fileText, targetPath, formatHooksPath;
147
171
  return __generator(this, function (_a) {
148
172
  switch (_a.label) {
149
173
  case 0:
150
- if (!(tempalteType === 'react')) return [3, 2];
151
- fileText = fs_extra_1.default.readFileSync(path_1.default.resolve(__dirname, '../index.react.js'), 'utf8');
174
+ fileText = fs_extra_1.default.readFileSync(path_1.default.resolve(__dirname, '../index.js'), 'utf8');
152
175
  targetPath = path_1.default.resolve(__dirname, '../index.js');
176
+ formatHooksPath = path_1.default
177
+ .resolve(process.cwd(), './src/.swico/hooks')
178
+ .replaceAll('\\', '/');
179
+ fileText = fileText.replaceAll("require(\"".concat(formatHooksPath, "\");"), 'require("./template/react/hooks");');
153
180
  return [4, (0, exports.writeFile)(targetPath, fileText)];
154
181
  case 1:
155
182
  _a.sent();
156
- _a.label = 2;
157
- case 2: return [2];
183
+ return [2];
158
184
  }
159
185
  });
160
186
  }); };