@b12k/gitleaks 8.30.1-v.5 → 8.30.1-v.51

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/README.md CHANGED
@@ -14,6 +14,12 @@ Typically installed as a dev dependency:
14
14
  npm install --save-dev @b12k/gitleaks
15
15
  ```
16
16
 
17
+ Recent npm versions require approving dependency install scripts. Approve this package so its postinstall script can download the gitleaks binary:
18
+
19
+ ```bash
20
+ npm approve-scripts @b12k/gitleaks
21
+ ```
22
+
17
23
  ```bash
18
24
  pnpm add -D --allow-build=@b12k/gitleaks @b12k/gitleaks
19
25
  ```
@@ -27,9 +33,11 @@ yarn add --dev @b12k/gitleaks
27
33
  **Global**
28
34
 
29
35
  ```bash
30
- npm install -g @b12k/gitleaks
36
+ npm install -g --allow-scripts=@b12k/gitleaks @b12k/gitleaks
31
37
  ```
32
38
 
39
+ Global npm installs cannot use `npm approve-scripts`; use `--allow-scripts` instead.
40
+
33
41
  ```bash
34
42
  pnpm add -g --allow-build=@b12k/gitleaks @b12k/gitleaks
35
43
  ```
@@ -42,7 +50,12 @@ yarn global add @b12k/gitleaks
42
50
 
43
51
  The postinstall script downloads the gitleaks binary for your platform from the official GitHub release.
44
52
 
45
- If you already installed with pnpm 11 and the build was blocked, approve and rebuild it:
53
+ If you already installed with npm or pnpm and the build was blocked, approve and rebuild it:
54
+
55
+ ```bash
56
+ npm approve-scripts @b12k/gitleaks
57
+ npm rebuild @b12k/gitleaks
58
+ ```
46
59
 
47
60
  ```bash
48
61
  pnpm approve-builds @b12k/gitleaks
@@ -106,3 +119,9 @@ yarn add --dev @b12k/gitleaks --foreground-scripts
106
119
  The npm package version mirrors the gitleaks release version.
107
120
 
108
121
  To install a different gitleaks release, define it in `.gitleaks-version` as `v1.2.3` or `1.2.3` before installing the package.
122
+
123
+ If you add or change `.gitleaks-version` after installing, run:
124
+
125
+ ```bash
126
+ gitleaks-install
127
+ ```
package/dist/config.js CHANGED
@@ -7,15 +7,15 @@ const platform = 'win32' === process.platform ? 'windows' : process.platform;
7
7
  const isWindows = 'windows' === platform;
8
8
  const { arch: architecture } = process;
9
9
  const { name: config_name, version: version } = package_0;
10
- const [defaultVersion = ''] = version.split('-');
10
+ const [defaultVersion = ''] = version.split('-', 1);
11
11
  const versionFileName = '.gitleaks-version';
12
12
  const versionFilePath = node_path.join(process.env['INIT_CWD'] ?? process.cwd(), versionFileName);
13
13
  let versionOverride;
