@modern-js/new-action 1.3.11 → 1.3.12

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,19 @@
1
1
  # @modern-js/new-action
2
2
 
3
+ ## 1.3.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 74e74ee: fix: monorepo-tools new command plugin params not work
8
+
9
+ fix: 修复 monorepo-tools new 命令 plugin 参数不生效问题
10
+
11
+ - Updated dependencies [72907b2]
12
+ - Updated dependencies [33cebd2]
13
+ - @modern-js/generator-common@1.5.0
14
+ - @modern-js/generator-utils@1.3.0
15
+ - @modern-js/utils@1.7.12
16
+
3
17
  ## 1.3.11
4
18
 
5
19
  ### Patch Changes
@@ -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,16 @@ 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
+ return plugin;
44
+ }
45
+ });
37
46
  const finalConfig = merge(UserConfig, {
38
47
  locale: UserConfig.locale || locale,
39
48
  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,16 @@ const MonorepoNewAction = async options => {
46
50
 
47
51
  if (!(0, _utils.alreadyRepo)(cwd)) {
48
52
  smith.logger.warn('not valid modern.js repo');
49
- }
53
+ } // Determine if the plugin is a Monorepo dependency
50
54
 
55
+
56
+ const plugins = plugin.map(plugin => {
57
+ try {
58
+ return _path.default.join(require.resolve(plugin), '../../../../');
59
+ } catch (e) {
60
+ return plugin;
61
+ }
62
+ });
51
63
  const finalConfig = (0, _lodash.merge)(UserConfig, {
52
64
  locale: UserConfig.locale || locale,
53
65
  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,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.3.11",
14
+ "version": "1.3.12",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -31,9 +31,9 @@
31
31
  "@babel/runtime": "^7.18.0",
32
32
  "@modern-js/codesmith": "^1.3.0",
33
33
  "@modern-js/codesmith-api-app": "^1.2.5",
34
- "@modern-js/generator-common": "^1.4.13",
35
- "@modern-js/generator-utils": "^1.2.7",
36
- "@modern-js/utils": "^1.7.9"
34
+ "@modern-js/generator-common": "^1.5.0",
35
+ "@modern-js/generator-utils": "^1.3.0",
36
+ "@modern-js/utils": "^1.7.12"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/jest": "^27",