@commitlint/read
Advanced tools
@@ -1,8 +0,8 @@ | ||
| import toplevel from '@commitlint/top-level'; | ||
| import fs from 'fs/promises'; | ||
| import { getEditFilePath } from './get-edit-file-path.js'; | ||
| import toplevel from "@commitlint/top-level"; | ||
| import fs from "fs/promises"; | ||
| import { getEditFilePath } from "./get-edit-file-path.js"; | ||
| // Get recently edited commit message | ||
| export async function getEditCommit(cwd, edit) { | ||
| const top = await toplevel(cwd); | ||
| if (typeof top !== 'string') { | ||
| if (typeof top !== "string") { | ||
| throw new TypeError(`Could not find git root from ${cwd}`); | ||
@@ -12,4 +12,4 @@ } | ||
| const editFile = await fs.readFile(editFilePath); | ||
| return [`${editFile.toString('utf-8')}\n`]; | ||
| return [`${editFile.toString("utf-8")}\n`]; | ||
| } | ||
| //# sourceMappingURL=get-edit-commit.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-edit-commit.js","sourceRoot":"","sources":["../src/get-edit-commit.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAExD,qCAAqC;AACrC,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,GAAY,EACZ,IAAuB;IAEvB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAW,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEzD,OAAO,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"} | ||
| {"version":3,"file":"get-edit-commit.js","sourceRoot":"","sources":["../src/get-edit-commit.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,qCAAqC;AACrC,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,GAAY,EACZ,IAAuB;IAEvB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAW,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEzD,OAAO,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"} |
@@ -1,19 +0,19 @@ | ||
| import path from 'node:path'; | ||
| import fs from 'fs/promises'; | ||
| import path from "node:path"; | ||
| import fs from "fs/promises"; | ||
| // Get path to recently edited commit message file | ||
| export async function getEditFilePath(top, edit) { | ||
| if (typeof edit === 'string') { | ||
| if (typeof edit === "string") { | ||
| return path.resolve(top, edit); | ||
| } | ||
| const dotgitPath = path.join(top, '.git'); | ||
| const dotgitPath = path.join(top, ".git"); | ||
| const dotgitStats = await fs.lstat(dotgitPath); | ||
| if (dotgitStats.isDirectory()) { | ||
| return path.join(top, '.git/COMMIT_EDITMSG'); | ||
| return path.join(top, ".git/COMMIT_EDITMSG"); | ||
| } | ||
| const gitFile = await fs.readFile(dotgitPath, { | ||
| encoding: 'utf-8', | ||
| encoding: "utf-8", | ||
| }); | ||
| const relativeGitPath = gitFile.replace('gitdir: ', '').replace('\n', ''); | ||
| return path.resolve(top, relativeGitPath, 'COMMIT_EDITMSG'); | ||
| const relativeGitPath = gitFile.replace("gitdir: ", "").replace("\n", ""); | ||
| return path.resolve(top, relativeGitPath, "COMMIT_EDITMSG"); | ||
| } | ||
| //# sourceMappingURL=get-edit-file-path.js.map |
@@ -1,2 +0,2 @@ | ||
| import gitRawCommits from 'git-raw-commits'; | ||
| import gitRawCommits from "git-raw-commits"; | ||
| export declare function getHistoryCommits(options: gitRawCommits.GitOptions, opts?: { | ||
@@ -3,0 +3,0 @@ cwd?: string; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-history-commits.d.ts","sourceRoot":"","sources":["../src/get-history-commits.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAK5C,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,aAAa,CAAC,UAAU,EACjC,IAAI,GAAE;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAM,GACvB,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB"} | ||
| {"version":3,"file":"get-history-commits.d.ts","sourceRoot":"","sources":["../src/get-history-commits.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAK5C,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,aAAa,CAAC,UAAU,EACjC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB"} |
@@ -1,3 +0,3 @@ | ||
| import gitRawCommits from 'git-raw-commits'; | ||
| import { streamToPromise } from './stream-to-promise.js'; | ||
| import gitRawCommits from "git-raw-commits"; | ||
| import { streamToPromise } from "./stream-to-promise.js"; | ||
| // Get commit messages from history | ||
@@ -4,0 +4,0 @@ export async function getHistoryCommits(options, opts = {}) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-history-commits.js","sourceRoot":"","sources":["../src/get-history-commits.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAEvD,mCAAmC;AACnC,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACtC,OAAiC,EACjC,OAAuB,EAAE;IAEzB,OAAO,eAAe,CAAC,aAAa,CAAC,OAAO,EAAE,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAC,CAAC,CAAC,CAAC;AACjE,CAAC"} | ||
| {"version":3,"file":"get-history-commits.js","sourceRoot":"","sources":["../src/get-history-commits.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,mCAAmC;AACnC,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACtC,OAAiC,EACjC,OAAyB,EAAE;IAE3B,OAAO,eAAe,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACnE,CAAC"} |
+14
-14
@@ -1,5 +0,5 @@ | ||
| import minimist from 'minimist'; | ||
| import { getHistoryCommits } from './get-history-commits.js'; | ||
| import { getEditCommit } from './get-edit-commit.js'; | ||
| import { x } from 'tinyexec'; | ||
| import minimist from "minimist"; | ||
| import { getHistoryCommits } from "./get-history-commits.js"; | ||
| import { getEditCommit } from "./get-edit-commit.js"; | ||
| import { x } from "tinyexec"; | ||
| // Get commit messages | ||
@@ -13,3 +13,3 @@ export default async function getCommitMessages(settings) { | ||
| if (last) { | ||
| const gitCommandResult = await x('git', ['log', '-1', '--pretty=format:%B'], { nodeOptions: { cwd } }); | ||
| const gitCommandResult = await x("git", ["log", "-1", "--pretty=format:%B"], { nodeOptions: { cwd } }); | ||
| let output = gitCommandResult.stdout.trim(); | ||
@@ -22,9 +22,9 @@ // strip output of extra quotation marks ("") | ||
| if (!from && fromLastTag) { | ||
| const output = await x('git', [ | ||
| 'describe', | ||
| '--abbrev=40', | ||
| '--always', | ||
| '--first-parent', | ||
| '--long', | ||
| '--tags', | ||
| const output = await x("git", [ | ||
| "describe", | ||
| "--abbrev=40", | ||
| "--always", | ||
| "--first-parent", | ||
| "--long", | ||
| "--tags", | ||
| ], { nodeOptions: { cwd } }); | ||
@@ -41,3 +41,3 @@ const stdout = output.stdout.trim(); | ||
| // Minus zero based (1), dash (1), "g" prefix (1), hash (40) = -43 | ||
| const tagSlice = stdout.lastIndexOf('-', stdout.length - 43); | ||
| const tagSlice = stdout.lastIndexOf("-", stdout.length - 43); | ||
| from = stdout.slice(0, tagSlice); | ||
@@ -49,3 +49,3 @@ } | ||
| gitOptions = { | ||
| ...minimist(gitLogArgs.split(' ')), | ||
| ...minimist(gitLogArgs.split(" ")), | ||
| from, | ||
@@ -52,0 +52,0 @@ to, |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"read.js","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAC,CAAC,EAAC,MAAM,UAAU,CAAC;AAY3B,sBAAsB;AACtB,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iBAAiB,CAC9C,QAAiC;IAEjC,MAAM,EAAC,GAAG,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,QAAQ,CAAC;IAChE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAEzB,IAAI,IAAI,EAAE,CAAC;QACV,OAAO,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACV,MAAM,gBAA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C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9B,OAAO,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,CACrB,KAAK,EACL;YACC,UAAU;YACV,aAAa;YACb,UAAU;YACV,gBAAgB;YAChB,QAAQ;YACR,QAAQ;SACR,EACD,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,CACxB,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpC,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YAC1B,8DAA8D;YAC9D,sBAAsB;YACtB,IAAI,GAAG,MAAM,CAAC;QACf,CAAC;aAAM,CAAC;YACP,2DAA2D;YAC3D,+DAA+D;YAC/D,kEAAkE;YAClE,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;YAE7D,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;IACF,CAAC;IAED,IAAI,UAAU,GAAe,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC1C,IAAI,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG;YACZ,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI;YACJ,EAAE;SACF,CAAC;IACH,CAAC;IAED,OAAO,iBAAiB,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC"} |
@@ -1,3 +0,3 @@ | ||
| import { Readable } from 'node:stream'; | ||
| import { Readable } from "node:stream"; | ||
| export declare function streamToPromise(stream: Readable): Promise<string[]>; | ||
| //# sourceMappingURL=stream-to-promise.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"stream-to-promise.d.ts","sourceRoot":"","sources":["../src/stream-to-promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnE"} | ||
| {"version":3,"file":"stream-to-promise.d.ts","sourceRoot":"","sources":["../src/stream-to-promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnE"} |
| export function streamToPromise(stream) { | ||
| const data = []; | ||
| return new Promise((resolve, reject) => stream | ||
| .on('data', (chunk) => data.push(chunk.toString('utf-8'))) | ||
| .on('error', reject) | ||
| .on('end', () => resolve(data))); | ||
| .on("data", (chunk) => data.push(chunk.toString("utf-8"))) | ||
| .on("error", reject) | ||
| .on("end", () => resolve(data))); | ||
| } | ||
| //# sourceMappingURL=stream-to-promise.js.map |
+7
-7
| { | ||
| "name": "@commitlint/read", | ||
| "type": "module", | ||
| "version": "19.8.0", | ||
| "version": "19.8.1", | ||
| "description": "Read commit messages from a specified range or last edit", | ||
@@ -39,4 +39,4 @@ "main": "lib/read.js", | ||
| "devDependencies": { | ||
| "@commitlint/test": "^19.8.0", | ||
| "@commitlint/utils": "^19.8.0", | ||
| "@commitlint/test": "^19.8.1", | ||
| "@commitlint/utils": "^19.8.1", | ||
| "@types/git-raw-commits": "^2.0.3", | ||
@@ -46,9 +46,9 @@ "@types/minimist": "^1.2.4" | ||
| "dependencies": { | ||
| "@commitlint/top-level": "^19.8.0", | ||
| "@commitlint/types": "^19.8.0", | ||
| "@commitlint/top-level": "^19.8.1", | ||
| "@commitlint/types": "^19.8.1", | ||
| "git-raw-commits": "^4.0.0", | ||
| "minimist": "^1.2.8", | ||
| "tinyexec": "^0.3.0" | ||
| "tinyexec": "^1.0.0" | ||
| }, | ||
| "gitHead": "e82f05a737626bb69979d14564f5ff601997f679" | ||
| "gitHead": "3c302008cabeb0b08cd246b2417a51a9d745a918" | ||
| } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
+ Added
- Removed
Updated
Updated