@modern-js/app-tools 1.0.1 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,24 +1,75 @@
1
1
  # @modern-js/app-tools
2
2
 
3
- ## 1.0.1
3
+ ## 1.1.3
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - release 1.0.1
8
- - Updated dependencies [undefined]
9
- - Updated dependencies [eb00b56]
10
- - @modern-js/core@1.0.1
11
- - @modern-js/i18n-cli-language-detector@1.0.1
12
- - @modern-js/plugin-analyze@1.0.1
13
- - @modern-js/plugin-fast-refresh@1.0.1
14
- - @modern-js/plugin-i18n@1.0.1
15
- - @modern-js/webpack@1.0.1
16
- - @modern-js/new-action@1.0.2
17
- - @modern-js/plugin-polyfill@1.0.1
18
- - @modern-js/server@1.0.1
19
- - @modern-js/plugin@1.0.1
20
- - @modern-js/types@1.0.1
21
- - @modern-js/utils@1.0.1
7
+ - 0fa83663: support more .env files
8
+ - Updated dependencies [6f7fe574]
9
+ - Updated dependencies [e4755134]
10
+ - Updated dependencies [0fa83663]
11
+ - Updated dependencies [19b4f79e]
12
+ - Updated dependencies [f594fbc8]
13
+ - Updated dependencies [d1fde77a]
14
+ - @modern-js/core@1.1.2
15
+ - @modern-js/webpack@1.1.2
16
+ - @modern-js/i18n-cli-language-detector@1.1.1
17
+ - @modern-js/plugin-analyze@1.1.1
18
+ - @modern-js/plugin-fast-refresh@1.1.1
19
+ - @modern-js/plugin-i18n@1.1.1
20
+ - @modern-js/new-action@1.1.2
21
+ - @modern-js/plugin-polyfill@1.1.1
22
+ - @modern-js/server@1.1.2
23
+ - @modern-js/plugin@1.1.2
24
+ - @modern-js/types@1.1.2
25
+ - @modern-js/utils@1.1.2
26
+
27
+ ## 1.1.2
28
+
29
+ ### Patch Changes
30
+
31
+ - c0fc0700: feat: support deploy plugin
32
+ - Updated dependencies [3b6856b8]
33
+ - Updated dependencies [687c92c7]
34
+ - Updated dependencies [c0fc0700]
35
+ - Updated dependencies [6ffd1a50]
36
+ - Updated dependencies [c7f4cafb]
37
+ - @modern-js/new-action@1.1.1
38
+ - @modern-js/core@1.1.1
39
+ - @modern-js/webpack@1.1.1
40
+ - @modern-js/server@1.1.1
41
+ - @modern-js/types@1.1.1
42
+ - @modern-js/utils@1.1.1
43
+ - @modern-js/plugin@1.1.1
44
+
45
+ ## 1.1.1
46
+
47
+ ### Patch Changes
48
+
49
+ - 6cfc16e: add esbuild deps
50
+
51
+ ## 1.1.0
52
+
53
+ ### Minor Changes
54
+
55
+ - 96119db2: Relese v1.1.0
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies [96119db2]
60
+ - Updated dependencies [eb00b569]
61
+ - @modern-js/core@1.1.0
62
+ - @modern-js/i18n-cli-language-detector@1.1.0
63
+ - @modern-js/plugin-analyze@1.1.0
64
+ - @modern-js/plugin-fast-refresh@1.1.0
65
+ - @modern-js/plugin-i18n@1.1.0
66
+ - @modern-js/webpack@1.1.0
67
+ - @modern-js/new-action@1.1.0
68
+ - @modern-js/plugin-polyfill@1.1.0
69
+ - @modern-js/server@1.1.0
70
+ - @modern-js/plugin@1.1.0
71
+ - @modern-js/types@1.1.0
72
+ - @modern-js/utils@1.1.0
22
73
 
23
74
  ## 1.0.0
24
75
 
@@ -105,8 +105,5 @@ export const build = async () => {
105
105
  }
106
106
  }
107
107
 
108
- await mountHook().afterBuild(); // force exit after build.
109
- // eslint-disable-next-line no-process-exit
110
-
111
- process.exit(0);
108
+ await mountHook().afterBuild();
112
109
  };
@@ -0,0 +1,5 @@
1
+ import { mountHook } from '@modern-js/core';
2
+ export const deploy = async () => {
3
+ await mountHook().beforeDeploy();
4
+ await mountHook().afterDeploy();
5
+ };
@@ -30,11 +30,26 @@ export default createPlugin(() => {
30
30
  const {
31
31
  build
32
32
  } = await import("./commands/build");
33
- await build();
33
+ await build(); // force exit after build.
34
+ // eslint-disable-next-line no-process-exit
35
+
36
+ process.exit(0);
34
37
  });
