@modern-js/monorepo-tools 1.4.1 → 1.4.4

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.
Files changed (41) hide show
  1. package/.eslintrc.js +8 -0
  2. package/CHANGELOG.md +69 -0
  3. package/dist/js/modern/dag/utils.js +0 -1
  4. package/dist/js/modern/features/build/index.js +2 -3
  5. package/dist/js/modern/features/deploy/index.js +3 -8
  6. package/dist/js/modern/features/dev/create-task.js +1 -2
  7. package/dist/js/modern/features/dev/index.js +1 -2
  8. package/dist/js/modern/features/dev/watch-projects-state.js +1 -1
  9. package/dist/js/modern/features/install/index.js +3 -7
  10. package/dist/js/modern/log/multi-tasks-log.js +1 -1
  11. package/dist/js/modern/log/time.js +1 -1
  12. package/dist/js/modern/parse-config/monorepo.js +1 -3
  13. package/dist/js/modern/projects/check-project-change.js +1 -2
  14. package/dist/js/modern/projects/get-projects-by-packages-config.js +1 -1
  15. package/dist/js/modern/projects/get-projects-by-workspace-file.js +13 -6
  16. package/dist/js/modern/utils/install.js +1 -2
  17. package/dist/js/node/dag/utils.js +0 -1
  18. package/dist/js/node/features/build/index.js +5 -7
  19. package/dist/js/node/features/deploy/index.js +6 -16
  20. package/dist/js/node/features/dev/create-task.js +2 -6
  21. package/dist/js/node/features/dev/index.js +3 -5
  22. package/dist/js/node/features/dev/watch-projects-state.js +2 -4
  23. package/dist/js/node/features/install/index.js +4 -11
  24. package/dist/js/node/log/multi-tasks-log.js +4 -4
  25. package/dist/js/node/log/time.js +2 -2
  26. package/dist/js/node/parse-config/monorepo.js +0 -3
  27. package/dist/js/node/projects/check-project-change.js +3 -4
  28. package/dist/js/node/projects/get-projects-by-packages-config.js +3 -3
  29. package/dist/js/node/projects/get-projects-by-workspace-file.js +16 -9
  30. package/dist/js/node/utils/install.js +2 -6
  31. package/dist/types/cli/build-watch.d.ts +1 -1
  32. package/dist/types/cli/build.d.ts +1 -1
  33. package/dist/types/cli/clear.d.ts +1 -1
  34. package/dist/types/cli/deploy.d.ts +1 -1
  35. package/dist/types/cli/install.d.ts +1 -1
  36. package/dist/types/cli/new.d.ts +1 -1
  37. package/dist/types/log/time.d.ts +2 -2
  38. package/jest.config.js +0 -1
  39. package/package.json +9 -18
  40. package/tests/index.test.ts +0 -7
  41. package/tests/tsconfig.json +0 -13
package/.eslintrc.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['@modern-js'],
4
+ parserOptions: {
5
+ tsconfigRootDir: __dirname,
6
+ project: ['./tsconfig.json'],
7
+ },
8
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,74 @@
1
1
  # @modern-js/monorepo-tools
2
2
 
3
+ ## 1.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 592edabc: feat: prebundle url-join,mime-types,json5,fast-glob,globby,ora,inquirer
8
+ - Updated dependencies [2d155c4c]
9
+ - Updated dependencies [123e432d]
10
+ - Updated dependencies [e5a9b26d]
11
+ - Updated dependencies [0b26b93b]
12
+ - Updated dependencies [123e432d]
13
+ - Updated dependencies [f9f66ef9]
14
+ - Updated dependencies [592edabc]
15
+ - Updated dependencies [895fa0ff]
16
+ - Updated dependencies [3578913e]
17
+ - Updated dependencies [1c3beab3]
18
+ - @modern-js/utils@1.6.0
19
+ - @modern-js/core@1.9.0
20
+ - @modern-js/new-action@1.3.7
21
+ - @modern-js/plugin-changeset@1.2.5
22
+
23
+ ## 1.4.3
24
+
25
+ ### Patch Changes
26
+
27
+ - 6cffe99d: chore:
28
+ remove react eslint rules for `modern-js` rule set.
29
+ add .eslintrc for each package to speed up linting
30
+ - 04ae5262: chore: bump @modern-js/utils to v1.4.1 in dependencies
31
+ - 60f7d8bf: feat: add tests dir to npmignore
32
+ - 305e0bb4: fix: commander.commandsMap typing not work
33
+ - 2888389b: add parse config for lerna
34
+ - Updated dependencies [a4330c73]
35
+ - Updated dependencies [b8599d09]
36
+ - Updated dependencies [6cffe99d]
37
+ - Updated dependencies [04ae5262]
38
+ - Updated dependencies [60f7d8bf]
39
+ - Updated dependencies [e4cec1ce]
40
+ - Updated dependencies [3b7aa8bb]
41
+ - Updated dependencies [5dbbeb57]
42
+ - Updated dependencies [ebfcbb35]
43
+ - Updated dependencies [3bf4f8b0]
44
+ - Updated dependencies [305e0bb4]
45
+ - @modern-js/core@1.8.0
46
+ - @modern-js/utils@1.5.0
47
+ - @modern-js/i18n-cli-language-detector@1.2.2
48
+ - @modern-js/plugin-changeset@1.2.5
49
+ - @modern-js/plugin-i18n@1.2.4
50
+ - @modern-js/new-action@1.3.6
51
+ - @modern-js/plugin@1.3.3
52
+
53
+ ## 1.4.2
54
+
55
+ ### Patch Changes
56
+
57
+ - 07a4887e: feat: prebundle commander and signale to @modern-js/utils
58
+ - Updated dependencies [60855eb2]
59
+ - Updated dependencies [ec1b7367]
60
+ - Updated dependencies [77ff9754]
61
+ - Updated dependencies [d2d1d6b2]
62
+ - Updated dependencies [07a4887e]
63
+ - Updated dependencies [ea2ae711]
64
+ - Updated dependencies [17d0cc46]
65
+ - Updated dependencies [d2d1d6b2]
66
+ - @modern-js/core@1.7.0
67
+ - @modern-js/utils@1.4.0
68
+ - @modern-js/plugin-i18n@1.2.3
69
+ - @modern-js/new-action@1.3.5
70
+ - @modern-js/plugin-changeset@1.2.4
71
+
3
72
  ## 1.4.1
