Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commitlint/read

Package Overview
Dependencies
Maintainers
4
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/read - npm Package Compare versions

Comparing version 18.6.1 to 19.0.0

21

lib/get-edit-commit.js

@@ -1,21 +0,14 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEditCommit = void 0;
const top_level_1 = __importDefault(require("@commitlint/top-level"));
const promises_1 = __importDefault(require("fs/promises"));
const get_edit_file_path_1 = require("./get-edit-file-path");
import toplevel from '@commitlint/top-level';
import fs from 'fs/promises';
import { getEditFilePath } from './get-edit-file-path.js';
// Get recently edited commit message
async function getEditCommit(cwd, edit) {
const top = await (0, top_level_1.default)(cwd);
export async function getEditCommit(cwd, edit) {
const top = await toplevel(cwd);
if (typeof top !== 'string') {
throw new TypeError(`Could not find git root from ${cwd}`);
}
const editFilePath = await (0, get_edit_file_path_1.getEditFilePath)(top, edit);
const editFile = await promises_1.default.readFile(editFilePath);
const editFilePath = await getEditFilePath(top, edit);
const editFile = await fs.readFile(editFilePath);
return [`${editFile.toString('utf-8')}\n`];
}
exports.getEditCommit = getEditCommit;
//# sourceMappingURL=get-edit-commit.js.map

@@ -1,26 +0,19 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEditFilePath = void 0;
const path_1 = __importDefault(require("path"));
const promises_1 = __importDefault(require("fs/promises"));
import path from 'path';
import fs from 'fs/promises';
// Get path to recently edited commit message file
async function getEditFilePath(top, edit) {
export async function getEditFilePath(top, edit) {
if (typeof edit === 'string') {
return path_1.default.resolve(top, edit);
return path.resolve(top, edit);
}
const dotgitPath = path_1.default.join(top, '.git');
const dotgitStats = await promises_1.default.lstat(dotgitPath);
const dotgitPath = path.join(top, '.git');
const dotgitStats = await fs.lstat(dotgitPath);
if (dotgitStats.isDirectory()) {
return path_1.default.join(top, '.git/COMMIT_EDITMSG');
return path.join(top, '.git/COMMIT_EDITMSG');
}
const gitFile = await promises_1.default.readFile(dotgitPath, {
const gitFile = await fs.readFile(dotgitPath, {
encoding: 'utf-8',
});
const relativeGitPath = gitFile.replace('gitdir: ', '').replace('\n', '');
return path_1.default.resolve(top, relativeGitPath, 'COMMIT_EDITMSG');
return path.resolve(top, relativeGitPath, 'COMMIT_EDITMSG');
}
exports.getEditFilePath = getEditFilePath;
//# sourceMappingURL=get-edit-file-path.js.map

@@ -1,14 +0,7 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHistoryCommits = void 0;
const git_raw_commits_1 = __importDefault(require("git-raw-commits"));
const stream_to_promise_1 = require("./stream-to-promise");
import gitRawCommits from 'git-raw-commits';
import { streamToPromise } from './stream-to-promise.js';
// Get commit messages from history
async function getHistoryCommits(options, opts = {}) {
return (0, stream_to_promise_1.streamToPromise)((0, git_raw_commits_1.default)(options, { cwd: opts.cwd }));
export async function getHistoryCommits(options, opts = {}) {
return streamToPromise(gitRawCommits(options, { cwd: opts.cwd }));
}
exports.getHistoryCommits = getHistoryCommits;
//# sourceMappingURL=get-history-commits.js.map

@@ -1,23 +0,17 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const minimist_1 = __importDefault(require("minimist"));
const get_history_commits_1 = require("./get-history-commits");
const get_edit_commit_1 = require("./get-edit-commit");
import minimist from 'minimist';
import { getHistoryCommits } from './get-history-commits.js';
import { getEditCommit } from './get-edit-commit.js';
// Get commit messages
async function getCommitMessages(settings) {
export default async function getCommitMessages(settings) {
const { cwd, from, to, edit, gitLogArgs } = settings;
if (edit) {
return (0, get_edit_commit_1.getEditCommit)(cwd, edit);
return getEditCommit(cwd, edit);
}
let gitOptions = { from, to };
if (gitLogArgs) {
gitOptions = Object.assign(Object.assign({}, (0, minimist_1.default)(gitLogArgs.split(' '))), { from,
gitOptions = Object.assign(Object.assign({}, minimist(gitLogArgs.split(' '))), { from,
to });
}
return (0, get_history_commits_1.getHistoryCommits)(gitOptions, { cwd });
return getHistoryCommits(gitOptions, { cwd });
}
exports.default = getCommitMessages;
//# sourceMappingURL=read.js.map

@@ -1,4 +0,4 @@

/// <reference types="node" />
/// <reference types="node" resolution-mode="require"/>
import { Readable } from 'stream';
export declare function streamToPromise(stream: Readable): Promise<string[]>;
//# sourceMappingURL=stream-to-promise.d.ts.map

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.streamToPromise = void 0;
function streamToPromise(stream) {
export function streamToPromise(stream) {
const data = [];

@@ -11,3 +8,2 @@ return new Promise((resolve, reject) => stream

}
exports.streamToPromise = streamToPromise;
//# sourceMappingURL=stream-to-promise.js.map
{
"name": "@commitlint/read",
"version": "18.6.1",
"type": "module",
"version": "19.0.0",
"description": "Read commit messages from a specified range or last edit",

@@ -38,15 +39,15 @@ "main": "lib/read.js",

"devDependencies": {
"@commitlint/test": "^18.0.0",
"@commitlint/utils": "^18.6.1",
"@commitlint/test": "^19.0.0",
"@commitlint/utils": "^19.0.0",
"@types/git-raw-commits": "^2.0.3",
"@types/minimist": "^1.2.4",
"execa": "^5.0.0"
"execa": "^8.0.1"
},
"dependencies": {
"@commitlint/top-level": "^18.6.1",
"@commitlint/types": "^18.6.1",
"git-raw-commits": "^2.0.11",
"minimist": "^1.2.6"
"@commitlint/top-level": "^19.0.0",
"@commitlint/types": "^19.0.0",
"git-raw-commits": "^4.0.0",
"minimist": "^1.2.8"
},
"gitHead": "89f5bf91d1c11b1f457a6f0d99b8ea34583a9311"
"gitHead": "f1ff12159d627ee63bf8982ab02e6cca8f10b09f"
}

@@ -1,5 +0,5 @@

> Read commit messages from a specified range or last edit
# @commitlint/read
Read commit messages from a specified range or last edit
## Getting started

@@ -11,16 +11,6 @@

## Example
## Documentation
```js
const read = require('@commitlint/read').default;
Consult [API docs](https://commitlint.js.org/api/read) for comprehensive documentation.
// Read last edited commit message
read({edit: true}).then((messages) => console.log(messages));
// => ['I did something\n\n']
// Read from the third to second commit message from HEAD
read({from: 'HEAD~2', to: 'HEAD~1'}).then((messages) => console.log(messages));
// => ['Initial commit\n\n']
```
Consult [docs/api](https://conventional-changelog.github.io/commitlint/#/reference-api) for comprehensive documentation.
Documentation generated from [`docs` folder](../../docs/api/read.md).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc