@simbo/git-changes 3.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +1 -1
- package/dist/get-git-changes.js +7 -8
- package/dist/get-git-changes.js.map +1 -1
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @simbo/git-changes
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d6894f3: Run `git status` with `@simbo/git-exec` instead of `execa`.
|
|
8
|
+
|
|
9
|
+
- `execa` is no longer a dependency.
|
|
10
|
+
- If `git status` fails, the message after `Failed to get Git changes:` is the
|
|
11
|
+
message of the `GitError`, with the command, the exit code, and the standard
|
|
12
|
+
error output, and `cause` is that `GitError` instead of an `ExecaError`.
|
|
13
|
+
|
|
14
|
+
Code that matches the error message beyond its prefix or checks `cause` for an
|
|
15
|
+
`ExecaError` needs an update.
|
|
16
|
+
|
|
17
|
+
## 4.0.0
|
|
18
|
+
|
|
19
|
+
### Major Changes
|
|
20
|
+
|
|
21
|
+
- 19c8dc1: Require Node.js ^24.15.0 || >=26.0.0 across all packages, as Node.js
|
|
22
|
+
22 reaches its end of life on 2027-04-30.
|
|
23
|
+
|
|
24
|
+
- Remove `^22.22.2` from `engines.node` in every package.
|
|
25
|
+
- Update the requirements in the package READMEs.
|
|
26
|
+
|
|
27
|
+
Node.js 22 is no longer supported. Upgrade to Node.js ^24.15.0 or >=26.0.0
|
|
28
|
+
before updating these packages.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 19c8dc1: Point the `repository` field of the manifest to the workspace folder.
|
|
33
|
+
|
|
34
|
+
- `repository` uses the object form with `type`, `url`, and `directory`, so
|
|
35
|
+
npm links the package folder and resolves relative links in the README from
|
|
36
|
+
there.
|
|
37
|
+
- `packages-changelog` gets the field for the first time.
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [19c8dc1]
|
|
40
|
+
- Updated dependencies [19c8dc1]
|
|
41
|
+
- @simbo/find-git-repository-root@3.0.0
|
|
42
|
+
|
|
3
43
|
## 3.0.1
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/README.md
CHANGED
package/dist/get-git-changes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cwd } from 'node:process';
|
|
2
2
|
import { findGitRepositoryRoot } from '@simbo/find-git-repository-root';
|
|
3
|
-
import {
|
|
3
|
+
import { gitBuffer } from '@simbo/git-exec';
|
|
4
4
|
import { parseGitStatusOutput } from './parse-git-status-output.js';
|
|
5
5
|
/**
|
|
6
6
|
* Gets the uncommitted Git changes in the specified working directory.
|
|
@@ -32,16 +32,15 @@ export async function getGitChanges(workingDir = cwd()) {
|
|
|
32
32
|
* 'UU conflicted.ts\0'
|
|
33
33
|
* 'R new.ts\0old.ts\0'
|
|
34
34
|
* 'C copied.ts\0source.ts\0'
|
|
35
|
+
*
|
|
36
|
+
* The output is read as buffer, because `git()` trims the leading space of
|
|
37
|
+
* the first entry.
|
|
35
38
|
*/
|
|
36
|
-
const
|
|
37
|
-
return parseGitStatusOutput(output);
|
|
39
|
+
const output = await gitBuffer(['status', '--porcelain', '--null', '--untracked-files=all'], { cwd: repoRoot });
|
|
40
|
+
return parseGitStatusOutput(output.toString('utf8'));
|
|
38
41
|
}
|
|
39
42
|
catch (error) {
|
|
40
|
-
const reason = error instanceof
|
|
41
|
-
? error.shortMessage
|
|
42
|
-
: error instanceof Error
|
|
43
|
-
? error.message
|
|
44
|
-
: `Unknown error (${String(error)})`;
|
|
43
|
+
const reason = error instanceof Error ? error.message : `Unknown error (${String(error)})`;
|
|
45
44
|
throw new Error(`Failed to get Git changes: ${reason}`, { cause: error });
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-git-changes.js","sourceRoot":"","sources":["../src/get-git-changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-git-changes.js","sourceRoot":"","sources":["../src/get-git-changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAU,GAAG,GAAG,EAAE;IACpD,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAEzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,UAAU,oCAAoC,CAAC,CAAC;IACpF,CAAC;IAED,IAAI,CAAC;QACH;;;;;;;;;;;;;;;;;;;;;WAqBG;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,uBAAuB,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEhH,OAAO,oBAAoB,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QAC3F,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC","sourcesContent":["import { cwd } from 'node:process';\n\nimport { findGitRepositoryRoot } from '@simbo/find-git-repository-root';\nimport { gitBuffer } from '@simbo/git-exec';\n\nimport type { GitChange } from './git-changes.types.js';\nimport { parseGitStatusOutput } from './parse-git-status-output.js';\n\n/**\n * Gets the uncommitted Git changes in the specified working directory.\n *\n * @param workingDir - The working directory of the Git repository. Defaults to the current working directory.\n * @returns A ReadonlyMap of file paths to their corresponding GitChange objects.\n */\nexport async function getGitChanges(workingDir = cwd()): Promise<ReadonlyMap<string, GitChange>> {\n const repoRoot = await findGitRepositoryRoot(workingDir);\n\n if (!repoRoot) {\n throw new Error(`The directory \"${workingDir}\" is not part of a Git repository.`);\n }\n\n try {\n /**\n * This command provides a machine-readable, null-separated output of the\n * current status of the Git repository, including staged and unstaged changes,\n * as well as untracked files. Untracked directories are listed as individual\n * files, regardless of the `status.showUntrackedFiles` configuration.\n * Paths are relative to the repository root.\n *\n * Example output (renamed and copied entries list the new path first):\n * '?? untracked.ts\\0'\n * ' M unstaged-modified.ts\\0'\n * 'M staged-modified.ts\\0'\n * 'MM both-modified.ts\\0'\n * ' D unstaged-deleted.ts\\0'\n * 'A staged-added.ts\\0'\n * ' T type-changed.ts\\0'\n * 'UU conflicted.ts\\0'\n * 'R new.ts\\0old.ts\\0'\n * 'C copied.ts\\0source.ts\\0'\n *\n * The output is read as buffer, because `git()` trims the leading space of\n * the first entry.\n */\n const output = await gitBuffer(['status', '--porcelain', '--null', '--untracked-files=all'], { cwd: repoRoot });\n\n return parseGitStatusOutput(output.toString('utf8'));\n } catch (error) {\n const reason = error instanceof Error ? error.message : `Unknown error (${String(error)})`;\n throw new Error(`Failed to get Git changes: ${reason}`, { cause: error });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simbo/git-changes",
|
|
3
3
|
"description": "A library to read, parse and provide Git changes information from `git status` for a local repository.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|
|
7
7
|
"changes",
|
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
"homepage": "https://github.com/simbo/packages/tree/main/packages/git-changes",
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "github
|
|
22
|
+
"url": "git+https://github.com/simbo/packages.git",
|
|
23
|
+
"directory": "packages/git-changes"
|
|
23
24
|
},
|
|
24
25
|
"bugs": "https://github.com/simbo/packages/issues",
|
|
25
26
|
"engines": {
|
|
26
|
-
"node": "^
|
|
27
|
+
"node": "^24.15.0 || >=26.0.0"
|
|
27
28
|
},
|
|
28
29
|
"type": "module",
|
|
29
30
|
"exports": {
|
|
@@ -36,19 +37,20 @@
|
|
|
36
37
|
"README.md"
|
|
37
38
|
],
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@simbo/find-git-repository-root": "
|
|
40
|
-
"
|
|
40
|
+
"@simbo/find-git-repository-root": "3.0.0",
|
|
41
|
+
"@simbo/git-exec": "1.0.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@simbo/eslint-config": "
|
|
44
|
-
"@simbo/
|
|
44
|
+
"@simbo/eslint-config": "5.0.0",
|
|
45
|
+
"@simbo/git-fixture": "1.0.1",
|
|
46
|
+
"@simbo/tsconfig": "3.0.1",
|
|
45
47
|
"@types/node": "^24.19.2",
|
|
46
|
-
"@vitest/coverage-v8": "^5.1.
|
|
47
|
-
"@vitest/ui": "^5.1.
|
|
48
|
-
"eslint": "^10.
|
|
48
|
+
"@vitest/coverage-v8": "^5.1.1",
|
|
49
|
+
"@vitest/ui": "^5.1.1",
|
|
50
|
+
"eslint": "^10.15.0",
|
|
49
51
|
"jiti": "^2.7.0",
|
|
50
52
|
"typescript": "^6.0.3",
|
|
51
|
-
"vitest": "^5.1.
|
|
53
|
+
"vitest": "^5.1.1"
|
|
52
54
|
},
|
|
53
55
|
"scripts": {
|
|
54
56
|
"build": "tsc --project tsconfig.build.json",
|