@code-pushup/utils 0.22.7 → 0.23.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/index.js CHANGED
@@ -1133,10 +1133,9 @@ async function toGitPath(path, git = simpleGit()) {
1133
1133
  return formatGitPath(path, gitRoot);
1134
1134
  }
1135
1135
  function validateCommitData(commitData, options = {}) {
1136
- const { throwError = false } = options;
1137
1136
  if (!commitData) {
1138
1137
  const msg = "no commit data available";
1139
- if (throwError) {
1138
+ if (options?.throwError) {
1140
1139
  throw new Error(msg);
1141
1140
  } else {
1142
1141
  console.warn(msg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/utils",
3
- "version": "0.22.7",
3
+ "version": "0.23.0",
4
4
  "dependencies": {
5
5
  "@code-pushup/models": "*",
6
6
  "bundle-require": "^4.0.1",
package/src/lib/git.d.ts CHANGED
@@ -14,5 +14,10 @@ export declare function getGitRoot(git?: import("simple-git").SimpleGit): Promis
14
14
  export declare function formatGitPath(path: string, gitRoot: string): string;
15
15
  export declare function toGitPath(path: string, git?: import("simple-git").SimpleGit): Promise<string>;
16
16
  export declare function validateCommitData(commitData: CommitData | null, options?: {
17
- throwError?: boolean;
17
+ throwError?: true;
18
18
  }): commitData is CommitData;
19
+ export declare function guardAgainstLocalChanges(git?: import("simple-git").SimpleGit): Promise<void>;
20
+ export declare function getCurrentBranchOrTag(git?: import("simple-git").SimpleGit): Promise<string>;
21
+ export declare function safeCheckout(branchOrHash: string, options?: {
22
+ forceCleanStatus?: true;
23
+ }, git?: import("simple-git").SimpleGit): Promise<void>;