swico 0.6.0-beta12 → 0.6.0-beta14

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-beta12",
3
+ "version": "0.6.0-beta14",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -55,7 +55,7 @@ function default_1() {
55
55
  case 0:
56
56
  process.env.SWICO_ENV = 'prod';
57
57
  tools_1.toast.info("Swico v".concat(package_json_1.default.version));
58
- spinner.start('Initializing Swico production config...');
58
+ spinner.start('Initializing Swico production config...\n');
59
59
  return [4, (0, config_1.getProjectConfig)('prod')];
60
60
  case 1:
61
61
  projectConfig = _a.sent();
@@ -132,7 +132,7 @@ function start() {
132
132
  case 0:
133
133
  process.env.SWICO_ENV = 'dev';
134
134
  tools_1.toast.info("Swico v".concat(package_json_1.default.version));
135
- spinner.start('Initializing Swico development config...');
135
+ spinner.start('Initializing Swico development config...\n');
136
136
  if (!(envPort !== null && envPort !== void 0)) return [3, 1];
137
137
  _a = envPort;
138
138
  return [3, 3];
@@ -308,101 +308,97 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
308
308
  switch (_a.label) {
309
309
  case 0:
310
310
  copyTargetPath = path_1.default.resolve(projectPath, './src/.swico');
311
- if (!fs_extra_1.default.existsSync(copyTargetPath)) return [3, 2];
312
- return [4, fs_extra_1.default.remove(copyTargetPath)];
313
- case 1:
314
- _a.sent();
315
- _a.label = 2;
316
- case 2:
317
311
  copyFileNameList = getCopyFileNameList(templateType, env);
312
+ console.log('1');
318
313
  return [4, (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, "../template/".concat(templateType)), copyTargetPath, function (fileName) { return copyFileNameList.includes(fileName); })];
319
- case 3:
314
+ case 1:
320
315
  _a.sent();
316
+ console.log('2');
321
317
  return [4, formatRouterConfig(routerConfig, templateType, env)];
322
- case 4:
318
+ case 2:
323
319
  _a.sent();
324
320
  replaceIndexText = fs_extra_1.default.readFileSync(path_1.default.resolve(projectPath, './src/.swico/index.js'), 'utf8');
325
321
  if (env === 'prod') {
326
- replaceIndexText = replaceIndexText.replaceAll('require("./config");', 'require("./config.prod");');
327
- replaceIndexText = replaceIndexText.replaceAll('require("./routes");', 'require("./routes.prod");');
322
+ replaceIndexText = replaceIndexText.replaceAll('require("./config")', 'require("./config.prod")');
323
+ replaceIndexText = replaceIndexText.replaceAll('require("./routes")', 'require("./routes.prod")');
328
324
  }
329
325
  else {
330
- replaceIndexText = replaceIndexText.replaceAll('require("./config.prod");', 'require("./config");');
331
- replaceIndexText = replaceIndexText.replaceAll('require("./routes.prod");', 'require("./routes");');
326
+ replaceIndexText = replaceIndexText.replaceAll('require("./config.prod")', 'require("./config")');
327
+ replaceIndexText = replaceIndexText.replaceAll('require("./routes.prod")', 'require("./routes")');
332
328
  }
333
- _a.label = 5;
334
- case 5:
335
- _a.trys.push([5, 7, , 8]);
329
+ _a.label = 3;
330
+ case 3:
331
+ _a.trys.push([3, 5, , 6]);
336
332
  return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/global.ts'), fs_extra_1.default.constants.F_OK)];
337
- case 6:
333
+ case 4:
338
334
  _a.sent();
339
335
  replaceIndexText = replaceIndexText.replaceAll('require("../global");', '');
340
336
  replaceIndexText = 'require("../global");\n' + replaceIndexText;
341
- return [3, 8];
342
- case 7:
337
+ return [3, 6];
338
+ case 5:
343
339
  e_1 = _a.sent();
344
340
  replaceIndexText = replaceIndexText.replaceAll('require("../global");', '');
345
- return [3, 8];
346
- case 8:
347
- _a.trys.push([8, 10, , 11]);
341
+ return [3, 6];
342
+ case 6:
343
+ _a.trys.push([6, 8, , 9]);
348
344
  return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/global.less'), fs_extra_1.default.constants.F_OK)];
349
- case 9:
345
+ case 7:
350
346
  _a.sent();
351
347
  replaceIndexText = replaceIndexText.replaceAll('require("../global.less");', '');
352
348
  replaceIndexText = 'require("../global.less");\n' + replaceIndexText;
353
- return [3, 11];
354
- case 10:
349
+ return [3, 9];
350
+ case 8:
355
351
  e_2 = _a.sent();
356
352
  replaceIndexText = replaceIndexText.replaceAll('require("../global.less");', '');
357
- return [3, 11];
358
- case 11:
359
- if (!(templateType === 'vue')) return [3, 14];
353
+ return [3, 9];
354
+ case 9:
355
+ if (!(templateType === 'vue')) return [3, 12];
360
356
  replaceIndexText = replaceIndexText.replace('"./Container"', '"./Container.vue"');
361
357
  return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/index.js'), replaceIndexText)];
362
- case 12:
358
+ case 10:
363
359
  _a.sent();
364
360
  replaceHooksText = fs_extra_1.default.readFileSync(path_1.default.resolve(projectPath, './src/.swico/hooks.js'), 'utf8');
365
361
  if (env === 'prod') {
366
- replaceHooksText = replaceHooksText.replaceAll('require("./config");', 'require("./config.prod");');
362
+ replaceHooksText = replaceHooksText.replaceAll('require("./config")', 'require("./config.prod")');
367
363
  }
368
364
  else {
369
- replaceHooksText = replaceIndexText.replaceAll('require("./config.prod");', 'require("./config");');
365
+ replaceHooksText = replaceIndexText.replaceAll('require("./config.prod")', 'require("./config")');
370
366
  }
371
367
  return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/hooks.js'), replaceHooksText)];
372
- case 13:
368
+ case 11:
373
369
  _a.sent();
374
- return [3, 21];
375
- case 14:
376
- if (!(templateType === 'react')) return [3, 21];
377
- _a.label = 15;
378
- case 15:
379
- _a.trys.push([15, 17, 18, 21]);
370
+ return [3, 19];
371
+ case 12:
372
+ if (!(templateType === 'react')) return [3, 19];
373
+ _a.label = 13;
374
+ case 13:
375
+ _a.trys.push([13, 15, 16, 19]);
380
376
  return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/loading/index.tsx'), fs_extra_1.default.constants.F_OK)];
381
- case 16:
377
+ case 14:
382
378
  _a.sent();
383
379
  replaceIndexText = replaceIndexText.replace('"./loading"', '"../loading"');
384
- return [3, 21];
385
- case 17:
380
+ return [3, 19];
381
+ case 15:
386
382
  e_3 = _a.sent();
387
383
  replaceIndexText = replaceIndexText.replace('"../loading"', '"./loading"');
388
- return [3, 21];
389
- case 18: return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/index.js'), replaceIndexText)];
390
- case 19:
384
+ return [3, 19];
385
+ case 16: return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/index.js'), replaceIndexText)];
386
+ case 17:
391
387
  _a.sent();
392
388
  replaceHistoryText = fs_extra_1.default.readFileSync(path_1.default.resolve(projectPath, './src/.swico/history.js'), 'utf8');
393
389
  if (env === 'prod') {
394
- replaceHistoryText = replaceHistoryText.replaceAll('require("./config");', 'require("./config.prod");');
395
- replaceHistoryText = replaceHistoryText.replaceAll('require("./routes");', 'require("./routes.prod");');
390
+ replaceHistoryText = replaceHistoryText.replaceAll('require("./config")', 'require("./config.prod")');
391
+ replaceHistoryText = replaceHistoryText.replaceAll('require("./routes")', 'require("./routes.prod")');
396
392
  }
397
393
  else {
398
- replaceHistoryText = replaceHistoryText.replaceAll('require("./config.prod");', 'require("./config");');
399
- replaceHistoryText = replaceHistoryText.replaceAll('require("./routes.prod");', 'require("./routes");');
394
+ replaceHistoryText = replaceHistoryText.replaceAll('require("./config.prod")', 'require("./config")');
395
+ replaceHistoryText = replaceHistoryText.replaceAll('require("./routes.prod")', 'require("./routes")');
400
396
  }
401
397
  return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/history.js'), replaceHistoryText)];
402
- case 20:
398
+ case 18:
403
399
  _a.sent();
404
400
  return [7];
405
- case 21:
401
+ case 19:
406
402
  resolve(null);
407
403
  return [2];
408
404
  }
@@ -59,6 +59,7 @@ var copyDirFiles = function (src, dest, filter) { return __awaiter(void 0, void
59
59
  files.forEach(function (file) {
60
60
  var srcPath = path_1.default.join(src, file);
61
61
  var destPath = path_1.default.join(dest, file);
62
+ console.log('1.5', srcPath, destPath);
62
63
  var srcStat = fs_extra_1.default.statSync(srcPath);
63
64
  if (srcStat.isDirectory()) {
64
65
  _copy(srcPath, destPath);