@simbo/git-changes 1.0.1 → 1.0.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @simbo/git-changes
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 5d6bd64: improve types to reflect staged and unstaged states
8
+
3
9
  ## 1.0.1
4
10
 
5
11
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import type { GitChange } from './git-change.interface.js';
1
+ import type { GitChange } from './git-changes.types.js';
2
2
  /**
3
3
  * Gets the uncommitted Git changes in the specified working directory.
4
4
  *
@@ -0,0 +1,27 @@
1
+ import type { GitChangeStatus } from './git-change-status.enum.js';
2
+ export type GitChangeStagedStatus = GitChangeStatus.Added | GitChangeStatus.Modified | GitChangeStatus.Deleted | GitChangeStatus.Renamed | GitChangeStatus.Copied;
3
+ export type GitChangeUnstagedStatus = GitChangeStatus.Untracked | GitChangeStatus.Modified | GitChangeStatus.Deleted | GitChangeStatus.Renamed | GitChangeStatus.Copied;
4
+ /**
5
+ * Represents a change in a Git repository.
6
+ */
7
+ export interface GitChange<Staged extends GitChangeStagedStatus | undefined = GitChangeStagedStatus | undefined, Unstaged extends GitChangeUnstagedStatus | undefined = GitChangeUnstagedStatus | undefined> {
8
+ /**
9
+ * The file path of the change.
10
+ */
11
+ path: string;
12
+ /**
13
+ * The origin file path if the change is a rename or copy.
14
+ * This is only set for changes that involve renaming or copying files.
15
+ */
16
+ originPath?: Staged extends GitChangeStatus.Renamed | GitChangeStatus.Copied ? string : Unstaged extends GitChangeStatus.Renamed | GitChangeStatus.Copied ? string : undefined;
17
+ /**
18
+ * The status of the change when it is staged.
19
+ * This can be one of the GitChangeStatus values or undefined if not staged.
20
+ */
21
+ staged?: Staged;
22
+ /**
23
+ * The status of the change when it is unstaged.
24
+ * This can be one of the GitChangeStatus values or undefined if not unstaged.
25
+ */
26
+ unstaged?: Unstaged;
27
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=git-changes.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-changes.types.js","sourceRoot":"","sources":["../src/git-changes.types.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './get-git-changes.js';
2
2
  export * from './git-change-status.enum.js';
3
- export type * from './git-change.interface.js';
3
+ export type * from './git-changes.types.js';
4
4
  export * from './git-status-constants.js';
5
5
  export * from './parse-git-change-status.js';
6
6
  export * from './parse-git-status-output.js';
@@ -1,4 +1,4 @@
1
- import type { GitChange } from './git-change.interface.js';
1
+ import type { GitChange } from './git-changes.types.js';
2
2
  /**
3
3
  * Parses a Git change status string into staged and unstaged statuses.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { GitChange } from './git-change.interface.js';
1
+ import type { GitChange } from './git-changes.types.js';
2
2
  /**
3
3
  * Parses the output of the git status command and returns a map of Git changes.
4
4
  *
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": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "keywords": [
6
6
  "git",
7
7
  "changes",
@@ -47,9 +47,9 @@
47
47
  "prettier": "^3.7.4",
48
48
  "typescript": "^5.9.3",
49
49
  "vitest": "^3.2.4",
50
- "@simbo/eslint-config": "2.0.3",
51
- "@simbo/prettier-config": "2.0.0",
52
- "@simbo/tsconfig": "1.0.4"
50
+ "@simbo/eslint-config": "2.0.4",
51
+ "@simbo/tsconfig": "1.0.4",
52
+ "@simbo/prettier-config": "2.0.0"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "tsc --project tsconfig.build.json",
@@ -1,25 +0,0 @@
1
- import type { GitChangeStatus } from './git-change-status.enum.js';
2
- /**
3
- * Represents a change in a Git repository.
4
- */
5
- export interface GitChange {
6
- /**
7
- * The file path of the change.
8
- */
9
- path: string;
10
- /**
11
- * The origin file path if the change is a rename or copy.
12
- * This is only set for changes that involve renaming or copying files.
13
- */
14
- originPath?: string;
15
- /**
16
- * The status of the change when it is staged.
17
- * This can be one of the GitChangeStatus values or undefined if not staged.
18
- */
19
- staged?: GitChangeStatus.Added | GitChangeStatus.Modified | GitChangeStatus.Deleted | GitChangeStatus.Renamed | GitChangeStatus.Copied;
20
- /**
21
- * The status of the change when it is unstaged.
22
- * This can be one of the GitChangeStatus values or undefined if not unstaged.
23
- */
24
- unstaged?: GitChangeStatus.Untracked | GitChangeStatus.Modified | GitChangeStatus.Deleted | GitChangeStatus.Renamed | GitChangeStatus.Copied;
25
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=git-change.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-change.interface.js","sourceRoot":"","sources":["../src/git-change.interface.ts"],"names":[],"mappings":""}