4
73
 
5
74
  ### Patch Changes
@@ -62,7 +62,6 @@ export const recursiveGetDependency = (project, skipCircleProjects = false) => {
62
62
 
63
63
  return allDependency;
64
64
  }; // 拓扑排序
65
- // eslint-disable-next-line max-statements
66
65
 
67
66
  export const sortProjects = projects => {
68
67
  const sortedQueue = []; // 排好序的队列
@@ -1,6 +1,5 @@
1
1
  import os from 'os';
2
- import execa from 'execa';
3
- import signale from 'signale';
2
+ import { execa, signale } from '@modern-js/utils';
4
3
  import { checkProjectChangeByGit, checkProjectChangeByContent } from "../../projects/check-project-change";
5
4
  import { errorLog } from "../../log/error";
6
5
  import { MultitasksLogger } from "../../log/multi-tasks-log";
@@ -11,7 +10,7 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
11
10
  packageManager,
12
11
  disableContentHash = false,
13
12
  enableGitHash = false
14
- } = config; // eslint-disable-next-line max-statements
13
+ } = config;
15
14
 
16
15
  const task = async project => {
17
16
  console.info('run ', project.name); // const taskTimeLog = timeLog.initTimeLog({ scope: '' });
@@ -1,9 +1,6 @@
1
1
  import * as path from 'path';
2
2
  import { FileSystem, JsonFile } from '@rushstack/node-core-library';
3
- import execa from 'execa';
4
- import { success } from 'signale';
5
- import yaml from 'js-yaml';
6
- import { fs, logger, chalk } from '@modern-js/utils';
3
+ import { fs, yaml, execa, logger, chalk, signale } from '@modern-js/utils';
7
4
  import { WORKSPACE_FILE } from "../../constants";
8
5
 
9
6
  const createCopyMap = (rootPath, targetProject, copyProjects, deployDir) => {
@@ -39,13 +36,11 @@ const checkAndUpdatePMWorkspaces = deployDir => {
39
36
  const pnpmWp = path.join(deployDir, WORKSPACE_FILE.PNPM);
40
37
 
41
38
  if (fs.existsSync(pnpmWp)) {
42
- // eslint-disable-next-line import/no-named-as-default-member
43
39
  const pnpmWorkspace = yaml.load(fs.readFileSync(pnpmWp, 'utf-8'));
44
40
 
45
41
  if (pnpmWorkspace.packages && Array.isArray(pnpmWorkspace.packages)) {
46
42
  pnpmWorkspace.packages.push('apps/**');
47
- } // eslint-disable-next-line import/no-named-as-default-member
48
-
43
+ }
49
44
 
50
45
  fs.writeFileSync(pnpmWp, yaml.dump(pnpmWorkspace));
51
46
  }
@@ -175,5 +170,5 @@ export const deploy = async (deployProjectNames, operator, config) => {
175
170
 
176
171
  generatorAndCopyRequiredFiles(rootPath, realDeployPath); // await installDependency(realDeployPath, packageManager);
177
172
 
178
- success(`Deploy success. The deploy dir is in '${rootPath}/output'`);
173
+ signale.success(`Deploy success. The deploy dir is in '${rootPath}/output'`);
179
174
  };
@@ -1,5 +1,4 @@
1
- import execa from 'execa';
2
- import { logger } from '@modern-js/utils';
1
+ import { execa, logger } from '@modern-js/utils';
3
2
  import { errorLog } from "../../log/error";
4
3
  import * as timeLog from "../../log/time";
5
4
  import { defaultBuildWatchCmds } from "./cmds";
@@ -1,10 +1,9 @@
1
- import { Import } from '@rushstack/node-core-library';
2
1
  import anymatch from 'anymatch';
2
+ import { chokidar } from '@modern-js/utils';
3
3
  import { MultitasksLogger } from "../../log/multi-tasks-log";
4
4
  import { WatchedProjectsState } from "./watch-projects-state";
5
5
  import { defaultBuildWatchCmds } from "./cmds";
6
6
  import { createDependenciesTask, createDevTask } from "./create-task";
7
- const chokidar = Import.lazy('chokidar', require);
8
7
 
9
8
  const getIgnored = config => watchFilePath => {
10
9
  // 默认忽略 node_modules 的变化和 dist 目录下文件的变化
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import * as path from 'path';
8
- import globby from 'globby';
8
+ import { globby } from '@modern-js/utils';
9
9
  export class WatchedProjectsState {
10
10
  constructor(fromNodes, config) {
11
11
  this._config = void 0;
@@ -1,6 +1,5 @@
1
1
  import * as path from 'path';
2
- import { fs } from '@modern-js/utils';
3
- import yaml from 'js-yaml';
2
+ import { fs, yaml } from '@modern-js/utils';
4
3
  import { JsonFile } from '@rushstack/node-core-library';
5
4
  import { WORKSPACE_FILE } from "../../constants";
6
5
  import { installByPackageManager } from "../../utils/install";
@@ -13,15 +12,12 @@ const replaceWorkspaces = ({
13
12
  const pnpmWsFilePath = path.join(rootPath, WORKSPACE_FILE.PNPM);
14
13
 
15
14
  if (fs.existsSync(pnpmWsFilePath)) {
16
- const pnpmWorkspace = fs.readFileSync(pnpmWsFilePath, 'utf-8'); // eslint-disable-next-line import/no-named-as-default-member
17
-
15
+ const pnpmWorkspace = fs.readFileSync(pnpmWsFilePath, 'utf-8');
18
16
  const orignalPnpmWorkspaces = yaml.load(pnpmWorkspace);
19
- fs.writeFileSync(pnpmWsFilePath, // eslint-disable-next-line import/no-named-as-default-member
20
- yaml.dump({
17
+ fs.writeFileSync(pnpmWsFilePath, yaml.dump({
21
18
  packages: projectsInWorkspacs
22
19
  }));
23
20
  return () => {
24
- // eslint-disable-next-line import/no-named-as-default-member
25
21
  yaml.dump(orignalPnpmWorkspaces);
26
22
  };
27
23
  }
@@ -1,4 +1,4 @@
1
- import { Signale } from 'signale';
1
+ import { Signale } from '@modern-js/utils';
2
2
  import { formatLog } from "./utils";
3
3
 
4
4
  const createLogger = (name, config) => {
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import { Signale } from 'signale';
7
+ import { Signale } from '@modern-js/utils';
8
8
  export const initTimeLog = (option = {}) => new Signale(_objectSpread({
9
9
  interactive: true,
10
10
  scope: 'time-log'
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import * as path from 'path';
3
2
  import { FileSystem, JsonFile } from '@rushstack/node-core-library';
4
3
  import { WORKSPACE_FILE } from "../constants";
@@ -109,5 +108,4 @@ export const getMonorepoBaseData = (root = process.cwd()) => {
109
108
  rootPath,
110
109
  packageManager: getPackageManager(rootPath)
111
110
  };
112
- };
113
- /* eslint-enable react-hooks/rules-of-hooks */
111
+ };
@@ -1,8 +1,7 @@
1
1
  import * as path from 'path';
2
2
  import { FileSystem, JsonFile, Sort } from '@rushstack/node-core-library';
3
3
  import { getGitHashForFiles } from '@rushstack/package-deps-hash';
4
- import globby from 'globby'; // import type { GlobbyOptions } from 'globby';
5
-
4
+ import { globby } from '@modern-js/utils';
6
5
  import md5 from 'md5';
7
6
  export const PROJECT_CONTENT_FILE_NAME = 'project-content.json';
8
7
  export const MONOREPO_GIT_FILE_NAME = 'monorepo-git.json';
@@ -6,7 +6,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import * as path from 'path';
8
8
  import { PackageJsonLookup } from '@rushstack/node-core-library';
9
- import globby from 'globby';
9
+ import { globby } from '@modern-js/utils';
10
10
  import pMap from 'p-map';
11
11
  import { errorLog } from "../log/error";
12
12
  import { Package } from "../package";
@@ -1,7 +1,6 @@
1
1
  import * as path from 'path';
2
2
  import { FileSystem, JsonFile } from '@rushstack/node-core-library';
3
- import { fs } from '@modern-js/utils';
4
- import yaml from 'js-yaml';
3
+ import { fs, yaml } from '@modern-js/utils';
5
4
  import { getWorkspaceFile } from "../parse-config/monorepo";
6
5
  import { WORKSPACE_FILE } from "../constants";
7
6
  import { getProjetsByPackageConfig, syncGetProjetsByPackageConfig } from "./get-projects-by-packages-config";
@@ -23,8 +22,7 @@ export const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs
23
22
  let packagesConfig = [];
24
23
 
25
24
  if (workspaceFile === WORKSPACE_FILE.PNPM) {
26
- const yamlString = await FileSystem.readFileAsync(path.resolve('/', rootPath, workspaceFile)).then(data => data.toString()); // eslint-disable-next-line import/no-named-as-default-member
27
-
25
+ const yamlString = await FileSystem.readFileAsync(path.resolve('/', rootPath, workspaceFile)).then(data => data.toString());
28
26
  const pnpmWorkspace = yaml.load(yamlString);
29
27
  packagesConfig = pnpmWorkspace.packages || [];
30
28
  } else if (workspaceFile === WORKSPACE_FILE.YARN) {
@@ -32,6 +30,11 @@ export const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs
32
30
 
33
31
  const pkgJson = JsonFile.load(path.resolve(rootPath, workspaceFile));
34
32
  packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson$workspaces = pkgJson.workspaces) === null || _pkgJson$workspaces === void 0 ? void 0 : _pkgJson$workspaces.packages) || [];
33
+ } else if (workspaceFile === WORKSPACE_FILE.LERNA) {
34
+ var _lernaJson$packages;
35
+
36
+ const lernaJson = JsonFile.load(path.resolve(rootPath, workspaceFile));
37
+ packagesConfig = (_lernaJson$packages = lernaJson.packages) !== null && _lernaJson$packages !== void 0 ? _lernaJson$packages : [];
35
38
  }
36
39
 
37
40
  const projects = await getProjetsByPackageConfig(rootPath, packagesConfig, ignoreConfigs);
@@ -55,8 +58,7 @@ export const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs)
55
58
  let packagesConfig = [];
56
59
 
57
60
  if (workspaceFile === WORKSPACE_FILE.PNPM) {
58
- const yamlString = fs.readFileSync(path.resolve('/', rootPath, workspaceFile), 'utf-8'); // eslint-disable-next-line import/no-named-as-default-member
59
-
61
+ const yamlString = fs.readFileSync(path.resolve('/', rootPath, workspaceFile), 'utf-8');
60
62
  const pnpmWorkspace = yaml.load(yamlString);
61
63
  packagesConfig = pnpmWorkspace.packages || [];
62
64
  } else if (workspaceFile === WORKSPACE_FILE.YARN) {
@@ -64,6 +66,11 @@ export const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs)
64
66
 
65
67
  const pkgJson = JsonFile.load(path.resolve(rootPath, workspaceFile));
66
68
  packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson$workspaces2 = pkgJson.workspaces) === null || _pkgJson$workspaces2 === void 0 ? void 0 : _pkgJson$workspaces2.packages) || [];
69
+ } else if (workspaceFile === WORKSPACE_FILE.LERNA) {
70
+ var _lernaJson$packages2;
71
+
72
+ const lernaJson = JsonFile.load(path.resolve(rootPath, workspaceFile));
73
+ packagesConfig = (_lernaJson$packages2 = lernaJson.packages) !== null && _lernaJson$packages2 !== void 0 ? _lernaJson$packages2 : [];
67
74
  }
68
75
 
69
76
  const projects = syncGetProjetsByPackageConfig(rootPath, packagesConfig, ignoreConfigs);
@@ -1,6 +1,5 @@
1
1
  import * as path from 'path';
2
- import { fs } from '@modern-js/utils';
3
- import execa from 'execa';
2
+ import { fs, execa } from '@modern-js/utils';
4
3
  import { LOCK_FILE } from "../constants";
5
4
  export const removeLockFile = (rootPath, packageManager) => {
6
5
  if (packageManager === 'pnpm') {
@@ -72,7 +72,6 @@ const recursiveGetDependency = (project, skipCircleProjects = false) => {
72
72
 
73
73
  return allDependency;
74
74
  }; // 拓扑排序
75
- // eslint-disable-next-line max-statements
76
75
 
77
76
 
78
77
  exports.recursiveGetDependency = recursiveGetDependency;
@@ -7,9 +7,7 @@ exports.runBuildTask = exports.runAllBuildTask = void 0;
7
7
 
8
8
  var _os = _interopRequireDefault(require("os"));
9
9
 
10
- var _execa = _interopRequireDefault(require("execa"));
11
-
12
- var _signale = _interopRequireDefault(require("signale"));
10
+ var _utils = require("@modern-js/utils");
13
11
 
14
12
  var _checkProjectChange = require("../../projects/check-project-change");
15
13
 
@@ -25,7 +23,7 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
25
23
  packageManager,
26
24
  disableContentHash = false,
27
25
  enableGitHash = false
28
- } = config; // eslint-disable-next-line max-statements
26
+ } = config;
29
27
 
30
28
  const task = async project => {
31
29
  console.info('run ', project.name); // const taskTimeLog = timeLog.initTimeLog({ scope: '' });
@@ -56,10 +54,10 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
56
54
  if (cmd[taskCmd]) {
57
55
  const prefix = `run ${project.name} ${taskCmd} script`; // timeLog.startTime(taskTimeLog, prefix);
58
56
 
59
- _signale.default.time(prefix);
57
+ _utils.signale.time(prefix);
60
58
 
61
59
  try {
62
- const childProcess = (0, _execa.default)(packageManager, [taskCmd], {
60
+ const childProcess = (0, _utils.execa)(packageManager, [taskCmd], {
63
61
  cwd: project.extra.path,
64
62
  stdio: ['pipe', 'pipe', 'pipe']
65
63
  });
@@ -72,7 +70,7 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
72
70
  });
73
71
  await childProcess; // timeLog.endTime(taskTimeLog, prefix);
74
72
 
75
- _signale.default.timeEnd(prefix);
73
+ _utils.signale.timeEnd(prefix);
76
74
  } catch (e) {
77
75
  (0, _error.errorLog)(project.name, e.message);
78
76
  }
@@ -9,18 +9,10 @@ var path = _interopRequireWildcard(require("path"));
9
9
 
10
10
  var _nodeCoreLibrary = require("@rushstack/node-core-library");
11
11
 
12
- var _execa = _interopRequireDefault(require("execa"));
13
-
14
- var _signale = require("signale");
15
-
16
- var _jsYaml = _interopRequireDefault(require("js-yaml"));
17
-
18
12
  var _utils = require("@modern-js/utils");
19
13
 
20
14
  var _constants = require("../../constants");
21
15
 
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
17
 
26
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -58,15 +50,13 @@ const checkAndUpdatePMWorkspaces = deployDir => {
58
50
  const pnpmWp = path.join(deployDir, _constants.WORKSPACE_FILE.PNPM);
59
51
 
60
52
  if (_utils.fs.existsSync(pnpmWp)) {
61
- // eslint-disable-next-line import/no-named-as-default-member
62
- const pnpmWorkspace = _jsYaml.default.load(_utils.fs.readFileSync(pnpmWp, 'utf-8'));
53
+ const pnpmWorkspace = _utils.yaml.load(_utils.fs.readFileSync(pnpmWp, 'utf-8'));
63
54
 
64
55
  if (pnpmWorkspace.packages && Array.isArray(pnpmWorkspace.packages)) {
65
56
  pnpmWorkspace.packages.push('apps/**');
66
- } // eslint-disable-next-line import/no-named-as-default-member
67
-
57
+ }
68
58
 
69
- _utils.fs.writeFileSync(pnpmWp, _jsYaml.default.dump(pnpmWorkspace));
59
+ _utils.fs.writeFileSync(pnpmWp, _utils.yaml.dump(pnpmWorkspace));
70
60
  }
71
61
 
72
62
  const pkgPath = path.join(deployDir, _constants.WORKSPACE_FILE.YARN);
@@ -116,7 +106,7 @@ const checkAndRunDeployCommand = async (monorepoPath, targetProject, packageMana
116
106
  }
117
107
 
118
108
  const cwd = packageManager === 'npm' ? targetProject.extra.path : monorepoPath;
119
- const childProcess = (0, _execa.default)(packageManager, runDeployCommands, {
109
+ const childProcess = (0, _utils.execa)(packageManager, runDeployCommands, {
120
110
  cwd,
121
111
  stdio: ['pipe']
122
112
  });
@@ -148,7 +138,7 @@ const installDependency = async (deployDir, packageManager) => {
148
138
 
149
139
  _utils.logger.log(_utils.chalk.rgb(218, 152, 92)('Install Log:\n'));
150
140
 
151
- const childProcess = (0, _execa.default)(packageManager, commands, {
141
+ const childProcess = (0, _utils.execa)(packageManager, commands, {
152
142
  stdio: 'inherit',
153
143
  cwd: deployDir,
154
144
  env: {
@@ -205,7 +195,7 @@ const deploy = async (deployProjectNames, operator, config) => {
205
195
 
206
196
  generatorAndCopyRequiredFiles(rootPath, realDeployPath); // await installDependency(realDeployPath, packageManager);
207
197
 
208
- (0, _signale.success)(`Deploy success. The deploy dir is in '${rootPath}/output'`);
198
+ _utils.signale.success(`Deploy success. The deploy dir is in '${rootPath}/output'`);
209
199
  };
210
200
 
211
201
  exports.deploy = deploy;
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createDevTask = exports.createDependenciesTask = void 0;
7
7
 
8
- var _execa = _interopRequireDefault(require("execa"));
9
-
10
8
  var _utils = require("@modern-js/utils");
11
9
 
12
10
  var _error = require("../../log/error");
@@ -19,8 +17,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
17
 
20
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
19
 
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
20
  const getFinalTaskCmds = (taskCmds, project) => {
25
21
  let finalTaskCmds = []; // case1: ["build"]
26
22
  // case2: ["dev", "build"]
@@ -57,7 +53,7 @@ const createDependenciesTask = (config, taskCmds = _cmds.defaultBuildWatchCmds,
57
53
  timeLog.startTime(timelogInstance, prefix);
58
54
 
59
55
  try {
60
- const childProcess = (0, _execa.default)(packageManager, [taskCmd], {
56
+ const childProcess = (0, _utils.execa)(packageManager, [taskCmd], {
61
57
  cwd: project.extra.path,
62
58
  stdio: ['pipe', 'pipe', 'pipe']
63
59
  });
@@ -99,7 +95,7 @@ const createDevTask = (config, taskCmds = _cmds.defaultBuildWatchCmds, taskLogge
99
95
  // const prefix = `run ${project.name} ${taskCmd} script`;
100
96
  // log.info(prefix);
101
97
  try {
102
- const childProcess = (0, _execa.default)(packageManager, [taskCmd], {
98
+ const childProcess = (0, _utils.execa)(packageManager, [taskCmd], {
103
99
  cwd: project.extra.path,
104
100
  stdio: 'pipe',
105
101
  all: true
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.runBuildWatchTask = void 0;
7
7
 
8
- var _nodeCoreLibrary = require("@rushstack/node-core-library");
9
-
10
8
  var _anymatch = _interopRequireDefault(require("anymatch"));
11
9
 
10
+ var _utils = require("@modern-js/utils");
11
+
12
12
  var _multiTasksLog = require("../../log/multi-tasks-log");
13
13
 
14
14
  var _watchProjectsState = require("./watch-projects-state");
@@ -19,8 +19,6 @@ var _createTask = require("./create-task");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- const chokidar = _nodeCoreLibrary.Import.lazy('chokidar', require);
23
-
24
22
  const getIgnored = config => watchFilePath => {
25
23
  // 默认忽略 node_modules 的变化和 dist 目录下文件的变化
26
24
  const nodeModulesPattern = /(?:^|[\\/])node_modules/g;
@@ -45,7 +43,7 @@ const runBuildWatchTask = async (projectName, operator, config, taskCmds = _cmds
45
43
  const devTask = (0, _createTask.createDevTask)(config, taskCmds, taskLogger);
46
44
  const fromNodes = operator.getNodeAllDependencyData(projectName);
47
45
  const watchedProjectState = new _watchProjectsState.WatchedProjectsState(fromNodes, config);
48
- const watcher = new chokidar.FSWatcher({
46
+ const watcher = new _utils.chokidar.FSWatcher({
49
47
  persistent: true,
50
48
  cwd: config.rootPath,
51
49
  followSymlinks: false,
@@ -7,9 +7,7 @@ exports.WatchedProjectsState = void 0;
7
7
 
8
8
  var path = _interopRequireWildcard(require("path"));
9
9
 
10
- var _globby = _interopRequireDefault(require("globby"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ var _utils = require("@modern-js/utils");
13
11
 
14
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
13
 
@@ -44,7 +42,7 @@ class WatchedProjectsState {
44
42
  ignore: ['**/node_modules/**', '.project-memory/**', 'dist/**']
45
43
  };
46
44
  this._watchProjects = this._fromNodes.reduce((ret, node) => {
47
- const files = _globby.default.sync(`${node.extra.path}/**`, globOption);
45
+ const files = _utils.globby.sync(`${node.extra.path}/**`, globOption);
48
46
 
49
47
  for (const filePath of files) {
50
48
  this._projectsFileMap.set(path.relative(this._config.rootPath, filePath), node.extra.path);
@@ -9,16 +9,12 @@ var path = _interopRequireWildcard(require("path"));
9
9
 
10
10
  var _utils = require("@modern-js/utils");
11
11
 
12
- var _jsYaml = _interopRequireDefault(require("js-yaml"));
13
-
14
12
  var _nodeCoreLibrary = require("@rushstack/node-core-library");
15
13
 
16
14
  var _constants = require("../../constants");
17
15
 
18
16
  var _install = require("../../utils/install");
19
17
 
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
19
 
24
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -31,19 +27,16 @@ const replaceWorkspaces = ({
31
27
  const pnpmWsFilePath = path.join(rootPath, _constants.WORKSPACE_FILE.PNPM);
32
28
 
33
29
  if (_utils.fs.existsSync(pnpmWsFilePath)) {
34
- const pnpmWorkspace = _utils.fs.readFileSync(pnpmWsFilePath, 'utf-8'); // eslint-disable-next-line import/no-named-as-default-member
35
-
30
+ const pnpmWorkspace = _utils.fs.readFileSync(pnpmWsFilePath, 'utf-8');
36
31
 
37
- const orignalPnpmWorkspaces = _jsYaml.default.load(pnpmWorkspace);
32
+ const orignalPnpmWorkspaces = _utils.yaml.load(pnpmWorkspace);
38
33
 
39
- _utils.fs.writeFileSync(pnpmWsFilePath, // eslint-disable-next-line import/no-named-as-default-member
40
- _jsYaml.default.dump({
34
+ _utils.fs.writeFileSync(pnpmWsFilePath, _utils.yaml.dump({
41
35
  packages: projectsInWorkspacs
42
36
  }));
43
37
 
44
38
  return () => {
45
- // eslint-disable-next-line import/no-named-as-default-member
46
- _jsYaml.default.dump(orignalPnpmWorkspaces);
39
+ _utils.yaml.dump(orignalPnpmWorkspaces);
47
40
  };
48
41
  }
49
42
 
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.MultitasksLogger = void 0;
7
7
 
8
- var _signale = require("signale");
8
+ var _utils = require("@modern-js/utils");
9
9
 
10
- var _utils = require("./utils");
10
+ var _utils2 = require("./utils");
11
11
 
12
12
  const createLogger = (name, config) => {
13
13
  const options = {
@@ -20,7 +20,7 @@ const createLogger = (name, config) => {
20
20
  }
21
21
  }
22
22
  };
23
- return new _signale.Signale(options);
23
+ return new _utils.Signale(options);
24
24
  };
25
25
 
26
26
  const createListenHandler = (name, config) => {
@@ -29,7 +29,7 @@ const createListenHandler = (name, config) => {
29
29
 
30
30
  const stdout = chunk => {
31
31
  // console.info(chunk.toString().split(/\r\n|\n\r|\r|\n/g).length);
32
- logger.info((0, _utils.formatLog)(chunk.toString()));
32
+ logger.info((0, _utils2.formatLog)(chunk.toString()));
33
33
  }; // eslint-disable-next-line node/prefer-global/buffer
34
34
 
35
35
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.startTime = exports.initTimeLog = exports.endTime = void 0;
7
7
 
8
- var _signale = require("signale");
8
+ var _utils = require("@modern-js/utils");
9
9
 
10
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
11
 
@@ -13,7 +13,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
13
13
 
14
14
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
15
 
16
- const initTimeLog = (option = {}) => new _signale.Signale(_objectSpread({
16
+ const initTimeLog = (option = {}) => new _utils.Signale(_objectSpread({
17
17
  interactive: true,
18
18
  scope: 'time-log'
19
19
  }, option));
@@ -15,7 +15,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- /* eslint-disable react-hooks/rules-of-hooks */
19
18
  const useLerna = monorepoRootPath => {
20
19
  if (_nodeCoreLibrary.FileSystem.exists(path.join(monorepoRootPath, _constants.WORKSPACE_FILE.LERNA))) {
21
20
  return true;
@@ -132,7 +131,5 @@ const getMonorepoBaseData = (root = process.cwd()) => {
132
131
  packageManager: getPackageManager(rootPath)
133
132
  };
134
133
  };
135
- /* eslint-enable react-hooks/rules-of-hooks */
136
-
137
134
 
138
135
  exports.getMonorepoBaseData = getMonorepoBaseData;
@@ -11,7 +11,7 @@ var _nodeCoreLibrary = require("@rushstack/node-core-library");
11
11
 
12
12
  var _packageDepsHash = require("@rushstack/package-deps-hash");
13
13
 
14
- var _globby = _interopRequireDefault(require("globby"));
14
+ var _utils = require("@modern-js/utils");
15
15
 
16
16
  var _md = _interopRequireDefault(require("md5"));
17
17
 
@@ -21,7 +21,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
 
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
 
24
- // import type { GlobbyOptions } from 'globby';
25
24
  const PROJECT_CONTENT_FILE_NAME = 'project-content.json';
26
25
  exports.PROJECT_CONTENT_FILE_NAME = PROJECT_CONTENT_FILE_NAME;
27
26
  const MONOREPO_GIT_FILE_NAME = 'monorepo-git.json';
@@ -39,7 +38,7 @@ const getProjectGitHash = async project => {
39
38
  ignore: ['**/node_modules/**', '.project-memory/**', 'dist/**']
40
39
  };
41
40
  const globPattern = `${projectDir}/**`;
42
- const files = await (0, _globby.default)(path.posix.join(globPattern), globOption);
41
+ const files = await (0, _utils.globby)(path.posix.join(globPattern), globOption);
43
42
  const hashMap = (0, _packageDepsHash.getGitHashForFiles)(files, projectDir);
44
43
  const hashObject = {}; // sort is important
45
44
 
@@ -88,7 +87,7 @@ const getProjectContentHashObjectForFiles = async project => {
88
87
  ignore: ['**/node_modules/**', '.project-memory/**', '**/dist/**']
89
88
  };
90
89
  const globPattern = `${projectDir}/**`;
91
- const files = await (0, _globby.default)(path.posix.join(globPattern), globOption);
90
+ const files = await (0, _utils.globby)(path.posix.join(globPattern), globOption);
92
91
  const hashObject = {}; // sort is important
93
92
 
94
93
  for (const file of files.sort()) {
@@ -9,7 +9,7 @@ var path = _interopRequireWildcard(require("path"));
9
9
 
10
10
  var _nodeCoreLibrary = require("@rushstack/node-core-library");
11
11
 
12
- var _globby = _interopRequireDefault(require("globby"));
12
+ var _utils = require("@modern-js/utils");
13
13
 
14
14
  var _pMap = _interopRequireDefault(require("p-map"));
15
15
 
@@ -58,7 +58,7 @@ const makeFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
58
58
  const options = _objectSpread(_objectSpread({}, customGlobOpts), globOpts);
59
59
 
60
60
  const promise = (0, _pMap.default)(Array.from(packageConfigs).sort(), async globPath => {
61
- let result = await (0, _globby.default)(path.posix.join(globPath, fileName), options); // fast-glob does not respect pattern order, so we re-sort by absolute path
61
+ let result = await (0, _utils.globby)(path.posix.join(globPath, fileName), options); // fast-glob does not respect pattern order, so we re-sort by absolute path
62
62
 
63
63
  result = result.sort(); // POSIX results always need to be normalized
64
64
 
@@ -101,7 +101,7 @@ const makeSyncFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
101
101
  const options = _objectSpread(_objectSpread({}, customGlobOpts), globOpts);
102
102
 
103
103
  for (const globPath of Array.from(packageConfigs).sort()) {
104
- let result = _globby.default.sync(path.posix.join(globPath, fileName), options); // fast-glob does not respect pattern order, so we re-sort by absolute path
104
+ let result = _utils.globby.sync(path.posix.join(globPath, fileName), options); // fast-glob does not respect pattern order, so we re-sort by absolute path
105
105
 
106
106
 
107
107
  result = result.sort(); // POSIX results always need to be normalized
@@ -11,16 +11,12 @@ var _nodeCoreLibrary = require("@rushstack/node-core-library");
11
11
 
12
12
  var _utils = require("@modern-js/utils");
13
13
 
14
- var _jsYaml = _interopRequireDefault(require("js-yaml"));
15
-
16
14
  var _monorepo = require("../parse-config/monorepo");
17
15
 
18
16
  var _constants = require("../constants");
19
17
 
20
18
  var _getProjectsByPackagesConfig = require("./get-projects-by-packages-config");
21
19
 
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
21
 
26
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -43,9 +39,9 @@ const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
43
39
  let packagesConfig = [];
44
40
 
45
41
  if (workspaceFile === _constants.WORKSPACE_FILE.PNPM) {
46
- const yamlString = await _nodeCoreLibrary.FileSystem.readFileAsync(path.resolve('/', rootPath, workspaceFile)).then(data => data.toString()); // eslint-disable-next-line import/no-named-as-default-member
42
+ const yamlString = await _nodeCoreLibrary.FileSystem.readFileAsync(path.resolve('/', rootPath, workspaceFile)).then(data => data.toString());
47
43
 
48
- const pnpmWorkspace = _jsYaml.default.load(yamlString);
44
+ const pnpmWorkspace = _utils.yaml.load(yamlString);
49
45
 
50
46
  packagesConfig = pnpmWorkspace.packages || [];
51
47
  } else if (workspaceFile === _constants.WORKSPACE_FILE.YARN) {
@@ -54,6 +50,12 @@ const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
54
50
  const pkgJson = _nodeCoreLibrary.JsonFile.load(path.resolve(rootPath, workspaceFile));
55
51
 
56
52
  packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson$workspaces = pkgJson.workspaces) === null || _pkgJson$workspaces === void 0 ? void 0 : _pkgJson$workspaces.packages) || [];
53
+ } else if (workspaceFile === _constants.WORKSPACE_FILE.LERNA) {
54
+ var _lernaJson$packages;
55
+
56
+ const lernaJson = _nodeCoreLibrary.JsonFile.load(path.resolve(rootPath, workspaceFile));
57
+
58
+ packagesConfig = (_lernaJson$packages = lernaJson.packages) !== null && _lernaJson$packages !== void 0 ? _lernaJson$packages : [];
57
59
  }
58
60
 
59
61
  const projects = await (0, _getProjectsByPackagesConfig.getProjetsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
@@ -80,10 +82,9 @@ const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
80
82
  let packagesConfig = [];
81
83
 
82
84
  if (workspaceFile === _constants.WORKSPACE_FILE.PNPM) {
83
- const yamlString = _utils.fs.readFileSync(path.resolve('/', rootPath, workspaceFile), 'utf-8'); // eslint-disable-next-line import/no-named-as-default-member
85
+ const yamlString = _utils.fs.readFileSync(path.resolve('/', rootPath, workspaceFile), 'utf-8');
84
86
 
85
-
86
- const pnpmWorkspace = _jsYaml.default.load(yamlString);
87
+ const pnpmWorkspace = _utils.yaml.load(yamlString);
87
88
 
88
89
  packagesConfig = pnpmWorkspace.packages || [];
89
90
  } else if (workspaceFile === _constants.WORKSPACE_FILE.YARN) {
@@ -92,6 +93,12 @@ const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
92
93
  const pkgJson = _nodeCoreLibrary.JsonFile.load(path.resolve(rootPath, workspaceFile));
93
94
 
94
95
  packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson$workspaces2 = pkgJson.workspaces) === null || _pkgJson$workspaces2 === void 0 ? void 0 : _pkgJson$workspaces2.packages) || [];
96
+ } else if (workspaceFile === _constants.WORKSPACE_FILE.LERNA) {
97
+ var _lernaJson$packages2;
98
+
99
+ const lernaJson = _nodeCoreLibrary.JsonFile.load(path.resolve(rootPath, workspaceFile));
100
+
101
+ packagesConfig = (_lernaJson$packages2 = lernaJson.packages) !== null && _lernaJson$packages2 !== void 0 ? _lernaJson$packages2 : [];
95
102
  }
96
103
 
97
104
  const projects = (0, _getProjectsByPackagesConfig.syncGetProjetsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
@@ -9,12 +9,8 @@ var path = _interopRequireWildcard(require("path"));
9
9
 
10
10
  var _utils = require("@modern-js/utils");
11
11
 
12
- var _execa = _interopRequireDefault(require("execa"));
13
-
14
12
  var _constants = require("../constants");
15
13
 
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
15
 
20
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -40,13 +36,13 @@ const installByPackageManager = async (packageManager, {
40
36
  }
41
37
 
42
38
  if (packageManager === 'pnpm') {
43
- await (0, _execa.default)('pnpm', ['install'], {
39
+ await (0, _utils.execa)('pnpm', ['install'], {
44
40
  stdio: 'inherit'
45
41
  });
46
42
  }
47
43
 
48
44
  if (packageManager === 'yarn') {
49
- await (0, _execa.default)('yarn', ['install'], {
45
+ await (0, _utils.execa)('yarn', ['install'], {
50
46
  stdio: 'inherit'
51
47
  });
52
48
  }
@@ -1,3 +1,3 @@
1
1
  import type { PluginAPI } from '@modern-js/core';
2
- import { Command } from 'commander';
2
+ import type { Command } from '@modern-js/utils';
3
3
  export declare const buildWatchCli: (program: Command, api: PluginAPI) => void;
@@ -1,3 +1,3 @@
1
1
  import type { PluginAPI } from '@modern-js/core';
2
- import { Command } from 'commander';
2
+ import type { Command } from '@modern-js/utils';
3
3
  export declare const buildCli: (program: Command, api: PluginAPI) => void;
@@ -1,3 +1,3 @@
1
- import { Command } from 'commander';
1
+ import type { Command } from '@modern-js/utils';
2
2
  import type { PluginAPI } from '@modern-js/core';
3
3
  export declare const clearCli: (program: Command, api: PluginAPI) => void;
@@ -1,3 +1,3 @@
1
- import { Command } from 'commander';
1
+ import type { Command } from '@modern-js/utils';
2
2
  import type { PluginAPI } from '@modern-js/core';
3
3
  export declare const deployCli: (program: Command, api: PluginAPI) => void;
@@ -1,3 +1,3 @@
1
1
  import type { PluginAPI } from '@modern-js/core';
2
- import { Command } from 'commander';
2
+ import type { Command } from '@modern-js/utils';
3
3
  export declare const installCli: (program: Command, api: PluginAPI) => void;
@@ -1,2 +1,2 @@
1
- import { Command } from 'commander';
1
+ import type { Command } from '@modern-js/utils';
2
2
  export declare const newCli: (program: Command, locale?: string | undefined) => void;
@@ -1,4 +1,4 @@
1
- import signale, { Signale } from 'signale';
2
- export declare const initTimeLog: (option?: signale.SignaleOptions) => signale.Signale<signale.DefaultMethods>;
1
+ import { Signale, SignaleOptions } from '@modern-js/utils';
2
+ export declare const initTimeLog: (option?: SignaleOptions) => import("@modern-js/utils/compiled/signale").Signale<import("@modern-js/utils/compiled/signale").DefaultMethods>;
3
3
  export declare const startTime: (signaleInstance: Signale, prefix?: string) => void;
4
4
  export declare const endTime: (signaleInstance: Signale, prefix?: string) => void;
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.1",
14
+ "version": "1.4.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -35,37 +35,28 @@
35
35
  "modern": "./bin/modern.js"
36
36
  },
37
37
  "dependencies": {
38
- "@modern-js/core": "^1.6.0",
38
+ "@modern-js/core": "^1.9.0",
39
39
  "@babel/runtime": "^7",
40
- "@modern-js/i18n-cli-language-detector": "^1.2.1",
41
- "@modern-js/new-action": "^1.3.3",
42
- "@modern-js/plugin": "^1.3.2",
43
- "@modern-js/plugin-changeset": "^1.2.3",
44
- "@modern-js/plugin-i18n": "^1.2.1",
45
- "@modern-js/utils": "^1.3.6",
40
+ "@modern-js/i18n-cli-language-detector": "^1.2.2",
41
+ "@modern-js/new-action": "^1.3.7",
42
+ "@modern-js/plugin": "^1.3.3",
43
+ "@modern-js/plugin-changeset": "^1.2.5",
44
+ "@modern-js/plugin-i18n": "^1.2.4",
45
+ "@modern-js/utils": "^1.6.0",
46
46
  "@rushstack/node-core-library": "^3.39.1",
47
47
  "@rushstack/package-deps-hash": "^3.0.54",
48
48
  "anymatch": "^3.1.2",
49
- "chalk": "^4.1.1",
50
- "chokidar": "^3.5.2",
51
- "commander": "^8.1.0",
52
- "globby": "^11.0.0",
53
- "js-yaml": "^4.1.0",
54
49
  "md5": "^2.3.0",
55
- "p-map": "^4.0.0",
56
- "signale": "^1.4.0"
50
+ "p-map": "^4.0.0"
57
51
  },
58
52
  "devDependencies": {
59
53
  "@scripts/build": "0.0.0",
60
54
  "@scripts/jest-config": "0.0.0",
61
55
  "@types/jest": "^26",
62
- "@types/js-yaml": "^4.0.2",
63
56
  "@types/md5": "^2.3.1",
64
57
  "@types/node": "^14",
65
58
  "@types/react": "^17",
66
59
  "@types/react-dom": "^17",
67
- "@types/signale": "^1.4.2",
68
- "execa": "^5.1.1",
69
60
  "jest": "^27",
70
61
  "typescript": "^4"
71
62
  },
@@ -1,7 +0,0 @@
1
- import plugin from '../src';
2
-
3
- describe('monorepo-tools', () => {
4
- it('default', () => {
5
- expect(plugin).toBeDefined();
6
- });
7
- });
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": true,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "outDir": "./out",
8
- "emitDeclarationOnly": true,
9
- "isolatedModules": true,
10
- "paths": {},
11
- "types": ["node", "jest"]
12
- }
13
- }