@modern-js/new-action 1.3.11-alpha.0 → 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,14 +1,50 @@
1
1
  # @modern-js/new-action
2
2
 
3
- ## 1.3.11-alpha.0
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 52374e3: chore(generator): use module-tools bundle function to bundle generator package
8
+
9
+ chore(generator): 使用 module-tools 的 bundle 功能实现生成器打包
10
+
11
+ ### Patch Changes
12
+
13
+ - 281edd5: fix: monorepo new command plugin path
14
+
15
+ fix: 修复 monorepo tools new 命令计算插件路径
16
+
17
+ - Updated dependencies [4fc801f]
18
+ - Updated dependencies [c8614b8]
19
+ - Updated dependencies [52374e3]
20
+ - @modern-js/utils@1.8.0
21
+ - @modern-js/generator-common@1.6.0
22
+ - @modern-js/generator-utils@1.4.0
23
+
24
+ ## 1.3.12
25
+
26
+ ### Patch Changes
27
+
28
+ - 74e74ee: fix: monorepo-tools new command plugin params not work
29
+
30
+ fix: 修复 monorepo-tools new 命令 plugin 参数不生效问题
31
+
32
+ - Updated dependencies [72907b2]
33
+ - Updated dependencies [33cebd2]
34
+ - @modern-js/generator-common@1.5.0
35
+ - @modern-js/generator-utils@1.3.0
36
+ - @modern-js/utils@1.7.12
37
+
38
+ ## 1.3.11
4
39
 
5
40
  ### Patch Changes
6
41
 
7
- - Updated dependencies [9cd364e06]
8
- - Updated dependencies [a90bc96bd]
9
- - @modern-js/utils@1.7.9-alpha.0
10
- - @modern-js/generator-common@1.4.13-alpha.0
11
- - @modern-js/generator-utils@1.2.7-alpha.0
42
+ - 341bb42: feat: bump codesmith package version
43
+ - Updated dependencies [341bb42]
44
+ - Updated dependencies [a90bc96]
45
+ - @modern-js/generator-common@1.4.13
46
+ - @modern-js/generator-utils@1.2.7
47
+ - @modern-js/utils@1.7.9
12
48
 
13
49
  ## 1.3.10
14
50
 
@@ -1,3 +1,4 @@
1
+ import path from 'path';
1
2
  import { merge } from '@modern-js/utils/lodash';
2
3
  import { CodeSmith } from '@modern-js/codesmith';
3
4
  import { i18n } from '@modern-js/generator-common';
@@ -11,7 +12,7 @@ export const MonorepoNewAction = async options => {
11
12
  debug = false,
12
13
  registry = '',
13
14
  config = '{}',
14
- plugins = [],
15
+ plugin = [],
15
16
  cwd = process.cwd()
16
17
  } = options;
17
18
  let UserConfig = {};
@@ -32,8 +33,21 @@ export const MonorepoNewAction = async options => {
32
33
 
33
34
  if (!alreadyRepo(cwd)) {
34
35
  smith.logger.warn('not valid modern.js repo');
35
- }
36
+ } // Determine if the plugin is a Monorepo dependency
37
+
36
38
 
39
+ const plugins = plugin.map(plugin => {
40
+ try {
41
+ return path.join(require.resolve(plugin), '../../');
42
+ } catch (e) {
43
+ try {
44
+ // 兼容旧版打包路径
45
+ return path.join(require.resolve(plugin), '../../../../');
46
+ } catch (e) {
47
+ return plugin;
48
+ }
49
+ }
50
+ });
37
51
  const finalConfig = merge(UserConfig, {
38
52
  locale: UserConfig.locale || locale,
39
53
  packageManager: UserConfig.packageManager || (await getPackageManager(cwd)),
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.MonorepoNewAction = void 0;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _lodash = require("@modern-js/utils/lodash");
9
11
 
10
12
  var _codesmith = require("@modern-js/codesmith");
@@ -15,6 +17,8 @@ var _generatorUtils = require("@modern-js/generator-utils");
15
17
 
16
18
  var _utils = require("./utils");
17
19
 
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
18
22
  const REPO_GENERATOR = '@modern-js/repo-generator';
19
23
 
20
24
  const MonorepoNewAction = async options => {
@@ -24,7 +28,7 @@ const MonorepoNewAction = async options => {
24
28
  debug = false,
25
29
  registry = '',
26
30
  config = '{}',
27
- plugins = [],
31
+ plugin = [],
28
32
  cwd = process.cwd()
29
33
  } = options;
30
34
  let UserConfig = {};
@@ -46,8 +50,21 @@ const MonorepoNewAction = async options => {
46
50
 
47
51
  if (!(0, _utils.alreadyRepo)(cwd)) {
48
52
  smith.logger.warn('not valid modern.js repo');
49
- }
50
-
53
+ } // Determine if the plugin is a Monorepo dependency
54
+
55
+
56
+ const plugins = plugin.map(plugin => {
57
+ try {
58
+ return _path.default.join(require.resolve(plugin), '../../');
59
+ } catch (e) {
60
+ try {
61
+ // 兼容旧版打包路径
62
+ return _path.default.join(require.resolve(plugin), '../../../../');
63
+ } catch (e) {
64
+ return plugin;
65
+ }
66
+ }
67
+ });
51
68
  const finalConfig = (0, _lodash.merge)(UserConfig, {
52
69
  locale: UserConfig.locale || locale,
53
70
  packageManager: UserConfig.packageManager || (await (0, _generatorUtils.getPackageManager)(cwd)),
@@ -4,7 +4,7 @@ interface IMonorepoNewActionOption {
4
4
  debug?: boolean;
5
5
  registry?: string;
6
6
  config?: string;
7
- plugins?: string[];
7
+ plugin?: string[];
8
8
  cwd?: string;
9
9
  }
10
10
  export declare const MonorepoNewAction: (options: IMonorepoNewActionOption) => Promise<void>;
package/package.json CHANGED
@@ -11,11 +11,10 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.3.11-alpha.0",
14
+ "version": "1.4.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
18
- "module": "./dist/js/treeshaking/index.js",
19
18
  "jsnext:modern": "./dist/js/modern/index.js",
20
19
  "exports": {
21
20
  ".": {
@@ -24,16 +23,16 @@
24
23
  "import": "./dist/js/modern/index.js",
25
24
  "require": "./dist/js/node/index.js"
26
25
  },
27
- "default": "./dist/js/treeshaking/index.js"
26
+ "default": "./dist/js/node/index.js"
28
27
  }
29
28
  },
30
29
  "dependencies": {
31
30
  "@babel/runtime": "^7.18.0",
32
- "@modern-js/codesmith": "^1.2.2",
33
- "@modern-js/codesmith-api-app": "^1.2.4",
34
- "@modern-js/generator-common": "^1.4.13-alpha.0",
35
- "@modern-js/generator-utils": "^1.2.7-alpha.0",
36
- "@modern-js/utils": "^1.7.9-alpha.0"
31
+ "@modern-js/codesmith": "^1.4.0",
32
+ "@modern-js/codesmith-api-app": "^1.3.0",
33
+ "@modern-js/generator-common": "^1.6.0",
34
+ "@modern-js/generator-utils": "^1.4.0",
35
+ "@modern-js/utils": "^1.8.0"
37
36
  },
38
37
  "devDependencies": {
39
38
  "@types/jest": "^27",