@allurereport/git 3.20.1 → 3.22.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.
@@ -0,0 +1,7 @@
1
+ export type GitHead = {
2
+ commit: string;
3
+ branch?: string;
4
+ };
5
+ export declare const collectGitHead: (options?: {
6
+ cwd?: string;
7
+ }) => GitHead | undefined;
@@ -0,0 +1,13 @@
1
+ import { runGit } from "./runGit.js";
2
+ export const collectGitHead = (options = {}) => {
3
+ const { cwd } = options;
4
+ if (runGit(["rev-parse", "--is-inside-work-tree"], cwd) !== "true") {
5
+ return undefined;
6
+ }
7
+ const commit = runGit(["rev-parse", "HEAD"], cwd);
8
+ if (!commit) {
9
+ return undefined;
10
+ }
11
+ const branch = runGit(["rev-parse", "--abbrev-ref", "HEAD"], cwd);
12
+ return { commit, branch: branch && branch !== "HEAD" ? branch : undefined };
13
+ };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { collectGitFacts, DEFAULT_ANCESTOR_LIMIT, type CollectGitFactsOptions } from "./collectGitFacts.js";
2
+ export { collectGitHead, type GitHead } from "./collectGitHead.js";
2
3
  export { isGitAvailable } from "./isGitAvailable.js";
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { collectGitFacts, DEFAULT_ANCESTOR_LIMIT } from "./collectGitFacts.js";
2
+ export { collectGitHead } from "./collectGitHead.js";
2
3
  export { isGitAvailable } from "./isGitAvailable.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/git",
3
- "version": "3.20.1",
3
+ "version": "3.22.0",
4
4
  "description": "Git metadata collection for Allure Git Flow",
5
5
  "keywords": [
6
6
  "allure",
@@ -24,20 +24,25 @@
24
24
  "scripts": {
25
25
  "build": "run clean && tsc --project ./tsconfig.json",
26
26
  "clean": "rimraf ./dist",
27
- "test": "rimraf ./out && vitest run",
28
- "lint": "oxlint --import-plugin src test",
29
- "lint:fix": "oxlint --import-plugin --fix src test"
27
+ "test": "rimraf out && vp test run",
28
+ "test:unit": "yarn test",
29
+ "lint": "vp lint --import-plugin src test",
30
+ "lint:fix": "vp lint --import-plugin --fix src test"
30
31
  },
31
32
  "dependencies": {
32
- "@allurereport/core-api": "3.20.1"
33
+ "@allurereport/core-api": "3.22.0"
33
34
  },
34
35
  "devDependencies": {
36
+ "@allurereport/common-config": "3.22.0",
35
37
  "@types/node": "^20",
38
+ "@vitest/coverage-istanbul": "5.0.4",
36
39
  "@vitest/runner": "^2",
37
- "@vitest/snapshot": "^5",
40
+ "@vitest/snapshot": "5.0.4",
38
41
  "allure-vitest": "^3",
39
42
  "rimraf": "^6",
40
43
  "typescript": "^5",
41
- "vitest": "^4"
44
+ "vite": "@voidzero-dev/vite-plus-core@1.2.0",
45
+ "vite-plus": "1.2.0",
46
+ "vitest": "5.0.4"
42
47
  }
43
48
  }