@modern-js/monorepo-tools 1.4.3 → 1.4.6

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 (36) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/js/modern/cli/build.js +1 -1
  3. package/dist/js/modern/dag/edge-manager.js +4 -1
  4. package/dist/js/modern/dag/operator.js +7 -5
  5. package/dist/js/modern/dag/task.js +20 -11
  6. package/dist/js/modern/features/deploy/index.js +2 -2
  7. package/dist/js/modern/features/dev/watch-projects-state.js +9 -5
  8. package/dist/js/modern/features/install/index.js +6 -6
  9. package/dist/js/modern/log/multi-tasks-log.js +10 -4
  10. package/dist/js/modern/package/index.js +8 -3
  11. package/dist/js/modern/parse-config/monorepo.js +2 -4
  12. package/dist/js/modern/projects/check-project-change.js +5 -6
  13. package/dist/js/modern/projects/get-projects-by-packages-config.js +3 -3
  14. package/dist/js/modern/projects/get-projects-by-workspace-file.js +3 -3
  15. package/dist/js/modern/projects/get-projects.js +5 -5
  16. package/dist/js/node/cli/build.js +1 -1
  17. package/dist/js/node/dag/edge-manager.js +4 -1
  18. package/dist/js/node/dag/operator.js +7 -5
  19. package/dist/js/node/dag/task.js +20 -11
  20. package/dist/js/node/features/deploy/index.js +2 -2
  21. package/dist/js/node/features/dev/watch-projects-state.js +10 -8
  22. package/dist/js/node/features/install/index.js +6 -6
  23. package/dist/js/node/log/multi-tasks-log.js +10 -4
  24. package/dist/js/node/package/index.js +8 -3
  25. package/dist/js/node/parse-config/monorepo.js +1 -4
  26. package/dist/js/node/projects/check-project-change.js +7 -8
  27. package/dist/js/node/projects/get-projects-by-packages-config.js +8 -8
  28. package/dist/js/node/projects/get-projects-by-workspace-file.js +2 -2
  29. package/dist/js/node/projects/get-projects.js +4 -4
  30. package/dist/types/dag/task.d.ts +3 -3
  31. package/dist/types/projects/get-projects-by-packages-config.d.ts +2 -2
  32. package/package.json +33 -12
  33. package/.eslintrc.js +0 -8
  34. package/jest.config.js +0 -7
  35. package/modern.config.js +0 -2
  36. package/tsconfig.json +0 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # @modern-js/monorepo-tools
2
2
 
3
+ ## 1.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
8
+ - Updated dependencies [d5913bd96]
9
+ - Updated dependencies [d32f35134]
10
+ - Updated dependencies [d9d398e16]
11
+ - Updated dependencies [6ae4a34ae]
12
+ - Updated dependencies [b80229c79]
13
+ - Updated dependencies [948cc4436]
14
+ - @modern-js/plugin@1.3.4
15
+ - @modern-js/core@1.10.2
16
+ - @modern-js/i18n-cli-language-detector@1.2.3
17
+ - @modern-js/plugin-changeset@1.2.7
18
+ - @modern-js/plugin-i18n@1.2.6
19
+ - @modern-js/new-action@1.3.9
20
+ - @modern-js/utils@1.7.3
21
+
22
+ ## 1.4.5
23
+
24
+ ### Patch Changes
25
+
26
+ - 69a728375: fix: remove exports.jsnext:source after publish
27
+ - Updated dependencies [cd7346b0d]
28
+ - Updated dependencies [6b0bb5e3b]
29
+ - Updated dependencies [69a728375]
30
+ - @modern-js/utils@1.7.2
31
+ - @modern-js/new-action@1.3.8
32
+ - @modern-js/core@1.10.1
33
+ - @modern-js/plugin-changeset@1.2.6
34
+ - @modern-js/plugin-i18n@1.2.5
35
+
36
+ ## 1.4.4
37
+
38
+ ### Patch Changes
39
+
40
+ - 592edabc: feat: prebundle url-join,mime-types,json5,fast-glob,globby,ora,inquirer
41
+ - Updated dependencies [2d155c4c]
42
+ - Updated dependencies [123e432d]
43
+ - Updated dependencies [e5a9b26d]
44
+ - Updated dependencies [0b26b93b]
45
+ - Updated dependencies [123e432d]
46
+ - Updated dependencies [f9f66ef9]
47
+ - Updated dependencies [592edabc]
48
+ - Updated dependencies [895fa0ff]
49
+ - Updated dependencies [3578913e]
50
+ - Updated dependencies [1c3beab3]
51
+ - @modern-js/utils@1.6.0
52
+ - @modern-js/core@1.9.0
53
+ - @modern-js/new-action@1.3.7
54
+ - @modern-js/plugin-changeset@1.2.5
55
+
3
56
  ## 1.4.3
4
57
 
