git-er-done 0.1.12 → 0.1.14
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/package.json +49 -13
- package/src/git/getDiffFormatted.js +7 -6
- package/types/git/getDiffFormatted.d.ts +14 -13
package/package.json
CHANGED
|
@@ -1,22 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-er-done",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Utility for dealing with modified, created, deleted files since a git commit",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"./get-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"./get-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./types/index.d.ts",
|
|
10
|
+
"default": "./src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./get-commit": {
|
|
13
|
+
"types": "./types/git/commits/getCommit.d.ts",
|
|
14
|
+
"default": "./src/git/commits/getCommit.js"
|
|
15
|
+
},
|
|
16
|
+
"./get-all-commits": {
|
|
17
|
+
"types": "./types/git/commits/getAllCommits.d.ts",
|
|
18
|
+
"default": "./src/git/commits/getAllCommits.js"
|
|
19
|
+
},
|
|
20
|
+
"./get-first-commit": {
|
|
21
|
+
"types": "./types/git/commits/getFirstCommit.d.ts",
|
|
22
|
+
"default": "./src/git/commits/getFirstCommit.js"
|
|
23
|
+
},
|
|
24
|
+
"./get-last-commit": {
|
|
25
|
+
"types": "./types/git/commits/getLastCommit.d.ts",
|
|
26
|
+
"default": "./src/git/commits/getLastCommit.js"
|
|
27
|
+
},
|
|
28
|
+
"./get-details": {
|
|
29
|
+
"types": "./types/git/getDetails.d.ts",
|
|
30
|
+
"default": "./src/git/getDetails.js"
|
|
31
|
+
},
|
|
32
|
+
"./get-root": {
|
|
33
|
+
"types": "./types/git/getGitRoot.d.ts",
|
|
34
|
+
"default": "./src/git/getGitRoot.js"
|
|
35
|
+
},
|
|
36
|
+
"./get-files": {
|
|
37
|
+
"types": "./types/git/getGitFiles.d.ts",
|
|
38
|
+
"default": "./src/git/getGitFiles.js"
|
|
39
|
+
},
|
|
40
|
+
"./get-file-at-commit": {
|
|
41
|
+
"types": "./types/git/getFileAtCommit.d.ts",
|
|
42
|
+
"default": "./src/git/getFileAtCommit.js"
|
|
43
|
+
},
|
|
44
|
+
"./get-diff-formatted": {
|
|
45
|
+
"types": "./types/git/getDiffFormatted.d.ts",
|
|
46
|
+
"default": "./src/git/getDiffFormatted.js"
|
|
47
|
+
},
|
|
48
|
+
"./get-file-dates": {
|
|
49
|
+
"types": "./types/git/dates/getFileDates.d.ts",
|
|
50
|
+
"default": "./src/git/dates/getFileDates.js"
|
|
51
|
+
},
|
|
52
|
+
"./get-remotes": {
|
|
53
|
+
"types": "./types/git/remotes/getRemotes.d.ts",
|
|
54
|
+
"default": "./src/git/remotes/getRemotes.js"
|
|
55
|
+
}
|
|
20
56
|
},
|
|
21
57
|
"scripts": {
|
|
22
58
|
"test": "uvu . \\.test\\.js$",
|
|
@@ -55,12 +55,13 @@ function getLongestLineLength(diff) {
|
|
|
55
55
|
* Get formatted diff for a specific file
|
|
56
56
|
* @param {Object} options - Options for getting formatted diff
|
|
57
57
|
* @param {string} options.filePath - Relative path from git root
|
|
58
|
-
* @param {string} options.gitRootDir - Absolute path to git root directory
|
|
59
|
-
* @param {string} options.baseBranch - Base branch to compare against
|
|
60
|
-
* @param {boolean} options.shrinkToLongestLine - Auto-calculate width based on longest line
|
|
61
|
-
* @param {number} options.leftMargin - Number of spaces to add to the left of each line
|
|
62
|
-
* @param {number} options.width - Width of the diff output (ignored if shrinkToLongestLine is true)
|
|
63
|
-
* @param {boolean} options.hideHeader - Remove the file path header from the diff
|
|
58
|
+
* @param {string} [options.gitRootDir] - Absolute path to git root directory (defaults to detected git root)
|
|
59
|
+
* @param {string} [options.baseBranch='master'] - Base branch to compare against
|
|
60
|
+
* @param {boolean} [options.shrinkToLongestLine=false] - Auto-calculate width based on longest line
|
|
61
|
+
* @param {number} [options.leftMargin=0] - Number of spaces to add to the left of each line
|
|
62
|
+
* @param {number} [options.width=140] - Width of the diff output (ignored if shrinkToLongestLine is true)
|
|
63
|
+
* @param {boolean} [options.hideHeader=false] - Remove the file path header from the diff
|
|
64
|
+
* @returns {Promise<string | null>} Formatted diff string or null if no diff
|
|
64
65
|
*/
|
|
65
66
|
async function getFormattedDiff({
|
|
66
67
|
filePath,
|
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
* Get formatted diff for a specific file
|
|
3
3
|
* @param {Object} options - Options for getting formatted diff
|
|
4
4
|
* @param {string} options.filePath - Relative path from git root
|
|
5
|
-
* @param {string} options.gitRootDir - Absolute path to git root directory
|
|
6
|
-
* @param {string} options.baseBranch - Base branch to compare against
|
|
7
|
-
* @param {boolean} options.shrinkToLongestLine - Auto-calculate width based on longest line
|
|
8
|
-
* @param {number} options.leftMargin - Number of spaces to add to the left of each line
|
|
9
|
-
* @param {number} options.width - Width of the diff output (ignored if shrinkToLongestLine is true)
|
|
10
|
-
* @param {boolean} options.hideHeader - Remove the file path header from the diff
|
|
5
|
+
* @param {string} [options.gitRootDir] - Absolute path to git root directory (defaults to detected git root)
|
|
6
|
+
* @param {string} [options.baseBranch='master'] - Base branch to compare against
|
|
7
|
+
* @param {boolean} [options.shrinkToLongestLine=false] - Auto-calculate width based on longest line
|
|
8
|
+
* @param {number} [options.leftMargin=0] - Number of spaces to add to the left of each line
|
|
9
|
+
* @param {number} [options.width=140] - Width of the diff output (ignored if shrinkToLongestLine is true)
|
|
10
|
+
* @param {boolean} [options.hideHeader=false] - Remove the file path header from the diff
|
|
11
|
+
* @returns {Promise<string | null>} Formatted diff string or null if no diff
|
|
11
12
|
*/
|
|
12
13
|
export function getFormattedDiff({ filePath, gitRootDir, baseBranch, shrinkToLongestLine, leftMargin, width, hideHeader }: {
|
|
13
14
|
filePath: string;
|
|
14
|
-
gitRootDir
|
|
15
|
-
baseBranch
|
|
16
|
-
shrinkToLongestLine
|
|
17
|
-
leftMargin
|
|
18
|
-
width
|
|
19
|
-
hideHeader
|
|
20
|
-
}): Promise<
|
|
15
|
+
gitRootDir?: string;
|
|
16
|
+
baseBranch?: string;
|
|
17
|
+
shrinkToLongestLine?: boolean;
|
|
18
|
+
leftMargin?: number;
|
|
19
|
+
width?: number;
|
|
20
|
+
hideHeader?: boolean;
|
|
21
|
+
}): Promise<string | null>;
|