swico 0.1.0 → 0.2.1-beta1

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,7 +1,7 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "0.1.0",
4
- "description": "swico",
3
+ "version": "0.2.1-beta1",
4
+ "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
7
7
  "keywords": [
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "https://gitee.com/fanlaBoy/secywo-template-cli.git"
28
+ "url": "https://gitee.com/fanlaBoy/swico.git"
29
29
  },
30
30
  "author": "scw",
31
31
  "license": "ISC",
@@ -52,7 +52,7 @@ function default_1() {
52
52
  return __generator(this, function (_a) {
53
53
  switch (_a.label) {
54
54
  case 0:
55
- process.env.SECYWO_ENV = 'prod';
55
+ process.env.SWICO_ENV = 'prod';
56
56
  return [4, (0, config_1.getProjectConfig)('prod')];
57
57
  case 1:
58
58
  projectConfig = _a.sent();
@@ -67,7 +67,7 @@ function default_1() {
67
67
  case 2:
68
68
  buildConfig = _a.sent();
69
69
  compiler = (0, webpack_1.default)(buildConfig);
70
- console.log("".concat(chalk_1.default.hex('#5f72f5')('Secywo starts building....'), " \n"));
70
+ console.log("".concat(chalk_1.default.hex('#5f72f5')('Swico starts building....'), " \n"));
71
71
  compiler.run(function (err, stats) {
72
72
  if (err) {
73
73
  tools_1.toast.error(err.stack || err.toString());
@@ -74,7 +74,7 @@ var handleWatch = function (projectPath, devServer) {
74
74
  return __generator(this, function (_a) {
75
75
  switch (_a.label) {
76
76
  case 0:
77
- tools_1.toast.warning('Secywo configuration files have been modified. The devServer is being restarted...');
77
+ tools_1.toast.warning('Swico configuration files have been modified. The devServer is being restarted...');
78
78
  return [4, devServer.stop()];
79
79
  case 1:
80
80
  _a.sent();
@@ -112,7 +112,7 @@ var handleWatch = function (projectPath, devServer) {
112
112
  };
113
113
  var availablePort;
114
114
  var restartServer = function () {
115
- var result = cross_spawn_1.default.sync('cross-env', ["PORT=".concat(availablePort), 'secywo', 'start'], {
115
+ var result = cross_spawn_1.default.sync('cross-env', ["PORT=".concat(availablePort), 'swico', 'start'], {
116
116
  stdio: 'inherit'
117
117
  });
118
118
  if (result.error) {
@@ -126,7 +126,7 @@ function start() {
126
126
  return __generator(this, function (_b) {
127
127
  switch (_b.label) {
128
128
  case 0:
129
- process.env.SECYWO_ENV = 'dev';
129
+ process.env.SWICO_ENV = 'dev';
130
130
  if (!(envPort !== null && envPort !== void 0)) return [3, 1];
131
131
  _a = envPort;
132
132
  return [3, 3];
@@ -273,7 +273,7 @@ function default_1(_a) {
273
273
  ignoreOrder: true
274
274
  }),
275
275
  new webpackbar_1.default({
276
- name: 'Secywo',
276
+ name: 'Swico',
277
277
  color: '#5f72f5',
278
278
  profile: false
279
279
  })
@@ -290,7 +290,7 @@ function default_1(_a) {
290
290
  ignoreOrder: true
291
291
  }),
292
292
  new webpackbar_1.default({
293
- name: 'Secywo',
293
+ name: 'Swico',
294
294
  color: '#5f72f5',
295
295
  profile: false
296
296
  })
@@ -118,7 +118,7 @@ function default_1(options) {
118
118
  },
119
119
  proxy: (_c = (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.dev) === null || _b === void 0 ? void 0 : _b.proxy) !== null && _c !== void 0 ? _c : config_1.initConfig.proxy,
120
120
  compress: true,
121
- hot: true,
121
+ hot: false,
122
122
  open: false,
123
123
  static: {
124
124
  directory: path_1.default.join(projectPath, '/public')
package/src/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { GlobalData, GlobalSecywoConfigType } from './utils/config';
1
+ import { GlobalData, GlobalSwicoConfigType } from './utils/config';
2
2
  export type CustomConfigType = GlobalData['customConfig'];
3
- export type { GlobalSecywoConfigType };
3
+ export type { GlobalSwicoConfigType };
4
4
  declare let Outlet: any, Link: any, useLocation: any;
5
5
  export { Outlet, Link, useLocation };
6
- export interface DefineSecywoConfigType {
6
+ export interface DefineSwicoConfigType {
7
7
  (env: 'base', config: CustomConfigType['base']): CustomConfigType['base'];
8
8
  (env: 'dev', config: CustomConfigType['dev']): CustomConfigType['dev'];
9
9
  (env: 'prod', config: CustomConfigType['prod']): CustomConfigType['prod'];
10
10
  }
11
- export declare const defineConfig: DefineSecywoConfigType;
11
+ export declare const defineConfig: DefineSwicoConfigType;
12
12
  export interface DefineGlobalConfigType {
13
13
  onInit?: (app: any, router: any) => void;
14
14
  }
@@ -1,7 +1,7 @@
1
- import { GlobalData, GlobalSecywoConfigType } from './utils/config';
1
+ import { GlobalData, GlobalSwicoConfigType } from './utils/config';
2
2
  import { CSSProperties, FC, ReactNode } from 'react';
3
3
  export type CustomConfigType = GlobalData['customConfig'];
4
- export type { GlobalSecywoConfigType };
4
+ export type { GlobalSwicoConfigType };
5
5
  export declare const Link: FC<{
6
6
  replace?: boolean;
7
7
  to: string;
@@ -11,9 +11,9 @@ export declare const Link: FC<{
11
11
  }>;
12
12
  export { Outlet } from 'react-router-dom';
13
13
  export { useLocation } from './template/hooks/react';
14
- export interface DefineSecywoConfigType {
14
+ export interface DefineSwicoConfigType {
15
15
  (env: 'base', config: CustomConfigType['base']): any;
16
16
  (env: 'dev', config: CustomConfigType['dev']): any;
17
17
  (env: 'prod', config: CustomConfigType['prod']): any;
18
18
  }
19
- export declare const defineConfig: DefineSecywoConfigType;
19
+ export declare const defineConfig: DefineSwicoConfigType;
@@ -1,10 +1,10 @@
1
- import { GlobalData, GlobalSecywoConfigType } from './utils/config';
1
+ import { GlobalData, GlobalSwicoConfigType } from './utils/config';
2
2
  import { App } from 'vue';
3
3
  import { Router } from 'vue-router';
4
4
  export type CustomConfigType = GlobalData['customConfig'];
5
5
  export { RouterView as Outlet } from 'vue-router';
6
6
  export { useLocation } from './template/hooks/vue';
7
- export type { GlobalSecywoConfigType };
7
+ export type { GlobalSwicoConfigType };
8
8
  export declare const Link: import("vue").DefineComponent<{
9
9
  to: {
10
10
  type: StringConstructor;
@@ -22,12 +22,12 @@ export declare const Link: import("vue").DefineComponent<{
22
22
  }>>, {
23
23
  replace: boolean;
24
24
  }, {}>;
25
- export interface DefineSecywoConfigType {
25
+ export interface DefineSwicoConfigType {
26
26
  (env: 'base', config: CustomConfigType['base']): any;
27
27
  (env: 'dev', config: CustomConfigType['dev']): any;
28
28
  (env: 'prod', config: CustomConfigType['prod']): any;
29
29
  }
30
- export declare const defineConfig: DefineSecywoConfigType;
30
+ export declare const defineConfig: DefineSwicoConfigType;
31
31
  export interface DefineGlobalConfigType {
32
32
  onInit?: (app: App, router: Router) => void;
33
33
  }
@@ -6,6 +6,6 @@ export declare const pathNameList: {
6
6
  name: string;
7
7
  }[];
8
8
  export declare const getHistory: (routerBase: ConfigRouterType['base'], routerType: ConfigRouterType['type']) => {
9
- history: SecywoHistoryType;
9
+ history: SwicoHistoryType;
10
10
  originalHistory: import("history").HashHistory;
11
11
  };
@@ -52,7 +52,7 @@ var App = function () {
52
52
  window.location.replace("".concat(config_1.routerBase));
53
53
  }
54
54
  }
55
- window.Secywo = {
55
+ window.Swico = {
56
56
  history: history
57
57
  };
58
58
  return (react_1.default.createElement(history_1.HistoryRouter, { basename: config_1.routerBase, history: originalHistory },
@@ -16,8 +16,8 @@ var router = (0, vue_router_1.createRouter)({
16
16
  routes: routes_1.default
17
17
  });
18
18
  var app = (0, vue_1.createApp)(Container_1.default);
19
- var Secywo = { history: null };
20
- Secywo.history = {
19
+ var Swico = { history: null };
20
+ Swico.history = {
21
21
  push: function (options) {
22
22
  if (typeof options === 'string') {
23
23
  router.push(options);
@@ -41,6 +41,6 @@ Secywo.history = {
41
41
  };
42
42
  app.component('Layout', Layout_1.default);
43
43
  app.use(router);
44
- window.Secywo = Secywo;
44
+ window.Swico = Swico;
45
45
  (_a = global_1.default === null || global_1.default === void 0 ? void 0 : global_1.default.onInit) === null || _a === void 0 ? void 0 : _a.call(global_1.default, app, router);
46
46
  app.mount('#root');
@@ -12,7 +12,7 @@ export type ConfigRouterType = {
12
12
  base?: string;
13
13
  routes?: ConfigRoutesItemType[];
14
14
  };
15
- export interface GlobalSecywoConfigType {
15
+ export interface GlobalSwicoConfigType {
16
16
  template: 'react' | 'vue';
17
17
  npmType?: 'npm' | 'pnpm';
18
18
  plugins?: any[];
@@ -31,17 +31,17 @@ export interface GlobalSecywoConfigType {
31
31
  router?: ConfigRouterType;
32
32
  }
33
33
  export interface GlobalData {
34
- templateType?: GlobalSecywoConfigType['template'];
34
+ templateType?: GlobalSwicoConfigType['template'];
35
35
  projectPath: string;
36
36
  entryPath: string;
37
37
  templatePath: string;
38
38
  env?: 'dev' | 'prod';
39
39
  customConfig: {
40
- base: Pick<GlobalSecywoConfigType, 'plugins' | 'publicPath' | 'alias' | 'define' | 'devtool' | 'externals' | 'npmType' | 'router' | 'template'>;
41
- dev: Pick<GlobalSecywoConfigType, 'plugins' | 'proxy' | 'https' | 'devtool' | 'router'>;
42
- prod: Pick<GlobalSecywoConfigType, 'plugins' | 'console' | 'copy' | 'devtool' | 'router'>;
40
+ base: Pick<GlobalSwicoConfigType, 'plugins' | 'publicPath' | 'alias' | 'define' | 'devtool' | 'externals' | 'npmType' | 'router' | 'template'>;
41
+ dev: Pick<GlobalSwicoConfigType, 'plugins' | 'proxy' | 'https' | 'devtool' | 'router'>;
42
+ prod: Pick<GlobalSwicoConfigType, 'plugins' | 'console' | 'copy' | 'devtool' | 'router'>;
43
43
  };
44
44
  }
45
45
  export declare const getProjectConfig: (env?: GlobalData['env']) => Promise<GlobalData>;
46
46
  export declare const getFormatDefineVars: (defineVarsConfigData: any) => Promise<{}>;
47
- export declare const initConfig: Omit<GlobalSecywoConfigType, 'template'>;
47
+ export declare const initConfig: Omit<GlobalSwicoConfigType, 'template'>;
@@ -87,9 +87,9 @@ var getProjectConfig = function (env) { return __awaiter(void 0, void 0, void 0,
87
87
  case 0:
88
88
  configDir = path_1.default.join(projectPath, '/config');
89
89
  configPath = {
90
- dev: path_1.default.join(configDir, '/secywo.dev.ts'),
91
- prod: path_1.default.join(configDir, '/secywo.prod.ts'),
92
- base: path_1.default.join(configDir, '/secywo.ts')
90
+ dev: path_1.default.join(configDir, '/swico.dev.ts'),
91
+ prod: path_1.default.join(configDir, '/swico.prod.ts'),
92
+ base: path_1.default.join(configDir, '/swico.ts')
93
93
  };
94
94
  customConfig = {};
95
95
  _loop_1 = function (key) {
@@ -118,19 +118,19 @@ var getProjectConfig = function (env) { return __awaiter(void 0, void 0, void 0,
118
118
  'router',
119
119
  'template'
120
120
  ];
121
- configFileName = 'secywo.ts';
121
+ configFileName = 'swico.ts';
122
122
  break;
123
123
  case 'dev':
124
124
  supportedFieldList_1 = ['plugins', 'proxy', 'https', 'devtool', 'router'];
125
- configFileName = 'secywo.dev.ts';
125
+ configFileName = 'swico.dev.ts';
126
126
  break;
127
127
  case 'prod':
128
128
  supportedFieldList_1 = ['plugins', 'console', 'copy', 'devtool', 'router'];
129
- configFileName = 'secywo.prod.ts';
129
+ configFileName = 'swico.prod.ts';
130
130
  }
131
131
  unSupportedField = configFields.find(function (field) { return !supportedFieldList_1.includes(field); });
132
132
  if (configFields.length > 0 && unSupportedField) {
133
- msgText = "\n The secywo configuration file '".concat(chalk_1.default.blue(configFileName), "' does not support the field '").concat(chalk_1.default.red(unSupportedField), "' ");
133
+ msgText = "\n The Swico configuration file '".concat(chalk_1.default.blue(configFileName), "' does not support the field '").concat(chalk_1.default.red(unSupportedField), "' ");
134
134
  tools_1.toast.error(msgText);
135
135
  process.exit();
136
136
  }
@@ -178,7 +178,7 @@ var getProjectConfig = function (env) { return __awaiter(void 0, void 0, void 0,
178
178
  return [4, handleCliIndexFile(templateType)];
179
179
  case 6:
180
180
  _g.sent();
181
- entryPath = path_1.default.resolve(projectPath, './src/.secywo/index.js');
181
+ entryPath = path_1.default.resolve(projectPath, './src/.swico/index.js');
182
182
  templatePath = path_1.default.join(projectPath, '/src/index.ejs');
183
183
  return [2, {
184
184
  projectPath: projectPath,
@@ -287,7 +287,7 @@ var initTemplateRouterConfig = function (routerConfig, templateType) {
287
287
  case 0: return [4, formatTemplateFileText(routerConfig, templateType)];
288
288
  case 1:
289
289
  _a.sent();
290
- copyTargetPath = path_1.default.resolve(projectPath, './src/.secywo');
290
+ copyTargetPath = path_1.default.resolve(projectPath, './src/.swico');
291
291
  if (!fs_extra_1.default.existsSync(copyTargetPath)) return [3, 3];
292
292
  return [4, fs_extra_1.default.remove(copyTargetPath)];
293
293
  case 2:
@@ -299,7 +299,7 @@ var initTemplateRouterConfig = function (routerConfig, templateType) {
299
299
  })];
300
300
  case 4:
301
301
  _a.sent();
302
- replaceIndexText = fs_extra_1.default.readFileSync(path_1.default.resolve(projectPath, './src/.secywo/index.js'), 'utf8');
302
+ replaceIndexText = fs_extra_1.default.readFileSync(path_1.default.resolve(projectPath, './src/.swico/index.js'), 'utf8');
303
303
  _a.label = 5;
304
304
  case 5:
305
305
  _a.trys.push([5, 7, , 8]);
@@ -328,7 +328,7 @@ var initTemplateRouterConfig = function (routerConfig, templateType) {
328
328
  case 11:
329
329
  if (!(templateType === 'vue')) return [3, 13];
330
330
  replaceIndexText = replaceIndexText.replace('"./Container"', '"./Container.vue"');
331
- return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.secywo/index.js'), replaceIndexText)];
331
+ return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/index.js'), replaceIndexText)];
332
332
  case 12:
333
333
  _a.sent();
334
334
  _a.label = 13;
@@ -346,7 +346,7 @@ var initTemplateRouterConfig = function (routerConfig, templateType) {
346
346
  e_3 = _a.sent();
347
347
  replaceIndexText = replaceIndexText.replace('"../loading"', '"./loading"');
348
348
  return [3, 19];
349
- case 17: return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.secywo/index.js'), replaceIndexText)];
349
+ case 17: return [4, (0, tools_1.writeFile)(path_1.default.resolve(projectPath, './src/.swico/index.js'), replaceIndexText)];
350
350
  case 18:
351
351
  _a.sent();
352
352
  return [7];
@@ -102,7 +102,7 @@ var getPort = function () {
102
102
  exports.getPort = getPort;
103
103
  exports.toast = {
104
104
  error: function (message) {
105
- console.log("\n".concat(chalk_1.default.hex('#5f72f5')('There are some errors about secywo:'), " \n"));
105
+ console.log("\n".concat(chalk_1.default.hex('#5f72f5')('There are some errors about Swico:'), " \n"));
106
106
  if (Array.isArray(message)) {
107
107
  message.forEach(function (item) {
108
108
  console.log(" > ".concat(chalk_1.default.red.bold(item), " \n"));
@@ -113,7 +113,7 @@ exports.toast = {
113
113
  }
114
114
  },
115
115
  warning: function (message) {
116
- console.log("\n".concat(chalk_1.default.hex('#5f72f5')('There are some warnings about secywo:'), " \n"));
116
+ console.log("\n".concat(chalk_1.default.hex('#5f72f5')('There are some warnings about Swico:'), " \n"));
117
117
  if (Array.isArray(message)) {
118
118
  message.forEach(function (item) {
119
119
  console.log(" > ".concat(chalk_1.default.hex('#fb8918').bold(item), " \n"));
@@ -128,7 +128,7 @@ var writeFile = function (sourcePath, text) {
128
128
  return new Promise(function (resolve, reject) {
129
129
  fs_extra_1.default.writeFile(sourcePath, text, function (err) {
130
130
  if (err) {
131
- var errText = 'An error occurred during the secywo configuration.';
131
+ var errText = 'An error occurred during the Swico configuration.';
132
132
  exports.toast.error(errText);
133
133
  return reject(errText);
134
134
  }