5
58
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import { build } from "../commands";
2
2
  export const buildCli = (program, api) => {
3
- program.command('build [project]').usage('[options]').option('--no-self', 'build without target project').option('-t, --dept', 'build target project with project’s dependent').option('--no-deps', 'build target project without project’s dependences').option('--only-self', 'build target project with nothing').option('-a, --all', 'build target project with project’s dependences and dependent').option('--content-hash', 'build target project use content hash cache').option('--git-hash', 'build target project use git hash cache').description('build target project').action(async (targetProjectName, option) => {
3
+ program.command('build [project]').usage('[options]').option('--no-self', 'build without target project').option('-t, --dept', 'build target project with project’s dependent').option('--no-deps', 'build target project without project’s dependencies').option('--only-self', 'build target project with nothing').option('-a, --all', 'build target project with project’s dependencies and dependent').option('--content-hash', 'build target project use content hash cache').option('--git-hash', 'build target project use git hash cache').description('build target project').action(async (targetProjectName, option) => {
4
4
  await build(targetProjectName, option, api);
5
5
  });
6
6
  };
@@ -1,6 +1,9 @@
1
+ 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; }
2
+
1
3
  export class EdgeManager {
2
4
  constructor() {
3
- this._dependencyEdgeHash = void 0;
5
+ _defineProperty(this, "_dependencyEdgeHash", void 0);
6
+
4
7
  this._dependencyEdgeHash = {};
5
8
  }
6
9
 
@@ -12,14 +12,16 @@ import { recursiveGetDependency, sortProjects } from "./utils";
12
12
  export class DagOperator {
13
13
  // 排序好的项目列表
14
14
  constructor(projects, projectsMap) {
15
- this._projects = void 0;
16
- this._projectsMap = void 0;
17
- this._sortedProjects = void 0;
15
+ _defineProperty(this, "_projects", void 0);
18
16
 
19
- this._createTask = (project, task) => async (stopTask = () => undefined) => {
17
+ _defineProperty(this, "_projectsMap", void 0);
18
+
19
+ _defineProperty(this, "_sortedProjects", void 0);
20
+
21
+ _defineProperty(this, "_createTask", (project, task) => async (stopTask = () => undefined) => {
20
22
  await task(project, project.dependency || [], () => stopTask());
21
23
  return project.name;
22
- };
24
+ });
23
25
 
24
26
  this._projects = projects;
25
27
  this._projectsMap = projectsMap;
@@ -1,3 +1,5 @@
1
+ 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; }
2
+
1
3
  import { EventEmitter } from 'events';
2
4
  import pMap from 'p-map';
3
5
  export class TaskRunner extends EventEmitter {
@@ -5,20 +7,25 @@ export class TaskRunner extends EventEmitter {
5
7
  concurrency
6
8
  }) {
7
9
  super();
8
- this._tasks = void 0;
9
- this._concurrency = void 0;
10
- this._useableConcurrency = void 0;
11
- this._stopFlag = void 0;
10
+
11
+ _defineProperty(this, "_tasks", void 0);
12
+
13
+ _defineProperty(this, "_concurrency", void 0);
14
+
15
+ _defineProperty(this, "_usableConcurrency", void 0);
16
+
17
+ _defineProperty(this, "_stopFlag", void 0);
18
+
12
19
  this._tasks = tasks;
13
20
  this._concurrency = concurrency || TaskRunner.DefaultConcurrency;
14
- this._useableConcurrency = this._concurrency;
21
+ this._usableConcurrency = this._concurrency;
15
22
  this._stopFlag = false;
16
23
  }
17
24
 
18
25
  async run() {
19
26
  const tasks = this._tasks.splice(0, this._concurrency);
20
27
 
21
- this._useableConcurrency = this._concurrency - tasks.length;
28
+ this._usableConcurrency = this._concurrency - tasks.length;
22
29
  await pMap(tasks, async task => {
23
30
  await this._runTask(task);
24
31
  }, {
@@ -36,13 +43,13 @@ export class TaskRunner extends EventEmitter {
36
43
  }
37
44
 
38
45
  const emitValue = await task(this._stopTask.bind(this));
39
- this._useableConcurrency--;
46
+ this._usableConcurrency--;
40
47
  this.emit(TaskRunner.TASK_FINISH, emitValue);
41
48
 
42
49
  if (this._tasks.length > 0) {
43
- const nextTasks = this._tasks.splice(0, this._useableConcurrency);
50
+ const nextTasks = this._tasks.splice(0, this._usableConcurrency);
44
51
 
45
- this._useableConcurrency -= nextTasks.length;
52
+ this._usableConcurrency -= nextTasks.length;
46
53
 
47
54
  if (nextTasks.length > 0) {
48
55
  await pMap(nextTasks, async _task => {
@@ -59,5 +66,7 @@ export class TaskRunner extends EventEmitter {
59
66
  }
60
67
 
61
68
  }
62
- TaskRunner.DefaultConcurrency = 10;
63
- TaskRunner.TASK_FINISH = 'task-finish';
69
+
70
+ _defineProperty(TaskRunner, "DefaultConcurrency", 10);
71
+
72
+ _defineProperty(TaskRunner, "TASK_FINISH", 'task-finish');
@@ -75,9 +75,9 @@ const generatorAndCopyRequiredFiles = (rootPath, deployDir) => {
75
75
  const checkAndRunDeployCommand = async (monorepoPath, targetProject, packageManager) => {
76
76
  var _targetProject$extra;
77
77
 
78
- const scritps = ((_targetProject$extra = targetProject.extra) === null || _targetProject$extra === void 0 ? void 0 : _targetProject$extra.scripts) || {};
78
+ const scripts = ((_targetProject$extra = targetProject.extra) === null || _targetProject$extra === void 0 ? void 0 : _targetProject$extra.scripts) || {};
79
79
 
80
- if (scritps.deploy) {
80
+ if (scripts.deploy) {
81
81
  var _childProcess$stdout, _childProcess$stderr;
82
82
 
83
83
  logger.info(`The 'deploy' command for the ${targetProject.name} is detected, so 'deploy' will be executed`);
@@ -5,13 +5,17 @@ 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
- this._config = void 0;
12
- this._fromNodes = void 0;
13
- this._watchProjects = void 0;
14
- this._projectsFileMap = void 0;
11
+ _defineProperty(this, "_config", void 0);
12
+
13
+ _defineProperty(this, "_fromNodes", void 0);
14
+
15
+ _defineProperty(this, "_watchProjects", void 0);
16
+
17
+ _defineProperty(this, "_projectsFileMap", void 0);
18
+
15
19
  this._fromNodes = fromNodes;
16
20
  this._config = config;
17
21
  this._projectsFileMap = new Map();
@@ -6,19 +6,19 @@ import { installByPackageManager } from "../../utils/install";
6
6
 
7
7
  const replaceWorkspaces = ({
8
8
  rootPath,
9
- projectsInWorkspacs
9
+ projectsInWorkspaces
10
10
  }) => {
11
11
  // pnpm
12
12
  const pnpmWsFilePath = path.join(rootPath, WORKSPACE_FILE.PNPM);
13
13
 
14
14
  if (fs.existsSync(pnpmWsFilePath)) {
15
15
  const pnpmWorkspace = fs.readFileSync(pnpmWsFilePath, 'utf-8');
16
- const orignalPnpmWorkspaces = yaml.load(pnpmWorkspace);
16
+ const originalPnpmWorkspaces = yaml.load(pnpmWorkspace);
17
17
  fs.writeFileSync(pnpmWsFilePath, yaml.dump({
18
- packages: projectsInWorkspacs
18
+ packages: projectsInWorkspaces
19
19
  }));
20
20
  return () => {
21
- yaml.dump(orignalPnpmWorkspaces);
21
+ yaml.dump(originalPnpmWorkspaces);
22
22
  };
23
23
  }
24
24
 
@@ -31,7 +31,7 @@ const replaceWorkspaces = ({
31
31
 
32
32
  if (pkg !== null && pkg !== void 0 && (_pkg$workspaces = pkg.workspaces) !== null && _pkg$workspaces !== void 0 && _pkg$workspaces.packages) {
33
33
  const originalPkg = pkg;
34
- pkg.workspaces.packages = projectsInWorkspacs;
34
+ pkg.workspaces.packages = projectsInWorkspaces;
35
35
  JsonFile.save(pkg, pkgFilePath);
36
36
  return () => {
37
37
  JsonFile.save(originalPkg, pkgFilePath);
@@ -62,7 +62,7 @@ export const runInstallTask = async (projectNames, operator, config) => {
62
62
  const noDupProjectList = Array.from(new Set(projectsInWorkspaces));
63
63
  const restorWorkspace = replaceWorkspaces({
64
64
  rootPath,
65
- projectsInWorkspacs: noDupProjectList
65
+ projectsInWorkspaces: noDupProjectList
66
66
  });
67
67
  await installByPackageManager(packageManager, {
68
68
  rootPath,
@@ -1,3 +1,5 @@
1
+ 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; }
2
+
1
3
  import { Signale } from '@modern-js/utils';
2
4
  import { formatLog } from "./utils";
3
5
 
@@ -37,10 +39,14 @@ const createListenHandler = (name, config) => {
37
39
 
38
40
  export class MultitasksLogger {
39
41
  constructor() {
40
- this._taskNameList = void 0;
41
- this._taskStdoutListenerMap = void 0;
42
- this._taskStderrListenerMap = void 0;
43
- this._taskLogConfigMap = void 0;
42
+ _defineProperty(this, "_taskNameList", void 0);
43
+
44
+ _defineProperty(this, "_taskStdoutListenerMap", void 0);
45
+
46
+ _defineProperty(this, "_taskStderrListenerMap", void 0);
47
+
48
+ _defineProperty(this, "_taskLogConfigMap", void 0);
49
+
44
50
  this._taskNameList = [];
45
51
  this._taskStdoutListenerMap = new Map();
46
52
  this._taskStderrListenerMap = new Map();
@@ -1,8 +1,13 @@
1
+ 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; }
2
+
1
3
  export class Package {
2
4
  constructor(packageJson, packageConfigPath, rootPath) {
3
- this.json = void 0;
4
- this.configPath = void 0;
5
- this.rootPath = void 0;
5
+ _defineProperty(this, "json", void 0);
6
+
7
+ _defineProperty(this, "configPath", void 0);
8
+
9
+ _defineProperty(this, "rootPath", void 0);
10
+
6
11
  this.configPath = packageConfigPath;
7
12
  this.rootPath = rootPath;
8
13
  this.json = packageJson;
@@ -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";
@@ -102,12 +101,11 @@ export const getMonorepoBaseData = (root = process.cwd()) => {
102
101
  const rootPath = findMonorepoRoot(root);
103
102
 
104
103
  if (!rootPath) {
105
- throw new Error('not find any monorepo, you can add lerna、pnpm or yarn worksapce file');
104
+ throw new Error('not find any monorepo, you can add lerna、pnpm or yarn workspace file');
106
105
  }
107
106
 
108
107
  return {
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';
@@ -39,12 +38,12 @@ export const checkProjectChangeByGit = async (project, rootPath) => {
39
38
  });
40
39
  }
41
40
 
42
- const monorepoProjecstHashJson = JsonFile.load(monorepoGitMemory);
43
- const changed = monorepoProjecstHashJson[project.name] !== currentProjectHash;
41
+ const monorepoProjectHashJson = JsonFile.load(monorepoGitMemory);
42
+ const changed = monorepoProjectHashJson[project.name] !== currentProjectHash;
44
43
 
45
44
  if (changed) {
46
- monorepoProjecstHashJson[project.name] = currentProjectHash;
47
- FileSystem.writeFile(monorepoGitMemory, JsonFile.stringify(monorepoProjecstHashJson), {
45
+ monorepoProjectHashJson[project.name] = currentProjectHash;
46
+ FileSystem.writeFile(monorepoGitMemory, JsonFile.stringify(monorepoProjectHashJson), {
48
47
  ensureFolderExists: true
49
48
  });
50
49
  }
@@ -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";
@@ -55,7 +55,7 @@ const makeFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
55
55
  };
56
56
  };
57
57
 
58
- export const getProjetsByPackageConfig = async (rootPath, packagesConfig, ignoreConfigs) => {
58
+ export const getProjectsByPackageConfig = async (rootPath, packagesConfig, ignoreConfigs) => {
59
59
  const finder = makeFileFinder(rootPath, packagesConfig, ignoreConfigs);
60
60
  const fileName = 'package.json';
61
61
 
@@ -93,7 +93,7 @@ const makeSyncFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
93
93
  };
94
94
  };
95
95
 
96
- export const syncGetProjetsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs) => {
96
+ export const syncGetProjectsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs) => {
97
97
  const finder = makeSyncFileFinder(rootPath, packagesConfig, ignoreConfigs);
98
98
  const fileName = 'package.json';
99
99
 
@@ -3,7 +3,7 @@ import { FileSystem, JsonFile } from '@rushstack/node-core-library';
3
3
  import { fs, yaml } from '@modern-js/utils';
4
4
  import { getWorkspaceFile } from "../parse-config/monorepo";
5
5
  import { WORKSPACE_FILE } from "../constants";
6
- import { getProjetsByPackageConfig, syncGetProjetsByPackageConfig } from "./get-projects-by-packages-config";
6
+ import { getProjectsByPackageConfig, syncGetProjectsByPackageConfig } from "./get-projects-by-packages-config";
7
7
  export const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
8
8
  var _config$workspaceFile;
9
9
 
@@ -37,7 +37,7 @@ export const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs
37
37
  packagesConfig = (_lernaJson$packages = lernaJson.packages) !== null && _lernaJson$packages !== void 0 ? _lernaJson$packages : [];
38
38
  }
39
39
 
40
- const projects = await getProjetsByPackageConfig(rootPath, packagesConfig, ignoreConfigs);
40
+ const projects = await getProjectsByPackageConfig(rootPath, packagesConfig, ignoreConfigs);
41
41
  return projects;
42
42
  };
43
43
  export const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
@@ -73,6 +73,6 @@ export const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs)
73
73
  packagesConfig = (_lernaJson$packages2 = lernaJson.packages) !== null && _lernaJson$packages2 !== void 0 ? _lernaJson$packages2 : [];
74
74
  }
75
75
 
76
- const projects = syncGetProjetsByPackageConfig(rootPath, packagesConfig, ignoreConfigs);
76
+ const projects = syncGetProjectsByPackageConfig(rootPath, packagesConfig, ignoreConfigs);
77
77
  return projects;
78
78
  };
@@ -6,7 +6,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import { errorLog } from "../log/error";
8
8
  import { getMonorepoBaseData } from "../parse-config/monorepo";
9
- import { getProjetsByPackageConfig, syncGetProjetsByPackageConfig } from "./get-projects-by-packages-config";
9
+ import { getProjectsByPackageConfig, syncGetProjectsByPackageConfig } from "./get-projects-by-packages-config";
10
10
  import { getProjectsByWorkspaceFile, syncGetProjectsByWorkspaceFile } from "./get-projects-by-workspace-file";
11
11
  var FindProjectsMode;
12
12
 
@@ -40,7 +40,7 @@ const getProjectsByPackagesMatch = async (rootPath, match, ignore) => {
40
40
 
41
41
  if (Array.isArray(match)) {
42
42
  // like lerna`s packages config
43
- projects = await getProjetsByPackageConfig(rootPath, match, ignore);
43
+ projects = await getProjectsByPackageConfig(rootPath, match, ignore);
44
44
  } else {
45
45
  // use workspace file
46
46
  projects = await getProjectsByWorkspaceFile(rootPath, match, ignore);
@@ -70,7 +70,7 @@ const syncGetProjectsByPackagesMatch = (rootPath, match, ignore) => {
70
70
 
71
71
  if (Array.isArray(match)) {
72
72
  // like lerna`s packages config
73
- projects = syncGetProjetsByPackageConfig(rootPath, match, ignore);
73
+ projects = syncGetProjectsByPackageConfig(rootPath, match, ignore);
74
74
  } else {
75
75
  // use workspace file
76
76
  projects = syncGetProjectsByWorkspaceFile(rootPath, match, ignore);
@@ -110,10 +110,10 @@ const checkFindProjectsMode = (config // eslint-disable-next-line consistent-ret
110
110
  }
111
111
 
112
112
  if (config.projectsConfig && config.packagesMatchs) {
113
- errorLog('There can not be both `pakcagesMatchs` and `projectsConfig`');
113
+ errorLog('There can not be both `packagesMatchs` and `projectsConfig`');
114
114
  }
115
115
 
116
- errorLog('No `pakcagesMatchs` and `projectsConfig` configurations found');
116
+ errorLog('No `packagesMatchs` and `projectsConfig` configurations found');
117
117
  };
118
118
 
119
119
  export const getProjects = async (config, currentDir = process.cwd()) => {
@@ -8,7 +8,7 @@ exports.buildCli = void 0;
8
8
  var _commands = require("../commands");
9
9
 
10
10
  const buildCli = (program, api) => {
11
- program.command('build [project]').usage('[options]').option('--no-self', 'build without target project').option('-t, --dept', 'build target project with project’s dependent').option('--no-deps', 'build target project without project’s dependences').option('--only-self', 'build target project with nothing').option('-a, --all', 'build target project with project’s dependences and dependent').option('--content-hash', 'build target project use content hash cache').option('--git-hash', 'build target project use git hash cache').description('build target project').action(async (targetProjectName, option) => {
11
+ program.command('build [project]').usage('[options]').option('--no-self', 'build without target project').option('-t, --dept', 'build target project with project’s dependent').option('--no-deps', 'build target project without project’s dependencies').option('--only-self', 'build target project with nothing').option('-a, --all', 'build target project with project’s dependencies and dependent').option('--content-hash', 'build target project use content hash cache').option('--git-hash', 'build target project use git hash cache').description('build target project').action(async (targetProjectName, option) => {
12
12
  await (0, _commands.build)(targetProjectName, option, api);
13
13
  });
14
14
  };
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.EdgeManager = void 0;
7
7
 
8
+ 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; }
9
+
8
10
  class EdgeManager {
9
11
  constructor() {
10
- this._dependencyEdgeHash = void 0;
12
+ _defineProperty(this, "_dependencyEdgeHash", void 0);
13
+
11
14
  this._dependencyEdgeHash = {};
12
15
  }
13
16
 
@@ -26,14 +26,16 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
26
26
  class DagOperator {
27
27
  // 排序好的项目列表
28
28
  constructor(projects, projectsMap) {
29
- this._projects = void 0;
30
- this._projectsMap = void 0;
31
- this._sortedProjects = void 0;
29
+ _defineProperty(this, "_projects", void 0);
32
30
 
33
- this._createTask = (project, task) => async (stopTask = () => undefined) => {
31
+ _defineProperty(this, "_projectsMap", void 0);
32
+
33
+ _defineProperty(this, "_sortedProjects", void 0);
34
+
35
+ _defineProperty(this, "_createTask", (project, task) => async (stopTask = () => undefined) => {
34
36
  await task(project, project.dependency || [], () => stopTask());
35
37
  return project.name;
36
- };
38
+ });
37
39
 
38
40
  this._projects = projects;
39
41
  this._projectsMap = projectsMap;
@@ -11,25 +11,32 @@ var _pMap = _interopRequireDefault(require("p-map"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
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
+
14
16
  class TaskRunner extends _events.EventEmitter {
15
17
  constructor(tasks, {
16
18
  concurrency
17
19
  }) {
18
20
  super();
19
- this._tasks = void 0;
20
- this._concurrency = void 0;
21
- this._useableConcurrency = void 0;
22
- this._stopFlag = void 0;
21
+
22
+ _defineProperty(this, "_tasks", void 0);
23
+
24
+ _defineProperty(this, "_concurrency", void 0);
25
+
26
+ _defineProperty(this, "_usableConcurrency", void 0);
27
+
28
+ _defineProperty(this, "_stopFlag", void 0);
29
+
23
30
  this._tasks = tasks;
24
31
  this._concurrency = concurrency || TaskRunner.DefaultConcurrency;
25
- this._useableConcurrency = this._concurrency;
32
+ this._usableConcurrency = this._concurrency;
26
33
  this._stopFlag = false;
27
34
  }
28
35
 
29
36
  async run() {
30
37
  const tasks = this._tasks.splice(0, this._concurrency);
31
38
 
32
- this._useableConcurrency = this._concurrency - tasks.length;
39
+ this._usableConcurrency = this._concurrency - tasks.length;
33
40
  await (0, _pMap.default)(tasks, async task => {
34
41
  await this._runTask(task);
35
42
  }, {
@@ -47,13 +54,13 @@ class TaskRunner extends _events.EventEmitter {
47
54
  }
48
55
 
49
56
  const emitValue = await task(this._stopTask.bind(this));
50
- this._useableConcurrency--;
57
+ this._usableConcurrency--;
51
58
  this.emit(TaskRunner.TASK_FINISH, emitValue);
52
59
 
53
60
  if (this._tasks.length > 0) {
54
- const nextTasks = this._tasks.splice(0, this._useableConcurrency);
61
+ const nextTasks = this._tasks.splice(0, this._usableConcurrency);
55
62
 
56
- this._useableConcurrency -= nextTasks.length;
63
+ this._usableConcurrency -= nextTasks.length;
57
64
 
58
65
  if (nextTasks.length > 0) {
59
66
  await (0, _pMap.default)(nextTasks, async _task => {
@@ -72,5 +79,7 @@ class TaskRunner extends _events.EventEmitter {
72
79
  }
73
80
 
74
81
  exports.TaskRunner = TaskRunner;
75
- TaskRunner.DefaultConcurrency = 10;
76
- TaskRunner.TASK_FINISH = 'task-finish';
82
+
83
+ _defineProperty(TaskRunner, "DefaultConcurrency", 10);
84
+
85
+ _defineProperty(TaskRunner, "TASK_FINISH", 'task-finish');
@@ -90,9 +90,9 @@ const generatorAndCopyRequiredFiles = (rootPath, deployDir) => {
90
90
  const checkAndRunDeployCommand = async (monorepoPath, targetProject, packageManager) => {
91
91
  var _targetProject$extra;
92
92
 
93
- const scritps = ((_targetProject$extra = targetProject.extra) === null || _targetProject$extra === void 0 ? void 0 : _targetProject$extra.scripts) || {};
93
+ const scripts = ((_targetProject$extra = targetProject.extra) === null || _targetProject$extra === void 0 ? void 0 : _targetProject$extra.scripts) || {};
94
94
 
95
- if (scritps.deploy) {
95
+ if (scripts.deploy) {
96
96
  var _childProcess$stdout, _childProcess$stderr;
97
97
 
98
98
  _utils.logger.info(`The 'deploy' command for the ${targetProject.name} is detected, so 'deploy' will be executed`);
@@ -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
 
@@ -23,10 +21,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
23
21
 
24
22
  class WatchedProjectsState {
25
23
  constructor(fromNodes, config) {
26
- this._config = void 0;
27
- this._fromNodes = void 0;
28
- this._watchProjects = void 0;
29
- this._projectsFileMap = void 0;
24
+ _defineProperty(this, "_config", void 0);
25
+
26
+ _defineProperty(this, "_fromNodes", void 0);
27
+
28
+ _defineProperty(this, "_watchProjects", void 0);
29
+
30
+ _defineProperty(this, "_projectsFileMap", void 0);
31
+
30
32
  this._fromNodes = fromNodes;
31
33
  this._config = config;
32
34
  this._projectsFileMap = new Map();
@@ -44,7 +46,7 @@ class WatchedProjectsState {
44
46
  ignore: ['**/node_modules/**', '.project-memory/**', 'dist/**']
45
47
  };
46
48
  this._watchProjects = this._fromNodes.reduce((ret, node) => {
47
- const files = _globby.default.sync(`${node.extra.path}/**`, globOption);
49
+ const files = _utils.globby.sync(`${node.extra.path}/**`, globOption);
48
50
 
49
51
  for (const filePath of files) {
50
52
  this._projectsFileMap.set(path.relative(this._config.rootPath, filePath), node.extra.path);
@@ -21,7 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
 
22
22
  const replaceWorkspaces = ({
23
23
  rootPath,
24
- projectsInWorkspacs
24
+ projectsInWorkspaces
25
25
  }) => {
26
26
  // pnpm
27
27
  const pnpmWsFilePath = path.join(rootPath, _constants.WORKSPACE_FILE.PNPM);
@@ -29,14 +29,14 @@ const replaceWorkspaces = ({
29
29
  if (_utils.fs.existsSync(pnpmWsFilePath)) {
30
30
  const pnpmWorkspace = _utils.fs.readFileSync(pnpmWsFilePath, 'utf-8');
31
31
 
32
- const orignalPnpmWorkspaces = _utils.yaml.load(pnpmWorkspace);
32
+ const originalPnpmWorkspaces = _utils.yaml.load(pnpmWorkspace);
33
33
 
34
34
  _utils.fs.writeFileSync(pnpmWsFilePath, _utils.yaml.dump({
35
- packages: projectsInWorkspacs
35
+ packages: projectsInWorkspaces
36
36
  }));
37
37
 
38
38
  return () => {
39
- _utils.yaml.dump(orignalPnpmWorkspaces);
39
+ _utils.yaml.dump(originalPnpmWorkspaces);
40
40
  };
41
41
  }
42
42
 
@@ -49,7 +49,7 @@ const replaceWorkspaces = ({
49
49
 
50
50
  if (pkg !== null && pkg !== void 0 && (_pkg$workspaces = pkg.workspaces) !== null && _pkg$workspaces !== void 0 && _pkg$workspaces.packages) {
51
51
  const originalPkg = pkg;
52
- pkg.workspaces.packages = projectsInWorkspacs;
52
+ pkg.workspaces.packages = projectsInWorkspaces;
53
53
 
54
54
  _nodeCoreLibrary.JsonFile.save(pkg, pkgFilePath);
55
55
 
@@ -82,7 +82,7 @@ const runInstallTask = async (projectNames, operator, config) => {
82
82
  const noDupProjectList = Array.from(new Set(projectsInWorkspaces));
83
83
  const restorWorkspace = replaceWorkspaces({
84
84
  rootPath,
85
- projectsInWorkspacs: noDupProjectList
85
+ projectsInWorkspaces: noDupProjectList
86
86
  });
87
87
  await (0, _install.installByPackageManager)(packageManager, {
88
88
  rootPath,
@@ -9,6 +9,8 @@ var _utils = require("@modern-js/utils");
9
9
 
10
10
  var _utils2 = require("./utils");
11
11
 
12
+ 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; }
13
+
12
14
  const createLogger = (name, config) => {
13
15
  const options = {
14
16
  scope: config.label ? config.label + name : name,
@@ -45,10 +47,14 @@ const createListenHandler = (name, config) => {
45
47
 
46
48
  class MultitasksLogger {
47
49
  constructor() {
48
- this._taskNameList = void 0;
49
- this._taskStdoutListenerMap = void 0;
50
- this._taskStderrListenerMap = void 0;
51
- this._taskLogConfigMap = void 0;
50
+ _defineProperty(this, "_taskNameList", void 0);
51
+
52
+ _defineProperty(this, "_taskStdoutListenerMap", void 0);
53
+
54
+ _defineProperty(this, "_taskStderrListenerMap", void 0);
55
+
56
+ _defineProperty(this, "_taskLogConfigMap", void 0);
57
+
52
58
  this._taskNameList = [];
53
59
  this._taskStdoutListenerMap = new Map();
54
60
  this._taskStderrListenerMap = new Map();
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Package = void 0;
7
7
 
8
+ 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; }
9
+
8
10
  class Package {
9
11
  constructor(packageJson, packageConfigPath, rootPath) {
10
- this.json = void 0;
11
- this.configPath = void 0;
12
- this.rootPath = void 0;
12
+ _defineProperty(this, "json", void 0);
13
+
14
+ _defineProperty(this, "configPath", void 0);
15
+
16
+ _defineProperty(this, "rootPath", void 0);
17
+
13
18
  this.configPath = packageConfigPath;
14
19
  this.rootPath = rootPath;
15
20
  this.json = packageJson;
@@ -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;
@@ -124,7 +123,7 @@ const getMonorepoBaseData = (root = process.cwd()) => {
124
123
  const rootPath = findMonorepoRoot(root);
125
124
 
126
125
  if (!rootPath) {
127
- throw new Error('not find any monorepo, you can add lerna、pnpm or yarn worksapce file');
126
+ throw new Error('not find any monorepo, you can add lerna、pnpm or yarn workspace file');
128
127
  }
129
128
 
130
129
  return {
@@ -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
 
@@ -61,14 +60,14 @@ const checkProjectChangeByGit = async (project, rootPath) => {
61
60
  });
62
61
  }
63
62
 
64
- const monorepoProjecstHashJson = _nodeCoreLibrary.JsonFile.load(monorepoGitMemory);
63
+ const monorepoProjectHashJson = _nodeCoreLibrary.JsonFile.load(monorepoGitMemory);
65
64
 
66
- const changed = monorepoProjecstHashJson[project.name] !== currentProjectHash;
65
+ const changed = monorepoProjectHashJson[project.name] !== currentProjectHash;
67
66
 
68
67
  if (changed) {
69
- monorepoProjecstHashJson[project.name] = currentProjectHash;
68
+ monorepoProjectHashJson[project.name] = currentProjectHash;
70
69
 
71
- _nodeCoreLibrary.FileSystem.writeFile(monorepoGitMemory, _nodeCoreLibrary.JsonFile.stringify(monorepoProjecstHashJson), {
70
+ _nodeCoreLibrary.FileSystem.writeFile(monorepoGitMemory, _nodeCoreLibrary.JsonFile.stringify(monorepoProjectHashJson), {
72
71
  ensureFolderExists: true
73
72
  });
74
73
  }
@@ -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()) {
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.syncGetProjetsByPackageConfig = exports.getProjetsByPackageConfig = void 0;
6
+ exports.syncGetProjectsByPackageConfig = exports.getProjectsByPackageConfig = void 0;
7
7
 
8
8
  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
 
@@ -73,7 +73,7 @@ const makeFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
73
73
  };
74
74
  };
75
75
 
76
- const getProjetsByPackageConfig = async (rootPath, packagesConfig, ignoreConfigs) => {
76
+ const getProjectsByPackageConfig = async (rootPath, packagesConfig, ignoreConfigs) => {
77
77
  const finder = makeFileFinder(rootPath, packagesConfig, ignoreConfigs);
78
78
  const fileName = 'package.json';
79
79
 
@@ -91,7 +91,7 @@ const getProjetsByPackageConfig = async (rootPath, packagesConfig, ignoreConfigs
91
91
  return projects;
92
92
  };
93
93
 
94
- exports.getProjetsByPackageConfig = getProjetsByPackageConfig;
94
+ exports.getProjectsByPackageConfig = getProjectsByPackageConfig;
95
95
 
96
96
  const makeSyncFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
97
97
  const globOpts = getGlobOpts(rootPath, packageConfigs, ignoreConfigs);
@@ -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
@@ -114,7 +114,7 @@ const makeSyncFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
114
114
  };
115
115
  };
116
116
 
117
- const syncGetProjetsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs) => {
117
+ const syncGetProjectsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs) => {
118
118
  const finder = makeSyncFileFinder(rootPath, packagesConfig, ignoreConfigs);
119
119
  const fileName = 'package.json';
120
120
 
@@ -130,4 +130,4 @@ const syncGetProjetsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs)
130
130
  return projects;
131
131
  };
132
132
 
133
- exports.syncGetProjetsByPackageConfig = syncGetProjetsByPackageConfig;
133
+ exports.syncGetProjectsByPackageConfig = syncGetProjectsByPackageConfig;
@@ -58,7 +58,7 @@ const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
58
58
  packagesConfig = (_lernaJson$packages = lernaJson.packages) !== null && _lernaJson$packages !== void 0 ? _lernaJson$packages : [];
59
59
  }
60
60
 
61
- const projects = await (0, _getProjectsByPackagesConfig.getProjetsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
61
+ const projects = await (0, _getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
62
62
  return projects;
63
63
  };
64
64
 
@@ -101,7 +101,7 @@ const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
101
101
  packagesConfig = (_lernaJson$packages2 = lernaJson.packages) !== null && _lernaJson$packages2 !== void 0 ? _lernaJson$packages2 : [];
102
102
  }
103
103
 
104
- const projects = (0, _getProjectsByPackagesConfig.syncGetProjetsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
104
+ const projects = (0, _getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
105
105
  return projects;
106
106
  };
107
107
 
@@ -51,7 +51,7 @@ const getProjectsByPackagesMatch = async (rootPath, match, ignore) => {
51
51
 
52
52
  if (Array.isArray(match)) {
53
53
  // like lerna`s packages config
54
- projects = await (0, _getProjectsByPackagesConfig.getProjetsByPackageConfig)(rootPath, match, ignore);
54
+ projects = await (0, _getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, match, ignore);
55
55
  } else {
56
56
  // use workspace file
57
57
  projects = await (0, _getProjectsByWorkspaceFile.getProjectsByWorkspaceFile)(rootPath, match, ignore);
@@ -81,7 +81,7 @@ const syncGetProjectsByPackagesMatch = (rootPath, match, ignore) => {
81
81
 
82
82
  if (Array.isArray(match)) {
83
83
  // like lerna`s packages config
84
- projects = (0, _getProjectsByPackagesConfig.syncGetProjetsByPackageConfig)(rootPath, match, ignore);
84
+ projects = (0, _getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, match, ignore);
85
85
  } else {
86
86
  // use workspace file
87
87
  projects = (0, _getProjectsByWorkspaceFile.syncGetProjectsByWorkspaceFile)(rootPath, match, ignore);
@@ -121,10 +121,10 @@ const checkFindProjectsMode = (config // eslint-disable-next-line consistent-ret
121
121
  }
122
122
 
123
123
  if (config.projectsConfig && config.packagesMatchs) {
124
- (0, _error.errorLog)('There can not be both `pakcagesMatchs` and `projectsConfig`');
124
+ (0, _error.errorLog)('There can not be both `packagesMatchs` and `projectsConfig`');
125
125
  }
126
126
 
127
- (0, _error.errorLog)('No `pakcagesMatchs` and `projectsConfig` configurations found');
127
+ (0, _error.errorLog)('No `packagesMatchs` and `projectsConfig` configurations found');
128
128
  };
129
129
 
130
130
  const getProjects = async (config, currentDir = process.cwd()) => {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- export interface ITaskRunnterConfig {
3
+ export interface ITaskRunnerConfig {
4
4
  concurrency?: number;
5
5
  }
6
6
  export declare type TaskFunType<T = undefined> = (stopTask?: () => void) => Promise<T>;
@@ -9,11 +9,11 @@ export declare class TaskRunner<S> extends EventEmitter {
9
9
  static TASK_FINISH: string;
10
10
  _tasks: TaskFunType<S>[];
11
11
  _concurrency: number;
12
- _useableConcurrency: number;
12
+ _usableConcurrency: number;
13
13
  private _stopFlag;
14
14
  constructor(tasks: TaskFunType<S>[], {
15
15
  concurrency
16
- }: ITaskRunnterConfig);
16
+ }: ITaskRunnerConfig);
17
17
  run(): Promise<void>;
18
18
  addTask(task: TaskFunType<S>): void;
19
19
  private _runTask;
@@ -1,3 +1,3 @@
1
1
  import { Package } from '../package';
2
- export declare const getProjetsByPackageConfig: (rootPath: string, packagesConfig: string[], ignoreConfigs: string[]) => Promise<Package[]>;
3
- export declare const syncGetProjetsByPackageConfig: (rootPath: string, packagesConfig: string[], ignoreConfigs: string[]) => Package[];
2
+ export declare const getProjectsByPackageConfig: (rootPath: string, packagesConfig: string[], ignoreConfigs: string[]) => Promise<Package[]>;
3
+ export declare const syncGetProjectsByPackageConfig: (rootPath: string, packagesConfig: string[], ignoreConfigs: string[]) => Package[];
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.3",
14
+ "version": "1.4.6",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -35,25 +35,24 @@
35
35
  "modern": "./bin/modern.js"
36
36
  },
37
37
  "dependencies": {
38
- "@modern-js/core": "^1.8.0",
38
+ "@modern-js/core": "^1.10.2",
39
39
  "@babel/runtime": "^7",
40
- "@modern-js/i18n-cli-language-detector": "^1.2.2",
41
- "@modern-js/new-action": "^1.3.6",
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.5.0",
40
+ "@modern-js/i18n-cli-language-detector": "^1.2.3",
41
+ "@modern-js/new-action": "^1.3.9",
42
+ "@modern-js/plugin": "^1.3.4",
43
+ "@modern-js/plugin-changeset": "^1.2.7",
44
+ "@modern-js/plugin-i18n": "^1.2.6",
45
+ "@modern-js/utils": "^1.7.3",
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
- "globby": "^11.0.0",
50
49
  "md5": "^2.3.0",
51
50
  "p-map": "^4.0.0"
52
51
  },
53
52
  "devDependencies": {
54
53
  "@scripts/build": "0.0.0",
55
54
  "@scripts/jest-config": "0.0.0",
56
- "@types/jest": "^26",
55
+ "@types/jest": "^27",
57
56
  "@types/md5": "^2.3.1",
58
57
  "@types/node": "^14",
59
58
  "@types/react": "^17",
@@ -71,10 +70,32 @@
71
70
  "registry": "https://registry.npmjs.org/",
72
71
  "access": "public"
73
72
  },
73
+ "wireit": {
74
+ "build": {
75
+ "command": "modern build",
76
+ "files": [
77
+ "src/**/*",
78
+ "tsconfig.json",
79
+ "package.json"
80
+ ],
81
+ "output": [
82
+ "dist/**/*"
83
+ ]
84
+ },
85
+ "test": {
86
+ "command": "jest --passWithNoTests",
87
+ "files": [
88
+ "src/**/*",
89
+ "tsconfig.json",
90
+ "package.json"
91
+ ],
92
+ "output": []
93
+ }
94
+ },
74
95
  "scripts": {
75
96
  "new": "modern new",
76
- "build": "modern build",
77
- "test": "jest --passWithNoTests"
97
+ "build": "wireit",
98
+ "test": "wireit"
78
99
  },
79
100
  "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
80
101
  }
package/.eslintrc.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['@modern-js'],
4
- parserOptions: {
5
- tsconfigRootDir: __dirname,
6
- project: ['./tsconfig.json'],
7
- },
8
- };
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- const sharedConfig = require('@scripts/jest-config');
2
-
3
- /** @type {import('@jest/types').Config.InitialOptions} */
4
- module.exports = {
5
- ...sharedConfig,
6
- rootDir: __dirname,
7
- };
package/modern.config.js DELETED
@@ -1,2 +0,0 @@
1
- /** @type {import('@modern-js/module-tools').UserConfig} */
2
- module.exports = {};
package/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "isolatedModules": true,
8
- "paths": {}
9
- },
10
- "include": ["src"]
11
- }