swico 1.1.0-beta.1 → 1.1.0-beta.3

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": "1.1.0-beta.1",
3
+ "version": "1.1.0-beta.3",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -57,18 +57,15 @@ var tools_1 = require("../utils/tools");
57
57
  var config_1 = require("../utils/config");
58
58
  var chokidar_1 = __importDefault(require("chokidar"));
59
59
  var path_1 = __importDefault(require("path"));
60
- var ora_1 = __importDefault(require("ora"));
61
60
  var cross_spawn_1 = __importDefault(require("cross-spawn"));
62
61
  var _a = process.env, envPort = _a.PORT, RESTART = _a.RESTART;
63
62
  var package_json_1 = __importDefault(require("../../package.json"));
64
63
  var chalk_1 = __importDefault(require("chalk"));
65
- var spinner = (0, ora_1.default)();
66
64
  var handleWatch = function (projectPath, devServer) {
67
65
  var configFilesWatcher = chokidar_1.default
68
66
  .watch([
69
67
  path_1.default.join(projectPath, '/config/*.ts'),
70
- path_1.default.join(projectPath, '/.eslintrc'),
71
- path_1.default.join(projectPath, '/src/loading/index.tsx')
68
+ path_1.default.join(projectPath, '/.eslintrc')
72
69
  ], {
73
70
  interval: 500,
74
71
  binaryInterval: 500,
@@ -93,7 +90,13 @@ var handleWatch = function (projectPath, devServer) {
93
90
  });
94
91
  }); });
95
92
  var tsTypingsWatcher = chokidar_1.default
96
- .watch([path_1.default.join(projectPath, '/src/**/*.d.ts')], {
93
+ .watch([
94
+ path_1.default.join(projectPath, '/src/**/*.d.ts'),
95
+ path_1.default.join(projectPath, '/src/loading/index.tsx'),
96
+ path_1.default.join(projectPath, '/src/global.css'),
97
+ path_1.default.join(projectPath, '/src/global.less'),
98
+ path_1.default.join(projectPath, '/src/global.scss')
99
+ ], {
97
100
  interval: 500,
98
101
  binaryInterval: 500,
99
102
  ignoreInitial: true
@@ -117,6 +120,7 @@ var handleWatch = function (projectPath, devServer) {
117
120
  }); });
118
121
  };
119
122
  var availablePort;
123
+ var routerBase = '/';
120
124
  var restartServer = function () {
121
125
  var result = cross_spawn_1.default.sync('cross-env', ["PORT=".concat(availablePort), 'RESTART=true', 'swico', 'start'], {
122
126
  stdio: 'inherit'
@@ -160,10 +164,11 @@ var createCompileListener = function (compiler) {
160
164
  function start() {
161
165
  var _a, _b, _c, _d, _e, _f;
162
166
  return __awaiter(this, void 0, void 0, function () {
163
- var _g, projectConfig, projectPath, customConfig, routerBase, startConfig, compiler, oriLogger, devServer, e_1, strErr;
167
+ var _g, projectConfig, projectPath, customConfig, newRouterBase, startConfig, compiler, oriLogger, devServer, e_1, strErr;
164
168
  return __generator(this, function (_h) {
165
169
  switch (_h.label) {
166
170
  case 0:
171
+ console.log('routerBase', routerBase, availablePort);
167
172
  process.env.SWICO_ENV = 'dev';
168
173
  if (RESTART !== 'true') {
169
174
  tools_1.toast.info("Swico v".concat(package_json_1.default.version));
@@ -185,7 +190,7 @@ function start() {
185
190
  case 5:
186
191
  projectConfig = _h.sent();
187
192
  projectPath = projectConfig.projectPath, customConfig = projectConfig.customConfig;
188
- routerBase = (_f = (_c = (_b = (_a = customConfig['dev']) === null || _a === void 0 ? void 0 : _a.router) === null || _b === void 0 ? void 0 : _b.base) !== null && _c !== void 0 ? _c : (_e = (_d = customConfig['base']) === null || _d === void 0 ? void 0 : _d.router) === null || _e === void 0 ? void 0 : _e.base) !== null && _f !== void 0 ? _f : '/';
193
+ newRouterBase = (_f = (_c = (_b = (_a = customConfig['dev']) === null || _a === void 0 ? void 0 : _a.router) === null || _b === void 0 ? void 0 : _b.base) !== null && _c !== void 0 ? _c : (_e = (_d = customConfig['base']) === null || _d === void 0 ? void 0 : _d.router) === null || _e === void 0 ? void 0 : _e.base) !== null && _f !== void 0 ? _f : '/';
189
194
  return [4, (0, webpack_dev_1.default)(projectConfig)];
190
195
  case 6:
191
196
  startConfig = _h.sent();
@@ -193,6 +198,7 @@ function start() {
193
198
  oriLogger = compiler.getInfrastructureLogger;
194
199
  compiler.getInfrastructureLogger = getMockGetLogger(compiler);
195
200
  devServer = new webpack_dev_server_1.default(__assign(__assign({}, startConfig.devServer), { port: availablePort }), compiler);
201
+ devServer.watchFiles([], {});
196
202
  _h.label = 7;
197
203
  case 7:
198
204
  _h.trys.push([7, 9, , 10]);
@@ -202,9 +208,10 @@ function start() {
202
208
  createCompileListener(compiler);
203
209
  compiler.getInfrastructureLogger = oriLogger;
204
210
  handleWatch(projectPath, devServer);
205
- if (RESTART !== 'true') {
206
- tools_1.toast.info("Project is running at\uFF1A".concat(chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort).concat(routerBase))));
211
+ if (RESTART !== 'true' || newRouterBase !== routerBase) {
212
+ tools_1.toast.info("Project is running at\uFF1A".concat(chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort).concat(newRouterBase))));
207
213
  }
214
+ routerBase = newRouterBase;
208
215
  return [3, 10];
209
216
  case 9:
210
217
  e_1 = _h.sent();