workspace-tools 0.38.3 → 0.38.5

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 (78) hide show
  1. package/lib/getPackageInfos.d.ts +14 -0
  2. package/lib/getPackageInfos.js +17 -20
  3. package/lib/getPackageInfos.js.map +1 -1
  4. package/lib/getPackagePaths.d.ts +2 -2
  5. package/lib/getPackagePaths.js +2 -2
  6. package/lib/git/getRepositoryName.js +6 -6
  7. package/lib/git/getRepositoryName.js.map +1 -1
  8. package/lib/git/git.d.ts +10 -2
  9. package/lib/git/git.js +15 -3
  10. package/lib/git/git.js.map +1 -1
  11. package/lib/git/gitUtilities.d.ts +132 -3
  12. package/lib/git/gitUtilities.js +141 -4
  13. package/lib/git/gitUtilities.js.map +1 -1
  14. package/lib/graph/createDependencyMap.d.ts +1 -1
  15. package/lib/graph/createDependencyMap.js.map +1 -1
  16. package/lib/graph/getPackageDependencies.d.ts +10 -1
  17. package/lib/graph/getPackageDependencies.js +17 -5
  18. package/lib/graph/getPackageDependencies.js.map +1 -1
  19. package/lib/index.d.ts +17 -14
  20. package/lib/index.js +40 -15
  21. package/lib/index.js.map +1 -1
  22. package/lib/lockfile/parseBerryLock.d.ts +3 -0
  23. package/lib/lockfile/parseBerryLock.js +3 -0
  24. package/lib/lockfile/parseBerryLock.js.map +1 -1
  25. package/lib/lockfile/types.d.ts +3 -0
  26. package/lib/paths.d.ts +3 -0
  27. package/lib/paths.js +4 -1
  28. package/lib/paths.js.map +1 -1
  29. package/lib/tsdoc-metadata.json +1 -1
  30. package/lib/types/Catalogs.d.ts +30 -0
  31. package/lib/types/Catalogs.js +3 -0
  32. package/lib/types/Catalogs.js.map +1 -0
  33. package/lib/types/PackageInfo.d.ts +19 -1
  34. package/lib/types/WorkspaceInfo.d.ts +15 -6
  35. package/lib/workspaces/catalogs.d.ts +28 -0
  36. package/lib/workspaces/catalogs.js +57 -0
  37. package/lib/workspaces/catalogs.js.map +1 -0
  38. package/lib/workspaces/findWorkspacePath.d.ts +5 -5
  39. package/lib/workspaces/findWorkspacePath.js +3 -3
  40. package/lib/workspaces/findWorkspacePath.js.map +1 -1
  41. package/lib/workspaces/getWorkspacePackageInfo.d.ts +12 -9
  42. package/lib/workspaces/getWorkspacePackageInfo.js +14 -16
  43. package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
  44. package/lib/workspaces/getWorkspaceRoot.d.ts +18 -2
  45. package/lib/workspaces/getWorkspaceRoot.js +23 -4
  46. package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
  47. package/lib/workspaces/getWorkspaces.d.ts +11 -14
  48. package/lib/workspaces/getWorkspaces.js +8 -11
  49. package/lib/workspaces/getWorkspaces.js.map +1 -1
  50. package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +16 -9
  51. package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
  52. package/lib/workspaces/implementations/index.d.ts +2 -2
  53. package/lib/workspaces/implementations/index.js.map +1 -1
  54. package/lib/workspaces/implementations/lerna.d.ts +8 -8
  55. package/lib/workspaces/implementations/lerna.js +5 -5
  56. package/lib/workspaces/implementations/lerna.js.map +1 -1
  57. package/lib/workspaces/implementations/npm.d.ts +9 -9
  58. package/lib/workspaces/implementations/npm.js +6 -6
  59. package/lib/workspaces/implementations/npm.js.map +1 -1
  60. package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +21 -10
  61. package/lib/workspaces/implementations/packageJsonWorkspaces.js +34 -23
  62. package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
  63. package/lib/workspaces/implementations/pnpm.d.ts +17 -9
  64. package/lib/workspaces/implementations/pnpm.js +37 -11
  65. package/lib/workspaces/implementations/pnpm.js.map +1 -1
  66. package/lib/workspaces/implementations/rush.d.ts +8 -8
  67. package/lib/workspaces/implementations/rush.js +5 -5
  68. package/lib/workspaces/implementations/rush.js.map +1 -1
  69. package/lib/workspaces/implementations/yarn.d.ts +18 -10
  70. package/lib/workspaces/implementations/yarn.js +51 -10
  71. package/lib/workspaces/implementations/yarn.js.map +1 -1
  72. package/lib/workspaces/listOfWorkspacePackageNames.d.ts +5 -2
  73. package/lib/workspaces/listOfWorkspacePackageNames.js +3 -0
  74. package/lib/workspaces/listOfWorkspacePackageNames.js.map +1 -1
  75. package/lib/workspaces/readPackageInfo.d.ts +13 -0
  76. package/lib/workspaces/readPackageInfo.js +52 -0
  77. package/lib/workspaces/readPackageInfo.js.map +1 -0
  78. package/package.json +3 -4
