watskeburt 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- export const VERSION = "0.11.3";
1
+ export const VERSION = "0.11.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watskeburt",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "List files changed since a git revision",
5
5
  "keywords": [
6
6
  "git",
@@ -45,12 +45,12 @@
45
45
  ],
46
46
  "devDependencies": {
47
47
  "@types/mocha": "10.0.1",
48
- "@types/node": "20.2.5",
49
- "@typescript-eslint/eslint-plugin": "5.59.7",
50
- "c8": "7.14.0",
51
- "dependency-cruiser": "13.0.2",
52
- "esbuild": "0.17.19",
53
- "eslint": "8.41.0",
48
+ "@types/node": "20.3.1",
49
+ "@typescript-eslint/eslint-plugin": "5.59.11",
50
+ "c8": "8.0.0",
51
+ "dependency-cruiser": "13.0.3",
52
+ "esbuild": "0.18.4",
53
+ "eslint": "8.43.0",
54
54
  "eslint-config-moving-meadow": "4.0.2",
55
55
  "eslint-config-prettier": "8.8.0",
56
56
  "eslint-plugin-budapestian": "5.0.1",
@@ -64,8 +64,8 @@
64
64
  "npm-run-all": "4.1.5",
65
65
  "prettier": "2.8.8",
66
66
  "ts-node": "10.9.1",
67
- "typescript": "5.0.4",
68
- "upem": "7.3.2"
67
+ "typescript": "5.1.3",
68
+ "upem": "8.0.0"
69
69
  },
70
70
  "engines": {
71
71
  "node": "^16.19||^18.11||>=20"
@@ -29,12 +29,12 @@ export interface IChange {
29
29
 
30
30
  export type outputTypeType = "regex" | "json" | "object";
31
31
 
32
- export interface IOptions {
32
+ export interface IFormatOptions {
33
33
  /**
34
34
  * The type of output to deliver. Defaults to "object" - in which case
35
35
  * the listSync function returns an IChange[] object
36
36
  */
37
- outputType?: outputTypeType;
37
+ outputType: "regex" | "json";
38
38
  /**
39
39
  * When true _only_ takes already tracked files into account.
40
40
  * When false also takes untracked files into account.
@@ -44,6 +44,23 @@ export interface IOptions {
44
44
  trackedOnly?: boolean;
45
45
  }
46
46
 
47
+ export interface IInternalOptions {
48
+ /**
49
+ * The type of output to deliver. Defaults to "object" - in which case
50
+ * the listSync function returns an IChange[] object
51
+ */
52
+ outputType?: "object";
53
+ /**
54
+ * When true _only_ takes already tracked files into account.
55
+ * When false also takes untracked files into account.
56
+ *
57
+ * Defaults to false.
58
+ */
59
+ trackedOnly?: boolean;
60
+ }
61
+
62
+ export type IOptions = IFormatOptions | IInternalOptions;
63
+
47
64
  /**
48
65
  * returns a list of files changed since pOldRevision.
49
66
  *
@@ -59,11 +76,49 @@ export interface IOptions {
59
76
  export function listSync(
60
77
  pOldRevision?: string,
61
78
  pNewRevision?: string,
62
- pOptions?: IOptions
63
- ): IChange[] | string;
79
+ pOptions?: IInternalOptions
80
+ ): IChange[];
64
81
 
65
82
  /**
66
- * returns a list of files changed since pOldRevision.
83
+ * returns a list of files changed since pOldRevision formatted into a string
84
+ * as pOptions.outputType
85
+ *
86
+ * @param pOldRevision The revision against which to compare. E.g. a commit-hash,
87
+ * a branch or a tag. When not passed defaults to the _current_
88
+ * commit hash (if there's any)
89
+ * @param pNewRevision Newer revision against which to compare. Leave out or pass
90
+ * null when you want to compare against the working tree
91
+ * @param pOptions Options that influence how the changes are returned and that
92
+ * filter what is returned and
93
+ * @throws {Error}
94
+ */
95
+ export function listSync(
96
+ pOldRevision?: string,
97
+ pNewRevision?: string,
98
+ pOptions?: IFormatOptions
99
+ ): string;
100
+
101
+ /**
102
+ * returns promise of a list of files changed since pOldRevision.
103
+ *
104
+ * @param pOldRevision The revision against which to compare. E.g. a commit-hash,
105
+ * a branch or a tag. When not passed defaults to the _current_
106
+ * commit hash (if there's any)
107
+ * @param pNewRevision Newer revision against which to compare. Leave out or pass
108
+ * null when you want to compare against the working tree
109
+ * @param pOptions Options that influence how the changes are returned and that
110
+ * filter what is returned and
111
+ * @throws {Error}
112
+ */
113
+ export function list(
114
+ pOldRevision?: string,
115
+ pNewRevision?: string,
116
+ pOptions?: IInternalOptions
117
+ ): Promise<IChange[]>;
118
+
119
+ /**
120
+ * returns promise a list of files changed since pOldRevision, formatted into a
121
+ * string as a pOptions.outputType
67
122
  *
68
123
  * @param pOldRevision The revision against which to compare. E.g. a commit-hash,
69
124
  * a branch or a tag. When not passed defaults to the _current_
@@ -77,8 +132,8 @@ export function listSync(
77
132
  export function list(
78
133
  pOldRevision?: string,
79
134
  pNewRevision?: string,
80
- pOptions?: IOptions
81
- ): Promise<IChange[] | string>;
135
+ pOptions?: IFormatOptions
136
+ ): Promise<string>;
82
137
 
83
138
  /**
84
139
  * Returns the SHA1 of the current HEAD