@modern-js/module-tools 1.3.2 → 1.4.0

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,5 +1,23 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 67503500: add alais subCmd
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [118da5b4]
12
+ - Updated dependencies [b376c8d6]
13
+ - Updated dependencies [e62c4efd]
14
+ - Updated dependencies [6891e4c2]
15
+ - Updated dependencies [e2a8233f]
16
+ - @modern-js/css-config@1.2.2
17
+ - @modern-js/style-compiler@1.2.2
18
+ - @modern-js/core@1.4.2
19
+ - @modern-js/plugin-analyze@1.3.2
20
+
3
21
  ## 1.3.2
4
22
 
5
23
  ### Patch Changes
@@ -41,7 +41,7 @@ export const devStorybook = async config => {
41
41
  };
42
42
  export const runSubCmd = async (subCmd, config) => {
43
43
  const metas = await core.mountHook().moduleToolsMenu(undefined);
44
- const devMeta = metas.find(meta => meta.value === subCmd);
44
+ const devMeta = metas.find(meta => meta.value === subCmd || Array.isArray(meta.aliasValues) && meta.aliasValues.includes(subCmd));
45
45
 
46
46
  if (devMeta) {
47
47
  await devMeta.runTask(config);
@@ -61,7 +61,7 @@ exports.devStorybook = devStorybook;
61
61
 
62
62
  const runSubCmd = async (subCmd, config) => {
63
63
  const metas = await core.mountHook().moduleToolsMenu(undefined);
64
- const devMeta = metas.find(meta => meta.value === subCmd);
64
+ const devMeta = metas.find(meta => meta.value === subCmd || Array.isArray(meta.aliasValues) && meta.aliasValues.includes(subCmd));
65
65
 
66
66
  if (devMeta) {
67
67
  await devMeta.runTask(config);
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.3.2",
14
+ "version": "1.4.0",
15
15
  "bin": {
16
16
  "modern": "./bin/modern.js"
17
17
  },
@@ -53,16 +53,16 @@
53
53
  "@babel/types": "^7.15.0",
54
54
  "@modern-js/babel-compiler": "^1.2.1",
55
55
  "@modern-js/babel-preset-module": "^1.3.1",
56
- "@modern-js/core": "^1.4.1",
57
- "@modern-js/css-config": "^1.2.1",
56
+ "@modern-js/core": "^1.4.2",
57
+ "@modern-js/css-config": "^1.2.2",
58
58
  "@modern-js/i18n-cli-language-detector": "^1.2.1",
59
59
  "@modern-js/module-tools-hooks": "^1.2.1",
60
60
  "@modern-js/new-action": "^1.3.1",
61
- "@modern-js/plugin-analyze": "^1.3.1",
61
+ "@modern-js/plugin-analyze": "^1.3.2",
62
62
  "@modern-js/plugin-changeset": "^1.2.1",
63
63
  "@modern-js/plugin-fast-refresh": "^1.2.1",
64
64
  "@modern-js/plugin-i18n": "^1.2.1",
65
- "@modern-js/style-compiler": "^1.2.1",
65
+ "@modern-js/style-compiler": "^1.2.2",
66
66
  "@modern-js/utils": "^1.3.1",
67
67
  "chalk": "^4.1.2",
68
68
  "chokidar": "^3.5.2",
@@ -12,7 +12,7 @@ jest.mock('@modern-js/core', () => ({
12
12
 
13
13
  describe('dev feature with subCmd', () => {
14
14
  beforeEach(() => {
15
- console.info('asdas');
15
+ jest.clearAllMocks();
16
16
  });
17
17
  it('should run task with "storybook" params when storybook plugin exist', async () => {
18
18
  mockModuleToolsMenu.mockReturnValue([
@@ -27,4 +27,20 @@ describe('dev feature with subCmd', () => {
27
27
  await runSubCmd('storybook', { isTsProject: true, appDirectory: '' });
28
28
  expect(exit).toHaveBeenCalled();
29
29
  });
30
+
31
+ it('should run task with alias name "story" params when storybook plugin exist', async () => {
32
+ mockModuleToolsMenu.mockReturnValue([
33
+ { value: 'storybook', aliasValues: ['story'], runTask: mockDevMeta },
34
+ ]);
35
+ await runSubCmd('story', { isTsProject: true, appDirectory: '' });
36
+ expect(mockDevMeta.mock.calls.length).toBe(1);
37
+ });
38
+
39
+ it('should run task with alias name "story1" params when storybook plugin exist', async () => {
40
+ mockModuleToolsMenu.mockReturnValue([
41
+ { value: 'storybook', aliasValues: ['story'], runTask: mockDevMeta },
42
+ ]);
43
+ await runSubCmd('story1', { isTsProject: true, appDirectory: '' });
44
+ expect(mockDevMeta.mock.calls.length).toBe(0);
45
+ });
30
46
  });