@@ -1 +1 @@
1
- {"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/yarn.ts"],"names":[],"mappings":";;;AAAA,wBAA+C;AAE/C,mEAKiC;AAEjC,yCAAyC;AACzC,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,MAAM,IAAI,GAAG,IAAA,6BAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC;IACtE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,0CAA0C,GAAG,GAAG,CAAC,CAAC;KACnE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAND,oDAMC;AAED,8CAA8C;AAC9C,SAAgB,wBAAwB,CAAC,GAAW;IAClD,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACrD,OAAO,IAAA,wDAAgC,EAAC,kBAAkB,CAAC,CAAC;AAC9D,CAAC;AAHD,4DAGC;AAED,8CAA8C;AAC9C,SAAgB,6BAA6B,CAAC,GAAW;IACvD,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACrD,OAAO,IAAA,6DAAqC,EAAC,kBAAkB,CAAC,CAAC;AACnE,CAAC;AAHD,sEAGC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACrD,OAAO,IAAA,yDAAiC,E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,CAAC,CAAC;QACjE,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAzBD,0CAyBC;AAI2B,sCAAW"}
@@ -1,2 +1,5 @@
1
- import { WorkspaceInfo } from "../types/WorkspaceInfo";
2
- export declare function listOfWorkspacePackageNames(workspaces: WorkspaceInfo): string[];
1
+ import type { WorkspaceInfos } from "../types/WorkspaceInfo";
2
+ /**
3
+ * @deprecated Just write `workspaces.map(w => w.name)` directly
4
+ */
5
+ export declare function listOfWorkspacePackageNames(workspaces: WorkspaceInfos): string[];
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listOfWorkspacePackageNames = void 0;
4
+ /**
5
+ * @deprecated Just write `workspaces.map(w => w.name)` directly
6
+ */
4
7
  function listOfWorkspacePackageNames(workspaces) {
5
8
  return workspaces.map(({ name }) => name);
6
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"listOfWorkspacePackageNames.js","sourceRoot":"","sources":["../../src/workspaces/listOfWorkspacePackageNames.ts"],"names":[],"mappings":";;;AAEA,SAAgB,2BAA2B,CAAC,UAAyB;IACnE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAFD,kEAEC"}
1
+ {"version":3,"file":"listOfWorkspacePackageNames.js","sourceRoot":"","sources":["../../src/workspaces/listOfWorkspacePackageNames.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,2BAA2B,CAAC,UAA0B;IACpE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAFD,kEAEC"}
@@ -0,0 +1,13 @@
1
+ import type { PackageInfo } from "../types/PackageInfo";
2
+ /**
3
+ * Read package.json from the given path if it exists.
4
+ * Logs a warning if it doesn't exist, or there's an error reading or parsing it.
5
+ * @returns The package info, or undefined if it doesn't exist or can't be read
6
+ */
7
+ export declare function readPackageInfo(cwd: string): PackageInfo | undefined;
8
+ /**
9
+ * Read package.json from the given path if it exists.
10
+ * Logs a warning if it doesn't exist, or there's an error reading or parsing it.
11
+ * @returns The package info, or undefined if it doesn't exist or can't be read
12
+ */
13
+ export declare function readPackageInfoAsync(cwd: string): Promise<PackageInfo | undefined>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.readPackageInfoAsync = exports.readPackageInfo = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const promises_1 = __importDefault(require("fs/promises"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const infoFromPackageJson_1 = require("../infoFromPackageJson");
11
+ const logging_1 = require("../logging");
12
+ /**
13
+ * Read package.json from the given path if it exists.
14
+ * Logs a warning if it doesn't exist, or there's an error reading or parsing it.
15
+ * @returns The package info, or undefined if it doesn't exist or can't be read
16
+ */
17
+ function readPackageInfo(cwd) {
18
+ const packageJsonPath = path_1.default.join(cwd, "package.json");
19
+ try {
20
+ if (!fs_1.default.existsSync(packageJsonPath)) {
21
+ (0, logging_1.logVerboseWarning)(`File does not exist: ${packageJsonPath}`);
22
+ return undefined;
23
+ }
24
+ const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, "utf-8"));
25
+ return (0, infoFromPackageJson_1.infoFromPackageJson)(packageJson, packageJsonPath);
26
+ }
27
+ catch (e) {
28
+ (0, logging_1.logVerboseWarning)(`Error reading or parsing ${packageJsonPath}: ${e?.message || e}`);
29
+ }
30
+ }
31
+ exports.readPackageInfo = readPackageInfo;
32
+ /**
33
+ * Read package.json from the given path if it exists.
34
+ * Logs a warning if it doesn't exist, or there's an error reading or parsing it.
35
+ * @returns The package info, or undefined if it doesn't exist or can't be read
36
+ */
37
+ async function readPackageInfoAsync(cwd) {
38
+ const packageJsonPath = path_1.default.join(cwd, "package.json");
39
+ try {
40
+ if (!fs_1.default.existsSync(packageJsonPath)) {
41
+ (0, logging_1.logVerboseWarning)(`File does not exist: ${packageJsonPath}`);
42
+ return undefined;
43
+ }
44
+ const packageJson = JSON.parse(await promises_1.default.readFile(packageJsonPath, "utf-8"));
45
+ return (0, infoFromPackageJson_1.infoFromPackageJson)(packageJson, packageJsonPath);
46
+ }
47
+ catch (e) {
48
+ (0, logging_1.logVerboseWarning)(`Error reading or parsing ${packageJsonPath}: ${e?.message || e}`);
49
+ }
50
+ }
51
+ exports.readPackageInfoAsync = readPackageInfoAsync;
52
+ //# sourceMappingURL=readPackageInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readPackageInfo.js","sourceRoot":"","sources":["../../src/workspaces/readPackageInfo.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,2DAAqC;AACrC,gDAAwB;AAExB,gEAA6D;AAC7D,wCAA+C;AAE/C;;;;GAIG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACvD,IAAI;QACF,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;YACnC,IAAA,2BAAiB,EAAC,wBAAwB,eAAe,EAAE,CAAC,CAAC;YAC7D,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1E,OAAO,IAAA,yCAAmB,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;KAC1D;IAAC,OAAO,CAAC,EAAE;QACV,IAAA,2BAAiB,EAAC,4BAA4B,eAAe,KAAM,CAAW,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC;KACjG;AACH,CAAC;AAbD,0CAaC;AAED;;;;GAIG;AACI,KAAK,UAAU,oBAAoB,CAAC,GAAW;IACpD,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACvD,IAAI;QACF,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;YACnC,IAAA,2BAAiB,EAAC,wBAAwB,eAAe,EAAE,CAAC,CAAC;YAC7D,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,kBAAU,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;QACpF,OAAO,IAAA,yCAAmB,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;KAC1D;IAAC,OAAO,CAAC,EAAE;QACV,IAAA,2BAAiB,EAAC,4BAA4B,eAAe,KAAM,CAAW,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC;KACjG;AACH,CAAC;AAbD,oDAaC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspace-tools",
3
- "version": "0.38.3",
3
+ "version": "0.38.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,21 +14,20 @@
14
14
  ],
15
15
  "scripts": {
16
16
  "api": "ws-tools-scripts api",
17
- "build": "tsc",
17
+ "build": "tsc --pretty",
18
18
  "start": "tsc -w --preserveWatchOutput",
19
19
  "test": "jest"
20
20
  },
21
21
  "dependencies": {
22
22
  "@yarnpkg/lockfile": "^1.1.0",
23
23
  "fast-glob": "^3.3.1",
24
- "git-url-parse": "^13.0.0",
24
+ "git-url-parse": "^16.0.0",
25
25
  "globby": "^11.0.0",
26
26
  "jju": "^1.4.0",
27
27
  "js-yaml": "^4.1.0",
28
28
  "micromatch": "^4.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "lodash": "^4.17.21",
32
31
  "@ws-tools/scripts": "*"
33
32
  }
34
33
  }