workspace-tools 0.38.4 → 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.
- package/lib/getPackageInfos.d.ts +14 -0
- package/lib/getPackageInfos.js +17 -20
- package/lib/getPackageInfos.js.map +1 -1
- package/lib/getPackagePaths.d.ts +2 -2
- package/lib/getPackagePaths.js +2 -2
- package/lib/git/gitUtilities.d.ts +132 -3
- package/lib/git/gitUtilities.js +141 -4
- package/lib/git/gitUtilities.js.map +1 -1
- package/lib/graph/createDependencyMap.d.ts +1 -1
- package/lib/graph/createDependencyMap.js.map +1 -1
- package/lib/graph/getPackageDependencies.d.ts +10 -1
- package/lib/graph/getPackageDependencies.js +17 -5
- package/lib/graph/getPackageDependencies.js.map +1 -1
- package/lib/index.d.ts +17 -14
- package/lib/index.js +40 -15
- package/lib/index.js.map +1 -1
- package/lib/lockfile/parseBerryLock.d.ts +3 -0
- package/lib/lockfile/parseBerryLock.js +3 -0
- package/lib/lockfile/parseBerryLock.js.map +1 -1
- package/lib/lockfile/types.d.ts +3 -0
- package/lib/paths.d.ts +3 -0
- package/lib/paths.js +4 -1
- package/lib/paths.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types/Catalogs.d.ts +30 -0
- package/lib/types/Catalogs.js +3 -0
- package/lib/types/Catalogs.js.map +1 -0
- package/lib/types/PackageInfo.d.ts +19 -1
- package/lib/types/WorkspaceInfo.d.ts +15 -6
- package/lib/workspaces/catalogs.d.ts +28 -0
- package/lib/workspaces/catalogs.js +57 -0
- package/lib/workspaces/catalogs.js.map +1 -0
- package/lib/workspaces/findWorkspacePath.d.ts +5 -5
- package/lib/workspaces/findWorkspacePath.js +3 -3
- package/lib/workspaces/findWorkspacePath.js.map +1 -1
- package/lib/workspaces/getWorkspacePackageInfo.d.ts +12 -9
- package/lib/workspaces/getWorkspacePackageInfo.js +14 -16
- package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
- package/lib/workspaces/getWorkspaceRoot.d.ts +18 -2
- package/lib/workspaces/getWorkspaceRoot.js +23 -4
- package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
- package/lib/workspaces/getWorkspaces.d.ts +11 -14
- package/lib/workspaces/getWorkspaces.js +8 -11
- package/lib/workspaces/getWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +16 -9
- package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
- package/lib/workspaces/implementations/index.d.ts +2 -2
- package/lib/workspaces/implementations/index.js.map +1 -1
- package/lib/workspaces/implementations/lerna.d.ts +8 -8
- package/lib/workspaces/implementations/lerna.js +5 -5
- package/lib/workspaces/implementations/lerna.js.map +1 -1
- package/lib/workspaces/implementations/npm.d.ts +9 -9
- package/lib/workspaces/implementations/npm.js +6 -6
- package/lib/workspaces/implementations/npm.js.map +1 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +21 -10
- package/lib/workspaces/implementations/packageJsonWorkspaces.js +34 -23
- package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/pnpm.d.ts +17 -9
- package/lib/workspaces/implementations/pnpm.js +37 -11
- package/lib/workspaces/implementations/pnpm.js.map +1 -1
- package/lib/workspaces/implementations/rush.d.ts +8 -8
- package/lib/workspaces/implementations/rush.js +5 -5
- package/lib/workspaces/implementations/rush.js.map +1 -1
- package/lib/workspaces/implementations/yarn.d.ts +18 -10
- package/lib/workspaces/implementations/yarn.js +51 -10
- package/lib/workspaces/implementations/yarn.js.map +1 -1
- package/lib/workspaces/listOfWorkspacePackageNames.d.ts +5 -2
- package/lib/workspaces/listOfWorkspacePackageNames.js +3 -0
- package/lib/workspaces/listOfWorkspacePackageNames.js.map +1 -1
- package/lib/workspaces/readPackageInfo.d.ts +13 -0
- package/lib/workspaces/readPackageInfo.js +52 -0
- package/lib/workspaces/readPackageInfo.js.map +1 -0
- package/package.json +2 -3
package/lib/getPackageInfos.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import { PackageInfos } from "./types/PackageInfo";
|
|
2
|
+
/**
|
|
3
|
+
* Read all the package.json files in a monorepo. Only works for monorepos which
|
|
4
|
+
* use a supported workspace manager.
|
|
5
|
+
* @param cwd Start looking for the workspace manager config from here
|
|
6
|
+
*/
|
|
2
7
|
export declare function getPackageInfos(cwd: string): PackageInfos;
|
|
8
|
+
/**
|
|
9
|
+
* Read all the package.json files in a monorepo. Only works for monorepos which
|
|
10
|
+
* use a supported workspace manager.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
13
|
+
* without direct concurrency control.
|
|
14
|
+
*
|
|
15
|
+
* @param cwd Start looking for the workspace manager config from here
|
|
16
|
+
*/
|
|
3
17
|
export declare function getPackageInfosAsync(cwd: string): Promise<PackageInfos>;
|
package/lib/getPackageInfos.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getPackageInfosAsync = exports.getPackageInfos = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const infoFromPackageJson_1 = require("./infoFromPackageJson");
|
|
10
4
|
const getWorkspaces_1 = require("./workspaces/getWorkspaces");
|
|
5
|
+
const readPackageInfo_1 = require("./workspaces/readPackageInfo");
|
|
6
|
+
/**
|
|
7
|
+
* Read all the package.json files in a monorepo. Only works for monorepos which
|
|
8
|
+
* use a supported workspace manager.
|
|
9
|
+
* @param cwd Start looking for the workspace manager config from here
|
|
10
|
+
*/
|
|
11
11
|
function getPackageInfos(cwd) {
|
|
12
12
|
const packageInfos = {};
|
|
13
13
|
const workspacePackages = (0, getWorkspaces_1.getWorkspaces)(cwd);
|
|
@@ -17,7 +17,7 @@ function getPackageInfos(cwd) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
const rootInfo =
|
|
20
|
+
const rootInfo = (0, readPackageInfo_1.readPackageInfo)(cwd);
|
|
21
21
|
if (rootInfo) {
|
|
22
22
|
packageInfos[rootInfo.name] = rootInfo;
|
|
23
23
|
}
|
|
@@ -25,6 +25,15 @@ function getPackageInfos(cwd) {
|
|
|
25
25
|
return packageInfos;
|
|
26
26
|
}
|
|
27
27
|
exports.getPackageInfos = getPackageInfos;
|
|
28
|
+
/**
|
|
29
|
+
* Read all the package.json files in a monorepo. Only works for monorepos which
|
|
30
|
+
* use a supported workspace manager.
|
|
31
|
+
*
|
|
32
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
33
|
+
* without direct concurrency control.
|
|
34
|
+
*
|
|
35
|
+
* @param cwd Start looking for the workspace manager config from here
|
|
36
|
+
*/
|
|
28
37
|
async function getPackageInfosAsync(cwd) {
|
|
29
38
|
const packageInfos = {};
|
|
30
39
|
const workspacePackages = await (0, getWorkspaces_1.getWorkspacesAsync)(cwd);
|
|
@@ -34,7 +43,7 @@ async function getPackageInfosAsync(cwd) {
|
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
else {
|
|
37
|
-
const rootInfo =
|
|
46
|
+
const rootInfo = (0, readPackageInfo_1.readPackageInfo)(cwd);
|
|
38
47
|
if (rootInfo) {
|
|
39
48
|
packageInfos[rootInfo.name] = rootInfo;
|
|
40
49
|
}
|
|
@@ -42,16 +51,4 @@ async function getPackageInfosAsync(cwd) {
|
|
|
42
51
|
return packageInfos;
|
|
43
52
|
}
|
|
44
53
|
exports.getPackageInfosAsync = getPackageInfosAsync;
|
|
45
|
-
function tryReadRootPackageJson(cwd) {
|
|
46
|
-
const packageJsonPath = path_1.default.join(cwd, "package.json");
|
|
47
|
-
if (fs_1.default.existsSync(packageJsonPath)) {
|
|
48
|
-
try {
|
|
49
|
-
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, "utf-8"));
|
|
50
|
-
return (0, infoFromPackageJson_1.infoFromPackageJson)(packageJson, packageJsonPath);
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
throw new Error(`Invalid package.json file detected ${packageJsonPath}: ${e?.message || e}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
54
|
//# sourceMappingURL=getPackageInfos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageInfos.js","sourceRoot":"","sources":["../src/getPackageInfos.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPackageInfos.js","sourceRoot":"","sources":["../src/getPackageInfos.ts"],"names":[],"mappings":";;;AACA,8DAA+E;AAC/E,kEAA+D;AAE/D;;;;GAIG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,MAAM,YAAY,GAAiB,EAAE,CAAC;IACtC,MAAM,iBAAiB,GAAG,IAAA,6BAAa,EAAC,GAAG,CAAC,CAAC;IAE7C,IAAI,iBAAiB,CAAC,MAAM,EAAE;QAC5B,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;YACnC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;SAC1C;KACF;SAAM;QACL,MAAM,QAAQ,GAAG,IAAA,iCAAe,EAAC,GAAG,CAAC,CAAC;QACtC,IAAI,QAAQ,EAAE;YACZ,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;SACxC;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAhBD,0CAgBC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,oBAAoB,CAAC,GAAW;IACpD,MAAM,YAAY,GAAiB,EAAE,CAAC;IACtC,MAAM,iBAAiB,GAAG,MAAM,IAAA,kCAAkB,EAAC,GAAG,CAAC,CAAC;IAExD,IAAI,iBAAiB,CAAC,MAAM,EAAE;QAC5B,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;YACnC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;SAC1C;KACF;SAAM;QACL,MAAM,QAAQ,GAAG,IAAA,iCAAe,EAAC,GAAG,CAAC,CAAC;QACtC,IAAI,QAAQ,EAAE;YACZ,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;SACxC;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAhBD,oDAgBC"}
|
package/lib/getPackagePaths.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Given package folder globs (such as those from package.json `workspaces`) and a workspace root
|
|
3
|
-
* directory, get paths to actual package folders.
|
|
3
|
+
* directory, get absolute paths to actual package folders.
|
|
4
4
|
*/
|
|
5
5
|
export declare function getPackagePaths(root: string, packageGlobs: string[]): string[];
|
|
6
6
|
/**
|
|
7
7
|
* Given package folder globs (such as those from package.json `workspaces`) and a workspace root
|
|
8
|
-
* directory, get paths to actual package folders.
|
|
8
|
+
* directory, get absolute paths to actual package folders.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getPackagePathsAsync(root: string, packageGlobs: string[]): Promise<string[]>;
|
package/lib/getPackagePaths.js
CHANGED
|
@@ -15,7 +15,7 @@ const globOptions = {
|
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* Given package folder globs (such as those from package.json `workspaces`) and a workspace root
|
|
18
|
-
* directory, get paths to actual package folders.
|
|
18
|
+
* directory, get absolute paths to actual package folders.
|
|
19
19
|
*/
|
|
20
20
|
function getPackagePaths(root, packageGlobs) {
|
|
21
21
|
if ((0, isCachingEnabled_1.isCachingEnabled)() && packagePathsCache[root]) {
|
|
@@ -29,7 +29,7 @@ function getPackagePaths(root, packageGlobs) {
|
|
|
29
29
|
exports.getPackagePaths = getPackagePaths;
|
|
30
30
|
/**
|
|
31
31
|
* Given package folder globs (such as those from package.json `workspaces`) and a workspace root
|
|
32
|
-
* directory, get paths to actual package folders.
|
|
32
|
+
* directory, get absolute paths to actual package folders.
|
|
33
33
|
*/
|
|
34
34
|
async function getPackagePathsAsync(root, packageGlobs) {
|
|
35
35
|
if ((0, isCachingEnabled_1.isCachingEnabled)() && packagePathsCache[root]) {
|
|
@@ -1,41 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get a list of files with untracked changes.
|
|
3
|
+
* Throws an error on failure.
|
|
4
|
+
*
|
|
5
|
+
* @returns An array of file paths with untracked changes
|
|
6
|
+
*/
|
|
1
7
|
export declare function getUntrackedChanges(cwd: string): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Fetch from the given remote.
|
|
10
|
+
* Throws an error on failure.
|
|
11
|
+
*/
|
|
2
12
|
export declare function fetchRemote(remote: string, cwd: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Fetch from the given remote and branch.
|
|
15
|
+
* Throws an error on failure.
|
|
16
|
+
*/
|
|
3
17
|
export declare function fetchRemoteBranch(remote: string, remoteBranch: string, cwd: string): void;
|
|
4
18
|
/**
|
|
5
|
-
* Gets
|
|
6
|
-
*
|
|
19
|
+
* Gets file paths with changes that have not been staged yet.
|
|
20
|
+
* Throws an error on failure.
|
|
21
|
+
*
|
|
22
|
+
* @returns An array of relative file paths with unstaged changes
|
|
7
23
|
*/
|
|
8
24
|
export declare function getUnstagedChanges(cwd: string): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Gets file paths with changes between the current branch and the given branch.
|
|
27
|
+
* Throws an error on failure.
|
|
28
|
+
*
|
|
29
|
+
* @returns An array of relative file paths that have changed
|
|
30
|
+
*/
|
|
9
31
|
export declare function getChanges(branch: string, cwd: string): string[];
|
|
10
32
|
/**
|
|
11
|
-
* Gets
|
|
33
|
+
* Gets file paths with changes between the branch and the merge-base.
|
|
34
|
+
*
|
|
35
|
+
* @returns An array of relative file paths that have changed
|
|
12
36
|
*/
|
|
13
37
|
export declare function getBranchChanges(branch: string, cwd: string): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Gets file paths with changes between two git references (commits, branches, tags).
|
|
40
|
+
* Throws an error on failure.
|
|
41
|
+
*
|
|
42
|
+
* @param fromRef - The starting reference
|
|
43
|
+
* @param toRef - The ending reference
|
|
44
|
+
* @param options - Additional git diff options
|
|
45
|
+
* @param pattern - Optional file pattern to filter results
|
|
46
|
+
* @param cwd - The working directory
|
|
47
|
+
* @returns An array of file paths that have changed
|
|
48
|
+
*/
|
|
14
49
|
export declare function getChangesBetweenRefs(fromRef: string, toRef: string, options: string[], pattern: string, cwd: string): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Gets all files with staged changes (files added to the index).
|
|
52
|
+
* Throws an error on failure.
|
|
53
|
+
*
|
|
54
|
+
* @returns An array of relative file paths that have been staged
|
|
55
|
+
*/
|
|
15
56
|
export declare function getStagedChanges(cwd: string): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Gets recent commit messages between the specified branch and HEAD.
|
|
59
|
+
* Returns an empty array if the operation fails.
|
|
60
|
+
*
|
|
61
|
+
* @returns An array of commit message strings
|
|
62
|
+
*/
|
|
16
63
|
export declare function getRecentCommitMessages(branch: string, cwd: string): string[];
|
|
64
|
+
/**
|
|
65
|
+
* Gets the user email from the git config.
|
|
66
|
+
* @returns The email string if found, null otherwise
|
|
67
|
+
*/
|
|
17
68
|
export declare function getUserEmail(cwd: string): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the current branch name.
|
|
71
|
+
* @returns The branch name if successful, null otherwise
|
|
72
|
+
*/
|
|
18
73
|
export declare function getBranchName(cwd: string): string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Gets the full reference path for a given branch.
|
|
76
|
+
* @param branch - The short branch name (e.g., `branch-name`)
|
|
77
|
+
* @returns The full branch reference (e.g., `refs/heads/branch-name`) if found, null otherwise
|
|
78
|
+
*/
|
|
19
79
|
export declare function getFullBranchRef(branch: string, cwd: string): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Gets the short branch name from a full branch reference.
|
|
82
|
+
* Note this may not work properly for the current branch.
|
|
83
|
+
* @param fullBranchRef - The full branch reference (e.g., `refs/heads/branch-name`)
|
|
84
|
+
* @returns The short branch name if successful, null otherwise
|
|
85
|
+
*/
|
|
20
86
|
export declare function getShortBranchName(fullBranchRef: string, cwd: string): string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Gets the current commit hash (SHA).
|
|
89
|
+
* @returns The hash if successful, null otherwise
|
|
90
|
+
*/
|
|
21
91
|
export declare function getCurrentHash(cwd: string): string | null;
|
|
22
92
|
/**
|
|
23
93
|
* Get the commit hash in which the file was first added.
|
|
94
|
+
* @returns The commit hash if found, undefined otherwise
|
|
24
95
|
*/
|
|
25
96
|
export declare function getFileAddedHash(filename: string, cwd: string): string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Initializes a git repository in the specified directory.
|
|
99
|
+
* Optionally sets user email and username if not already configured.
|
|
100
|
+
* Throws an error if required email or username is not provided and not already configured.
|
|
101
|
+
*
|
|
102
|
+
* @param cwd - The directory to initialize the git repository in
|
|
103
|
+
* @param email - Optional email to set in git config
|
|
104
|
+
* @param username - Optional username to set in git config
|
|
105
|
+
*/
|
|
26
106
|
export declare function init(cwd: string, email?: string, username?: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Stages files matching the given patterns.
|
|
109
|
+
*/
|
|
27
110
|
export declare function stage(patterns: string[], cwd: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Creates a commit with the given message and optional git commit options.
|
|
113
|
+
* Throws an error on failure.
|
|
114
|
+
*
|
|
115
|
+
* @param message - The commit message
|
|
116
|
+
* @param cwd - The working directory
|
|
117
|
+
* @param options - Additional git commit options
|
|
118
|
+
*/
|
|
28
119
|
export declare function commit(message: string, cwd: string, options?: string[]): void;
|
|
120
|
+
/**
|
|
121
|
+
* Stages files matching the given patterns and creates a commit with the specified message.
|
|
122
|
+
* Convenience function that combines `stage()` and `commit()`.
|
|
123
|
+
* Throws an error on commit failure.
|
|
124
|
+
*
|
|
125
|
+
* @param patterns - File patterns to stage
|
|
126
|
+
* @param message - The commit message
|
|
127
|
+
* @param cwd - The working directory
|
|
128
|
+
* @param commitOptions - Additional git commit options
|
|
129
|
+
*/
|
|
29
130
|
export declare function stageAndCommit(patterns: string[], message: string, cwd: string, commitOptions?: string[]): void;
|
|
131
|
+
/**
|
|
132
|
+
* Reverts all local changes (both staged and unstaged) by stashing them and then dropping the stash.
|
|
133
|
+
* @returns True if the revert was successful, false otherwise
|
|
134
|
+
*/
|
|
30
135
|
export declare function revertLocalChanges(cwd: string): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Attempts to determine the parent branch of the current branch using `git show-branch`.
|
|
138
|
+
*
|
|
139
|
+
* @returns The parent branch name if found, null otherwise
|
|
140
|
+
*/
|
|
31
141
|
export declare function getParentBranch(cwd: string): string | null;
|
|
142
|
+
/**
|
|
143
|
+
* Gets the remote tracking branch for the specified branch.
|
|
144
|
+
*
|
|
145
|
+
* @returns The remote branch name (e.g., `origin/main`) if found, null otherwise
|
|
146
|
+
*/
|
|
32
147
|
export declare function getRemoteBranch(branch: string, cwd: string): string | null;
|
|
148
|
+
/**
|
|
149
|
+
* Parses a remote branch string (e.g., `origin/main`) into its components.
|
|
150
|
+
*
|
|
151
|
+
* @param branch - The remote branch string to parse (e.g., `origin/main`)
|
|
152
|
+
*/
|
|
33
153
|
export declare function parseRemoteBranch(branch: string): {
|
|
154
|
+
/** Remote name, e.g. `origin` */
|
|
34
155
|
remote: string;
|
|
156
|
+
/** Remote branch name, e.g. `main` */
|
|
35
157
|
remoteBranch: string;
|
|
36
158
|
};
|
|
37
159
|
/**
|
|
38
160
|
* Gets the default branch based on `git config init.defaultBranch`, falling back to `master`.
|
|
39
161
|
*/
|
|
40
162
|
export declare function getDefaultBranch(cwd: string): string;
|
|
163
|
+
/**
|
|
164
|
+
* Lists all tracked files matching the given patterns.
|
|
165
|
+
*
|
|
166
|
+
* @param patterns - File patterns to match (passed to git ls-files)
|
|
167
|
+
* @param cwd - The working directory
|
|
168
|
+
* @returns An array of file paths, or an empty array if no files are found
|
|
169
|
+
*/
|
|
41
170
|
export declare function listAllTrackedFiles(patterns: string[], cwd: string): string[];
|
package/lib/git/gitUtilities.js
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.listAllTrackedFiles = exports.getDefaultBranch = exports.parseRemoteBranch = exports.getRemoteBranch = exports.getParentBranch = exports.revertLocalChanges = exports.stageAndCommit = exports.commit = exports.stage = exports.init = exports.getFileAddedHash = exports.getCurrentHash = exports.getShortBranchName = exports.getFullBranchRef = exports.getBranchName = exports.getUserEmail = exports.getRecentCommitMessages = exports.getStagedChanges = exports.getChangesBetweenRefs = exports.getBranchChanges = exports.getChanges = exports.getUnstagedChanges = exports.fetchRemoteBranch = exports.fetchRemote = exports.getUntrackedChanges = void 0;
|
|
8
8
|
const git_1 = require("./git");
|
|
9
|
+
/**
|
|
10
|
+
* Get a list of files with untracked changes.
|
|
11
|
+
* Throws an error on failure.
|
|
12
|
+
*
|
|
13
|
+
* @returns An array of file paths with untracked changes
|
|
14
|
+
*/
|
|
9
15
|
function getUntrackedChanges(cwd) {
|
|
10
16
|
try {
|
|
11
17
|
return processGitOutput((0, git_1.git)(["ls-files", "--others", "--exclude-standard"], { cwd }));
|
|
@@ -15,6 +21,10 @@ function getUntrackedChanges(cwd) {
|
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
exports.getUntrackedChanges = getUntrackedChanges;
|
|
24
|
+
/**
|
|
25
|
+
* Fetch from the given remote.
|
|
26
|
+
* Throws an error on failure.
|
|
27
|
+
*/
|
|
18
28
|
function fetchRemote(remote, cwd) {
|
|
19
29
|
const results = (0, git_1.git)(["fetch", "--", remote], { cwd });
|
|
20
30
|
if (!results.success) {
|
|
@@ -22,6 +32,10 @@ function fetchRemote(remote, cwd) {
|
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
34
|
exports.fetchRemote = fetchRemote;
|
|
35
|
+
/**
|
|
36
|
+
* Fetch from the given remote and branch.
|
|
37
|
+
* Throws an error on failure.
|
|
38
|
+
*/
|
|
25
39
|
function fetchRemoteBranch(remote, remoteBranch, cwd) {
|
|
26
40
|
const results = (0, git_1.git)(["fetch", "--", remote, remoteBranch], { cwd });
|
|
27
41
|
if (!results.success) {
|
|
@@ -30,8 +44,10 @@ function fetchRemoteBranch(remote, remoteBranch, cwd) {
|
|
|
30
44
|
}
|
|
31
45
|
exports.fetchRemoteBranch = fetchRemoteBranch;
|
|
32
46
|
/**
|
|
33
|
-
* Gets
|
|
34
|
-
*
|
|
47
|
+
* Gets file paths with changes that have not been staged yet.
|
|
48
|
+
* Throws an error on failure.
|
|
49
|
+
*
|
|
50
|
+
* @returns An array of relative file paths with unstaged changes
|
|
35
51
|
*/
|
|
36
52
|
function getUnstagedChanges(cwd) {
|
|
37
53
|
try {
|
|
@@ -42,6 +58,12 @@ function getUnstagedChanges(cwd) {
|
|
|
42
58
|
}
|
|
43
59
|
}
|
|
44
60
|
exports.getUnstagedChanges = getUnstagedChanges;
|
|
61
|
+
/**
|
|
62
|
+
* Gets file paths with changes between the current branch and the given branch.
|
|
63
|
+
* Throws an error on failure.
|
|
64
|
+
*
|
|
65
|
+
* @returns An array of relative file paths that have changed
|
|
66
|
+
*/
|
|
45
67
|
function getChanges(branch, cwd) {
|
|
46
68
|
try {
|
|
47
69
|
return processGitOutput((0, git_1.git)(["--no-pager", "diff", "--relative", "--name-only", branch + "..."], { cwd }));
|
|
@@ -52,12 +74,25 @@ function getChanges(branch, cwd) {
|
|
|
52
74
|
}
|
|
53
75
|
exports.getChanges = getChanges;
|
|
54
76
|
/**
|
|
55
|
-
* Gets
|
|
77
|
+
* Gets file paths with changes between the branch and the merge-base.
|
|
78
|
+
*
|
|
79
|
+
* @returns An array of relative file paths that have changed
|
|
56
80
|
*/
|
|
57
81
|
function getBranchChanges(branch, cwd) {
|
|
58
|
-
return getChangesBetweenRefs(branch, "", [], "", cwd);
|
|
82
|
+
return getChangesBetweenRefs(/*from*/ branch, /*to*/ "", /*options*/ [], /*file pattern*/ "", cwd);
|
|
59
83
|
}
|
|
60
84
|
exports.getBranchChanges = getBranchChanges;
|
|
85
|
+
/**
|
|
86
|
+
* Gets file paths with changes between two git references (commits, branches, tags).
|
|
87
|
+
* Throws an error on failure.
|
|
88
|
+
*
|
|
89
|
+
* @param fromRef - The starting reference
|
|
90
|
+
* @param toRef - The ending reference
|
|
91
|
+
* @param options - Additional git diff options
|
|
92
|
+
* @param pattern - Optional file pattern to filter results
|
|
93
|
+
* @param cwd - The working directory
|
|
94
|
+
* @returns An array of file paths that have changed
|
|
95
|
+
*/
|
|
61
96
|
function getChangesBetweenRefs(fromRef, toRef, options, pattern, cwd) {
|
|
62
97
|
try {
|
|
63
98
|
return processGitOutput((0, git_1.git)([
|
|
@@ -75,6 +110,12 @@ function getChangesBetweenRefs(fromRef, toRef, options, pattern, cwd) {
|
|
|
75
110
|
}
|
|
76
111
|
}
|
|
77
112
|
exports.getChangesBetweenRefs = getChangesBetweenRefs;
|
|
113
|
+
/**
|
|
114
|
+
* Gets all files with staged changes (files added to the index).
|
|
115
|
+
* Throws an error on failure.
|
|
116
|
+
*
|
|
117
|
+
* @returns An array of relative file paths that have been staged
|
|
118
|
+
*/
|
|
78
119
|
function getStagedChanges(cwd) {
|
|
79
120
|
try {
|
|
80
121
|
return processGitOutput((0, git_1.git)(["--no-pager", "diff", "--relative", "--staged", "--name-only"], { cwd }));
|
|
@@ -84,6 +125,12 @@ function getStagedChanges(cwd) {
|
|
|
84
125
|
}
|
|
85
126
|
}
|
|
86
127
|
exports.getStagedChanges = getStagedChanges;
|
|
128
|
+
/**
|
|
129
|
+
* Gets recent commit messages between the specified branch and HEAD.
|
|
130
|
+
* Returns an empty array if the operation fails.
|
|
131
|
+
*
|
|
132
|
+
* @returns An array of commit message strings
|
|
133
|
+
*/
|
|
87
134
|
function getRecentCommitMessages(branch, cwd) {
|
|
88
135
|
try {
|
|
89
136
|
const results = (0, git_1.git)(["log", "--decorate", "--pretty=format:%s", `${branch}..HEAD`], { cwd });
|
|
@@ -100,6 +147,10 @@ function getRecentCommitMessages(branch, cwd) {
|
|
|
100
147
|
}
|
|
101
148
|
}
|
|
102
149
|
exports.getRecentCommitMessages = getRecentCommitMessages;
|
|
150
|
+
/**
|
|
151
|
+
* Gets the user email from the git config.
|
|
152
|
+
* @returns The email string if found, null otherwise
|
|
153
|
+
*/
|
|
103
154
|
function getUserEmail(cwd) {
|
|
104
155
|
try {
|
|
105
156
|
const results = (0, git_1.git)(["config", "user.email"], { cwd });
|
|
@@ -110,6 +161,10 @@ function getUserEmail(cwd) {
|
|
|
110
161
|
}
|
|
111
162
|
}
|
|
112
163
|
exports.getUserEmail = getUserEmail;
|
|
164
|
+
/**
|
|
165
|
+
* Gets the current branch name.
|
|
166
|
+
* @returns The branch name if successful, null otherwise
|
|
167
|
+
*/
|
|
113
168
|
function getBranchName(cwd) {
|
|
114
169
|
try {
|
|
115
170
|
const results = (0, git_1.git)(["rev-parse", "--abbrev-ref", "HEAD"], { cwd });
|
|
@@ -120,11 +175,22 @@ function getBranchName(cwd) {
|
|
|
120
175
|
}
|
|
121
176
|
}
|
|
122
177
|
exports.getBranchName = getBranchName;
|
|
178
|
+
/**
|
|
179
|
+
* Gets the full reference path for a given branch.
|
|
180
|
+
* @param branch - The short branch name (e.g., `branch-name`)
|
|
181
|
+
* @returns The full branch reference (e.g., `refs/heads/branch-name`) if found, null otherwise
|
|
182
|
+
*/
|
|
123
183
|
function getFullBranchRef(branch, cwd) {
|
|
124
184
|
const showRefResults = (0, git_1.git)(["show-ref", "--heads", branch], { cwd });
|
|
125
185
|
return showRefResults.success ? showRefResults.stdout.split(" ")[1] : null;
|
|
126
186
|
}
|
|
127
187
|
exports.getFullBranchRef = getFullBranchRef;
|
|
188
|
+
/**
|
|
189
|
+
* Gets the short branch name from a full branch reference.
|
|
190
|
+
* Note this may not work properly for the current branch.
|
|
191
|
+
* @param fullBranchRef - The full branch reference (e.g., `refs/heads/branch-name`)
|
|
192
|
+
* @returns The short branch name if successful, null otherwise
|
|
193
|
+
*/
|
|
128
194
|
function getShortBranchName(fullBranchRef, cwd) {
|
|
129
195
|
const showRefResults = (0, git_1.git)(["name-rev", "--name-only", fullBranchRef], {
|
|
130
196
|
cwd,
|
|
@@ -132,6 +198,10 @@ function getShortBranchName(fullBranchRef, cwd) {
|
|
|
132
198
|
return showRefResults.success ? showRefResults.stdout : null;
|
|
133
199
|
}
|
|
134
200
|
exports.getShortBranchName = getShortBranchName;
|
|
201
|
+
/**
|
|
202
|
+
* Gets the current commit hash (SHA).
|
|
203
|
+
* @returns The hash if successful, null otherwise
|
|
204
|
+
*/
|
|
135
205
|
function getCurrentHash(cwd) {
|
|
136
206
|
try {
|
|
137
207
|
const results = (0, git_1.git)(["rev-parse", "HEAD"], { cwd });
|
|
@@ -144,6 +214,7 @@ function getCurrentHash(cwd) {
|
|
|
144
214
|
exports.getCurrentHash = getCurrentHash;
|
|
145
215
|
/**
|
|
146
216
|
* Get the commit hash in which the file was first added.
|
|
217
|
+
* @returns The commit hash if found, undefined otherwise
|
|
147
218
|
*/
|
|
148
219
|
function getFileAddedHash(filename, cwd) {
|
|
149
220
|
const results = (0, git_1.git)(["rev-list", "--max-count=1", "HEAD", filename], { cwd });
|
|
@@ -153,6 +224,15 @@ function getFileAddedHash(filename, cwd) {
|
|
|
153
224
|
return undefined;
|
|
154
225
|
}
|
|
155
226
|
exports.getFileAddedHash = getFileAddedHash;
|
|
227
|
+
/**
|
|
228
|
+
* Initializes a git repository in the specified directory.
|
|
229
|
+
* Optionally sets user email and username if not already configured.
|
|
230
|
+
* Throws an error if required email or username is not provided and not already configured.
|
|
231
|
+
*
|
|
232
|
+
* @param cwd - The directory to initialize the git repository in
|
|
233
|
+
* @param email - Optional email to set in git config
|
|
234
|
+
* @param username - Optional username to set in git config
|
|
235
|
+
*/
|
|
156
236
|
function init(cwd, email, username) {
|
|
157
237
|
(0, git_1.git)(["init"], { cwd });
|
|
158
238
|
const configLines = (0, git_1.git)(["config", "--list"], { cwd }).stdout.split("\n");
|
|
@@ -170,6 +250,9 @@ function init(cwd, email, username) {
|
|
|
170
250
|
}
|
|
171
251
|
}
|
|
172
252
|
exports.init = init;
|
|
253
|
+
/**
|
|
254
|
+
* Stages files matching the given patterns.
|
|
255
|
+
*/
|
|
173
256
|
function stage(patterns, cwd) {
|
|
174
257
|
try {
|
|
175
258
|
patterns.forEach((pattern) => {
|
|
@@ -181,6 +264,14 @@ function stage(patterns, cwd) {
|
|
|
181
264
|
}
|
|
182
265
|
}
|
|
183
266
|
exports.stage = stage;
|
|
267
|
+
/**
|
|
268
|
+
* Creates a commit with the given message and optional git commit options.
|
|
269
|
+
* Throws an error on failure.
|
|
270
|
+
*
|
|
271
|
+
* @param message - The commit message
|
|
272
|
+
* @param cwd - The working directory
|
|
273
|
+
* @param options - Additional git commit options
|
|
274
|
+
*/
|
|
184
275
|
function commit(message, cwd, options = []) {
|
|
185
276
|
try {
|
|
186
277
|
const commitResults = (0, git_1.git)(["commit", "-m", message, ...options], { cwd });
|
|
@@ -193,11 +284,25 @@ function commit(message, cwd, options = []) {
|
|
|
193
284
|
}
|
|
194
285
|
}
|
|
195
286
|
exports.commit = commit;
|
|
287
|
+
/**
|
|
288
|
+
* Stages files matching the given patterns and creates a commit with the specified message.
|
|
289
|
+
* Convenience function that combines `stage()` and `commit()`.
|
|
290
|
+
* Throws an error on commit failure.
|
|
291
|
+
*
|
|
292
|
+
* @param patterns - File patterns to stage
|
|
293
|
+
* @param message - The commit message
|
|
294
|
+
* @param cwd - The working directory
|
|
295
|
+
* @param commitOptions - Additional git commit options
|
|
296
|
+
*/
|
|
196
297
|
function stageAndCommit(patterns, message, cwd, commitOptions = []) {
|
|
197
298
|
stage(patterns, cwd);
|
|
198
299
|
commit(message, cwd, commitOptions);
|
|
199
300
|
}
|
|
200
301
|
exports.stageAndCommit = stageAndCommit;
|
|
302
|
+
/**
|
|
303
|
+
* Reverts all local changes (both staged and unstaged) by stashing them and then dropping the stash.
|
|
304
|
+
* @returns True if the revert was successful, false otherwise
|
|
305
|
+
*/
|
|
201
306
|
function revertLocalChanges(cwd) {
|
|
202
307
|
const stash = `workspace-tools_${new Date().getTime()}`;
|
|
203
308
|
(0, git_1.git)(["stash", "push", "-u", "-m", stash], { cwd });
|
|
@@ -216,6 +321,11 @@ function revertLocalChanges(cwd) {
|
|
|
216
321
|
return false;
|
|
217
322
|
}
|
|
218
323
|
exports.revertLocalChanges = revertLocalChanges;
|
|
324
|
+
/**
|
|
325
|
+
* Attempts to determine the parent branch of the current branch using `git show-branch`.
|
|
326
|
+
*
|
|
327
|
+
* @returns The parent branch name if found, null otherwise
|
|
328
|
+
*/
|
|
219
329
|
function getParentBranch(cwd) {
|
|
220
330
|
const branchName = getBranchName(cwd);
|
|
221
331
|
if (!branchName || branchName === "HEAD") {
|
|
@@ -231,6 +341,11 @@ function getParentBranch(cwd) {
|
|
|
231
341
|
return null;
|
|
232
342
|
}
|
|
233
343
|
exports.getParentBranch = getParentBranch;
|
|
344
|
+
/**
|
|
345
|
+
* Gets the remote tracking branch for the specified branch.
|
|
346
|
+
*
|
|
347
|
+
* @returns The remote branch name (e.g., `origin/main`) if found, null otherwise
|
|
348
|
+
*/
|
|
234
349
|
function getRemoteBranch(branch, cwd) {
|
|
235
350
|
const results = (0, git_1.git)(["rev-parse", "--abbrev-ref", "--symbolic-full-name", `${branch}@\{u\}`], { cwd });
|
|
236
351
|
if (results.success) {
|
|
@@ -239,6 +354,11 @@ function getRemoteBranch(branch, cwd) {
|
|
|
239
354
|
return null;
|
|
240
355
|
}
|
|
241
356
|
exports.getRemoteBranch = getRemoteBranch;
|
|
357
|
+
/**
|
|
358
|
+
* Parses a remote branch string (e.g., `origin/main`) into its components.
|
|
359
|
+
*
|
|
360
|
+
* @param branch - The remote branch string to parse (e.g., `origin/main`)
|
|
361
|
+
*/
|
|
242
362
|
function parseRemoteBranch(branch) {
|
|
243
363
|
const firstSlashPos = branch.indexOf("/", 0);
|
|
244
364
|
const remote = branch.substring(0, firstSlashPos);
|
|
@@ -258,16 +378,33 @@ function getDefaultBranch(cwd) {
|
|
|
258
378
|
return result.success ? result.stdout.trim() : "master";
|
|
259
379
|
}
|
|
260
380
|
exports.getDefaultBranch = getDefaultBranch;
|
|
381
|
+
/**
|
|
382
|
+
* Lists all tracked files matching the given patterns.
|
|
383
|
+
*
|
|
384
|
+
* @param patterns - File patterns to match (passed to git ls-files)
|
|
385
|
+
* @param cwd - The working directory
|
|
386
|
+
* @returns An array of file paths, or an empty array if no files are found
|
|
387
|
+
*/
|
|
261
388
|
function listAllTrackedFiles(patterns, cwd) {
|
|
262
389
|
const results = (0, git_1.git)(["ls-files", ...patterns], { cwd });
|
|
263
390
|
return results.success && results.stdout.trim() ? results.stdout.trim().split(/\n/) : [];
|
|
264
391
|
}
|
|
265
392
|
exports.listAllTrackedFiles = listAllTrackedFiles;
|
|
393
|
+
/**
|
|
394
|
+
* Processes git command output by splitting it into lines and filtering out empty lines and `node_modules`.
|
|
395
|
+
*
|
|
396
|
+
* If the command failed with stderr output, an error is thrown.
|
|
397
|
+
*
|
|
398
|
+
* @param output - The git command output to process
|
|
399
|
+
* @returns An array of lines (presumably file paths), or an empty array if the command failed
|
|
400
|
+
* without stderr output.
|
|
401
|
+
*/
|
|
266
402
|
function processGitOutput(output) {
|
|
267
403
|
if (!output.success) {
|
|
268
404
|
if (output.stderr) {
|
|
269
405
|
throw new Error(output.stderr);
|
|
270
406
|
}
|
|
407
|
+
// TODO: this inconsistency seems maybe not desirable?
|
|
271
408
|
return [];
|
|
272
409
|
}
|
|
273
410
|
return output.stdout
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitUtilities.js","sourceRoot":"","sources":["../../src/git/gitUtilities.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,+BAA+B;AAC/B,wDAAwD;AACxD,EAAE;;;AAEF,+BAAwD;AAExD,SAAgB,mBAAmB,CAAC,GAAW;IAC7C,IAAI;QACF,OAAO,gBAAgB,CAAC,IAAA,SAAG,EAAC,CAAC,UAAU,EAAE,UAAU,EAAE,oBAAoB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;KACvF;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,cAAQ,CAAC,mDAAmD,EAAE,CAAC,CAAC,CAAC;KAC5E;AACH,CAAC;AAND,kDAMC;AAED,SAAgB,WAAW,CAAC,MAAc,EAAE,GAAW;IACrD,MAAM,OAAO,GAAG,IAAA,SAAG,EAAC,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAEtD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,MAAM,IAAI,cAAQ,CAAC,wBAAwB,MAAM,GAAG,CAAC,CAAC;KACvD;AACH,CAAC;AAND,kCAMC;AAED,SAAgB,iBAAiB,CAAC,MAAc,EAAE,YAAoB,EAAE,GAAW;IACjF,MAAM,OAAO,GAAG,IAAA,SAAG,EAAC,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAEpE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,MAAM,IAAI,cAAQ,CAAC,wBAAwB,YAAY,kBAAkB,MAAM,GAAG,CAAC,CAAC;KACrF;AACH,CAAC;AAND,8CAMC;AAED
|
|
1
|
+
{"version":3,"file":"gitUtilities.js","sourceRoot":"","sources":["../../src/git/gitUtilities.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,+BAA+B;AAC/B,wDAAwD;AACxD,EAAE;;;AAEF,+BAAwD;AAExD;;;;;GAKG;AACH,SAAgB,mBAAmB,C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EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PackageDependenciesOptions } from "./getPackageDependencies";
|
|
2
|
-
import { PackageInfos } from "../types/PackageInfo";
|
|
2
|
+
import type { PackageInfos } from "../types/PackageInfo";
|
|
3
3
|
export interface DependencyMap {
|
|
4
4
|
dependencies: Map<string, Set<string>>;
|
|
5
5
|
dependents: Map<string, Set<string>>;
|