14
14
  try {
15
15
  const fileContents = await readFile(versionFilePath, 'utf8');
16
- versionOverride = fileContents.trim().replace(/^v/, '');
16
+ versionOverride = fileContents.trim().replace(/^v/u, '');
17
17
  } catch (error) {
18
- if ('ENOENT' !== error.code) {
18
+ if (!(error instanceof Error && 'code' in error && 'ENOENT' === error.code)) {
19
19
  const message = Error.isError(error) ? error.message : 'Unknown error.';
20
20
  throw new Error(`Failed to read ${versionFileName}: ${message}`, {
21
21
  cause: error
@@ -1,7 +1,7 @@
1
+ #!/usr/bin/env node
1
2
  import { createHash } from "node:crypto";
2
3
  import { createWriteStream } from "node:fs";
3
4
  import { readFile, rm } from "node:fs/promises";
4
- import { Readable } from "node:stream";
5
5
  import { pipeline } from "node:stream/promises";
6
6
  import { architecture, archiveFileName, archiveGithubUrl, archivePath, binaryPath, checksumsGithubUrl, currentDirectory, libraryName, platform, supportedArchitectures, supportedPlatforms } from "./config.js";
7
7
  import { extractArchive } from "./extract-archive.js";
@@ -27,7 +27,7 @@ async function downloadArchive() {
27
27
  borderColor: 'green',
28
28
  title: `${libraryName}:save`
29
29
  });
30
- await pipeline(Readable.fromWeb(response.body), createWriteStream(archivePath));
30
+ await pipeline(response.body, createWriteStream(archivePath));
31
31
  }
32
32
  async function ensureArchiveChecksum() {
33
33
  log(checksumsGithubUrl, {
@@ -36,7 +36,7 @@ async function ensureArchiveChecksum() {
36
36
  });
37
37
  const response = await createFetchResponse(checksumsGithubUrl);
38
38
  const checksums = await response.text();
39
- const checksum = checksums.split('\n').find((line)=>line.endsWith(` ${archiveFileName}`))?.split(/\s+/, 1)[0];
39
+ const checksum = checksums.split('\n').find((line)=>line.endsWith(` ${archiveFileName}`))?.split(/\s+/u, 1)[0];
40
40
  if (!checksum) throw new Error(`Checksum not found for ${archiveFileName}.`);
41
41
  const archive = await readFile(archivePath);
42
42
  const actualChecksum = createHash('sha256').update(archive).digest('hex');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b12k/gitleaks",
3
- "version": "8.30.1-v.5",
3
+ "version": "8.30.1-v.51",
4
4
  "description": "The missing NPM wrapper for Gitleaks",
5
5
  "keywords": [
6
6
  "api-keys",
@@ -21,73 +21,68 @@
21
21
  "tokens",
22
22
  "wrapper"
23
23
  ],
24
+ "license": "MIT",
25
+ "author": "Bogdan Kolesnyk",
24
26
  "repository": {
25
27
  "type": "git",
26
28
  "url": "git+https://github.com/b12k/gitleaks.git"
27
29
  },
28
- "license": "MIT",
29
- "author": "Bogdan Kolesnyk",
30
- "type": "module",
31
30
  "bin": {
32
- "gitleaks": "dist/cli.js"
31
+ "gitleaks": "dist/cli.js",
32
+ "gitleaks-install": "dist/postinstall.js"
33
33
  },
34
34
  "files": [
35
35
  "dist",
36
36
  "scripts"
37
37
  ],
38
+ "type": "module",
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
38
42
  "dependencies": {
39
- "boxen": "8.0.1",
40
- "extract-zip": "2.0.1",
41
- "tar": "7.5.19",
43
+ "boxen": "9.0.0",
44
+ "tar": "7.5.22",
42
45
  "update-notifier": "7.3.1"
43
46
  },
44
47
  "devDependencies": {
45
48
  "@b12k/branch-name-lint": "1.3.0",
46
- "@commitlint/config-conventional": "21.2.0",
47
- "@eslint/js": "10.0.1",
48
- "@release-it/conventional-changelog": "11.0.1",
49
- "@rslib/core": "0.23.1",
50
- "@types/node": "26.0.1",
51
- "@types/semver": "7.7.1",
49
+ "@commitlint/config-conventional": "21.2.3",
50
+ "@release-it/conventional-changelog": "12.0.2",
51
+ "@rslib/core": "1.0.2",
52
+ "@types/node": "26.6.3",
53
+ "@types/semver": "7.8.0",
52
54
  "@types/update-notifier": "6.0.8",
53
- "commitlint": "21.2.0",
54
- "eslint": "10.6.0",
55
- "eslint-config-airbnb-extended": "3.1.0",
56
- "eslint-config-prettier": "10.1.8",
57
- "eslint-plugin-perfectionist": "5.9.1",
58
- "eslint-plugin-unicorn": "70.0.0",
55
+ "commitlint": "21.2.3",
56
+ "eslint-plugin-perfectionist": "5.12.1",
59
57
  "husky": "9.1.7",
60
- "lint-staged": "17.0.8",
61
- "npm-check-updates": "22.2.9",
62
- "npm-run-all2": "9.0.2",
63
- "prettier": "3.9.4",
64
- "release-it": "20.2.1",
58
+ "lint-staged": "17.6.0",
59
+ "npm-check-updates": "23.1.0",
60
+ "npm-run-all2": "9.0.3",
61
+ "oxfmt": "0.70.0",
62
+ "oxlint": "1.85.0",
63
+ "oxlint-tsgolint": "7.0.2003",
64
+ "release-it": "21.1.0",
65
65
  "semver": "7.8.5",
66
- "sort-package-json": "4.0.0",
67
- "tsx": "4.22.4",
68
- "typescript": "6.0.3"
66
+ "tsx": "4.23.15",
67
+ "typescript": "7.0.2"
69
68
  },
70
69
  "engines": {
71
70
  "node": ">=24"
72
71
  },
73
- "publishConfig": {
74
- "access": "public"
75
- },
76
72
  "scripts": {
77
73
  "build": "rslib",
78
74
  "check": "run-p -l check:*",
79
- "check:format": "prettier . --check",
80
- "check:package-json": "sort-package-json --check",
81
- "check:scripts": "eslint . --cache",
75
+ "check:format": "oxfmt . --check",
76
+ "check:scripts": "oxlint",
82
77
  "check:types": "tsc --noEmit",
83
- "deps:check": "ncu -e 1 -c 7",
84
- "deps:update": "ncu -du --doctorTest \"pnpm deps:update:doctor\" -c 7",
78
+ "deps:check": "ncu -e 2 -c 1",
79
+ "deps:update": "ncu -du --doctorInstall \"pnpm deps:update:install\" --doctorTest \"pnpm deps:update:doctor\" -c 1",
85
80
  "deps:update:doctor": "run-p -l check:types check:scripts build",
81
+ "deps:update:install": "pnpm i --no-frozen-lockfile",
86
82
  "dev": "rslib --watch",
87
- "fix": "run-p -l fix:*",
88
- "fix:format": "prettier . --write",
89
- "fix:package-json": "sort-package-json",
90
- "fix:scripts": "eslint . --fix --cache",
83
+ "fix": "run-s -l fix:*",
84
+ "fix:format": "oxfmt . --write",
85
+ "fix:scripts": "oxlint --fix",
91
86
  "ga:notify": "tsx .github/notify.ts",
92
87
  "ga:update-gitleaks": "tsx .github/update-gitleaks.ts",
93
88
  "husky:commit-msg": "commitlint",
@@ -2,6 +2,6 @@ import path from 'node:path';
2
2
  import { pathToFileURL } from 'node:url';
3
3
 
4
4
  const directory = import.meta.dirname;
5
- // eslint-disable-next-line n/no-process-exit
5
+ // oxlint-disable-next-line unicorn/no-process-exit
6
6
  if (!directory.includes('node_modules')) process.exit(0);
7
- await import(pathToFileURL(path.join(directory, '../dist/postinstall.js')));
7
+ await import(pathToFileURL(path.join(directory, '../dist/postinstall.js')).href);