35
38
  program.command('start').usage('[options]').description(i18n.t(localeKeys.command.start.describe)).action(async () => {
36
39
  await start();
37
40
  });
41
+ program.command('deploy').usage('[options]').description(i18n.t(localeKeys.command.deploy.describe)).action(async () => {
42
+ const {
43
+ build
44
+ } = await import("./commands/build");
45
+ await build();
46
+ const {
47
+ deploy
48
+ } = await import("./commands/deploy");
49
+ await deploy(); // eslint-disable-next-line no-process-exit
50
+
51
+ process.exit(0);
52
+ });
38
53
  program.command('new').usage('[options]').description(i18n.t(localeKeys.command.new.describe)).option('-d, --debug', i18n.t(localeKeys.command.new.debug), false).option('-c, --config <config>', i18n.t(localeKeys.command.new.config)).option('--dist-tag <tag>', i18n.t(localeKeys.command.new.distTag)).option('--registry', i18n.t(localeKeys.command.new.registry)).action(async options => {
39
54
  const {
40
55
  MWANewAction
@@ -7,6 +7,8 @@ export const afterCreateCompiler = createAsyncWorkflow();
7
7
  export const beforePrintInstructions = createAsyncWaterfall();
8
8
  export const beforeBuild = createAsyncWorkflow();
9
9
  export const afterBuild = createAsyncWorkflow();
10
+ export const beforeDeploy = createAsyncWorkflow();
11
+ export const afterDeploy = createAsyncWorkflow();
10
12
  export const lifecycle = () => {
11
13
  registerHook({
12
14
  beforeDev,
@@ -15,6 +17,8 @@ export const lifecycle = () => {
15
17
  afterCreateCompiler,
16
18
  beforePrintInstructions,
17
19
  beforeBuild,
18
- afterBuild
20
+ afterBuild,
21
+ beforeDeploy,
22
+ afterDeploy
19
23
  });
20
24
  };
@@ -10,6 +10,9 @@ export const EN_LOCALE = {
10
10
  start: {
11
11
  describe: 'start server'
12
12
  },
13
+ deploy: {
14
+ describe: 'deploy application'
15
+ },
13
16
  new: {
14
17
  describe: 'generator runner for MWA project',
15
18
  debug: 'using debug mode to log something',
@@ -10,6 +10,9 @@ export const ZH_LOCALE = {
10
10
  start: {
11
11
  describe: '应用启动命令'
12
12
  },
13
+ deploy: {
14
+ describe: '部署应用命令'
15
+ },
13
16
  new: {
14
17
  describe: 'MWA 项目中中执行生成器',
15
18
  debug: '开启 Debug 模式,打印调试日志信息',
@@ -122,10 +122,7 @@ const build = async () => {
122
122
  }
123
123
  }
124
124
 
125
- await (0, _core.mountHook)().afterBuild(); // force exit after build.
126
- // eslint-disable-next-line no-process-exit
127
-
128
- process.exit(0);
125
+ await (0, _core.mountHook)().afterBuild();
129
126
  };
130
127
 
131
128
  exports.build = build;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.deploy = void 0;
7
+
8
+ var _core = require("@modern-js/core");
9
+
10
+ const deploy = async () => {
11
+ await (0, _core.mountHook)().beforeDeploy();
12
+ await (0, _core.mountHook)().afterDeploy();
13
+ };
14
+
15
+ exports.deploy = deploy;
@@ -55,11 +55,26 @@ var _default = (0, _core.createPlugin)(() => {
55
55
  const {
56
56
  build
57
57
  } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/build")));
58
- await build();
58
+ await build(); // force exit after build.
59
+ // eslint-disable-next-line no-process-exit
60
+
61
+ process.exit(0);
59
62
  });
60
63
  program.command('start').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.start.describe)).action(async () => {
61
64
  await (0, _start.start)();
62
65
  });
66
+ program.command('deploy').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async () => {
67
+ const {
68
+ build
69
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/build")));
70
+ await build();
71
+ const {
72
+ deploy
73
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/deploy")));
74
+ await deploy(); // eslint-disable-next-line no-process-exit
75
+
76
+ process.exit(0);
77
+ });
63
78
  program.command('new').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.new.describe)).option('-d, --debug', _locale.i18n.t(_locale.localeKeys.command.new.debug), false).option('-c, --config <config>', _locale.i18n.t(_locale.localeKeys.command.new.config)).option('--dist-tag <tag>', _locale.i18n.t(_locale.localeKeys.command.new.distTag)).option('--registry', _locale.i18n.t(_locale.localeKeys.command.new.registry)).action(async options => {
64
79
  const {
65
80
  MWANewAction
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.lifecycle = exports.beforePrintInstructions = exports.beforeDev = exports.beforeCreateCompiler = exports.beforeBuild = exports.afterDev = exports.afterCreateCompiler = exports.afterBuild = void 0;
6
+ exports.lifecycle = exports.beforePrintInstructions = exports.beforeDev = exports.beforeDeploy = exports.beforeCreateCompiler = exports.beforeBuild = exports.afterDev = exports.afterDeploy = exports.afterCreateCompiler = exports.afterBuild = void 0;
7
7
 
8
8
  var _plugin = require("@modern-js/plugin");
9
9
 
@@ -23,6 +23,10 @@ const beforeBuild = (0, _plugin.createAsyncWorkflow)();
23
23
  exports.beforeBuild = beforeBuild;
24
24
  const afterBuild = (0, _plugin.createAsyncWorkflow)();
25
25
  exports.afterBuild = afterBuild;
26
+ const beforeDeploy = (0, _plugin.createAsyncWorkflow)();
27
+ exports.beforeDeploy = beforeDeploy;
28
+ const afterDeploy = (0, _plugin.createAsyncWorkflow)();
29
+ exports.afterDeploy = afterDeploy;
26
30
 
27
31
  const lifecycle = () => {
28
32
  (0, _core.registerHook)({
@@ -32,7 +36,9 @@ const lifecycle = () => {
32
36
  afterCreateCompiler,
33
37
  beforePrintInstructions,
34
38
  beforeBuild,
35
- afterBuild
39
+ afterBuild,
40
+ beforeDeploy,
41
+ afterDeploy
36
42
  });
37
43
  };
38
44
 
@@ -16,6 +16,9 @@ const EN_LOCALE = {
16
16
  start: {
17
17
  describe: 'start server'
18
18
  },
19
+ deploy: {
20
+ describe: 'deploy application'
21
+ },
19
22
  new: {
20
23
  describe: 'generator runner for MWA project',
21
24
  debug: 'using debug mode to log something',
@@ -16,6 +16,9 @@ const ZH_LOCALE = {
16
16
  start: {
17
17
  describe: '应用启动命令'
18
18
  },
19
+ deploy: {
20
+ describe: '部署应用命令'
21
+ },
19
22
  new: {
20
23
  describe: 'MWA 项目中中执行生成器',
21
24
  debug: '开启 Debug 模式,打印调试日志信息',
@@ -1 +1 @@
1
- export declare const build: () => Promise<never>;
1
+ export declare const build: () => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const deploy: () => Promise<void>;
@@ -14,4 +14,6 @@ export declare const beforeBuild: import("@modern-js/plugin").AsyncWorkflow<{
14
14
  webpackConfigs: Configuration[];
15
15
  }, unknown>;
16
16
  export declare const afterBuild: import("@modern-js/plugin").AsyncWorkflow<void, unknown>;
17
+ export declare const beforeDeploy: import("@modern-js/plugin").AsyncWorkflow<void, unknown>;
18
+ export declare const afterDeploy: import("@modern-js/plugin").AsyncWorkflow<void, unknown>;
17
19
  export declare const lifecycle: () => void;
@@ -10,6 +10,9 @@ export declare const EN_LOCALE: {
10
10
  start: {
11
11
  describe: string;
12
12
  };
13
+ deploy: {
14
+ describe: string;
15
+ };
13
16
  new: {
14
17
  describe: string;
15
18
  debug: string;
@@ -12,6 +12,9 @@ declare const localeKeys: {
12
12
  start: {
13
13
  describe: string;
14
14
  };
15
+ deploy: {
16
+ describe: string;
17
+ };
15
18
  new: {
16
19
  describe: string;
17
20
  debug: string;
@@ -32,6 +35,9 @@ declare const localeKeys: {
32
35
  start: {
33
36
  describe: string;
34
37
  };
38
+ deploy: {
39
+ describe: string;
40
+ };
35
41
  new: {
36
42
  describe: string;
37
43
  debug: string;
@@ -10,6 +10,9 @@ export declare const ZH_LOCALE: {
10
10
  start: {
11
11
  describe: string;
12
12
  };
13
+ deploy: {
14
+ describe: string;
15
+ };
13
16
  new: {
14
17
  describe: string;
15
18
  debug: string;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.0.1",
14
+ "version": "1.1.3",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./lib/types.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -32,18 +32,19 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7",
35
- "@modern-js/core": "^1.0.1",
36
- "@modern-js/types": "^1.0.1",
37
- "@modern-js/i18n-cli-language-detector": "^1.0.1",
38
- "@modern-js/new-action": "^1.0.2",
39
- "@modern-js/plugin": "^1.0.1",
40
- "@modern-js/plugin-analyze": "^1.0.1",
41
- "@modern-js/plugin-fast-refresh": "^1.0.1",
42
- "@modern-js/plugin-i18n": "^1.0.1",
43
- "@modern-js/plugin-polyfill": "^1.0.1",
44
- "@modern-js/server": "^1.0.1",
45
- "@modern-js/utils": "^1.0.1",
46
- "@modern-js/webpack": "^1.0.1",
35
+ "@modern-js/core": "^1.1.2",
36
+ "@modern-js/types": "^1.1.2",
37
+ "@modern-js/i18n-cli-language-detector": "^1.1.1",
38
+ "@modern-js/new-action": "^1.1.2",
39
+ "@modern-js/plugin": "^1.1.2",
40
+ "@modern-js/plugin-analyze": "^1.1.1",
41
+ "@modern-js/plugin-fast-refresh": "^1.1.1",
42
+ "@modern-js/plugin-i18n": "^1.1.1",
43
+ "@modern-js/plugin-polyfill": "^1.1.1",
44
+ "@modern-js/server": "^1.1.2",
45
+ "@modern-js/utils": "^1.1.2",
46
+ "@modern-js/webpack": "^1.1.2",
47
+ "esbuild": "^0.13.13",
47
48
  "webpack": "^5.54.0"
48
49
  },
49
50
  "devDependencies": {
@@ -52,8 +53,8 @@
52
53
  "@types/react": "^17",
53
54
  "@types/react-dom": "^17",
54
55
  "typescript": "^4",
55
- "@modern-js/plugin-testing": "^1.0.2",
56
- "@modern-js/module-tools": "^1.0.2"
56
+ "@modern-js/plugin-testing": "^1.1.0",
57
+ "@modern-js/module-tools": "^1.1.0"
57
58
  },
58
59
  "sideEffects": false,
59
60
  "modernConfig": {
@@ -116,8 +116,4 @@ export const build = async () => {
116
116
  }
117
117
  }
118
118
  await (mountHook() as any).afterBuild();
119
-
120
- // force exit after build.
121
- // eslint-disable-next-line no-process-exit
122
- process.exit(0);
123
119
  };
@@ -0,0 +1,6 @@
1
+ import { mountHook } from '@modern-js/core';
2
+
3
+ export const deploy = async () => {
4
+ await (mountHook() as any).beforeDeploy();
5
+ await (mountHook() as any).afterDeploy();
6
+ };
package/src/index.ts CHANGED
@@ -39,6 +39,9 @@ export default createPlugin(
39
39
  .action(async () => {
40
40
  const { build } = await import('./commands/build');
41
41
  await build();
42
+ // force exit after build.
43
+ // eslint-disable-next-line no-process-exit
44
+ process.exit(0);
42
45
  });
43
46
 
44
47
  program
@@ -49,6 +52,19 @@ export default createPlugin(
49
52
  await start();
50
53
  });
51
54
 
55
+ program
56
+ .command('deploy')
57
+ .usage('[options]')
58
+ .description(i18n.t(localeKeys.command.deploy.describe))
59
+ .action(async () => {
60
+ const { build } = await import('./commands/build');
61
+ await build();
62
+ const { deploy } = await import('./commands/deploy');
63
+ await deploy();
64
+ // eslint-disable-next-line no-process-exit
65
+ process.exit(0);
66
+ });
67
+
52
68
  program
53
69
  .command('new')
54
70
  .usage('[options]')
package/src/lifecycle.ts CHANGED
@@ -24,6 +24,10 @@ export const beforeBuild = createAsyncWorkflow<{
24
24
 
25
25
  export const afterBuild = createAsyncWorkflow();
26
26
 
27
+ export const beforeDeploy = createAsyncWorkflow();
28
+
29
+ export const afterDeploy = createAsyncWorkflow();
30
+
27
31
  export const lifecycle = () => {
28
32
  registerHook({
29
33
  beforeDev,
@@ -33,5 +37,7 @@ export const lifecycle = () => {
33
37
  beforePrintInstructions,
34
38
  beforeBuild,
35
39
  afterBuild,
40
+ beforeDeploy,
41
+ afterDeploy,
36
42
  });
37
43
  };
package/src/locale/en.ts CHANGED
@@ -6,6 +6,7 @@ export const EN_LOCALE = {
6
6
  },
7
7
  build: { describe: 'build application' },
8
8
  start: { describe: 'start server' },
9
+ deploy: { describe: 'deploy application' },
9
10
  new: {
10
11
  describe: 'generator runner for MWA project',
11
12
  debug: 'using debug mode to log something',
package/src/locale/zh.ts CHANGED
@@ -6,6 +6,7 @@ export const ZH_LOCALE = {
6
6
  },
7
7
  build: { describe: '构建应用命令' },
8
8
  start: { describe: '应用启动命令' },
9
+ deploy: { describe: '部署应用命令' },
9
10
  new: {
10
11
  describe: 'MWA 项目中中执行生成器',
11
12
  debug: '开启 Debug 模式,打印调试日志信息',