feat: adding linter for commits

This commit is contained in:
Carlos Gutierrez
2021-11-22 09:39:27 -06:00
commit 2c7c117aa1
3093 changed files with 1215197 additions and 0 deletions

View File

@ -0,0 +1,2 @@
export declare function getEditCommit(cwd?: string, edit?: boolean | string): Promise<string[]>;
//# sourceMappingURL=get-edit-commit.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"get-edit-commit.d.ts","sourceRoot":"","sources":["../src/get-edit-commit.ts"],"names":[],"mappings":"AAKA,wBAAsB,aAAa,CAClC,GAAG,CAAC,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC,CAWnB"}

21
node_modules/@commitlint/read/lib/get-edit-commit.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
"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 fs_extra_1 = __importDefault(require("fs-extra"));
const get_edit_file_path_1 = require("./get-edit-file-path");
// Get recently edited commit message
async function getEditCommit(cwd, edit) {
const top = await (0, top_level_1.default)(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 fs_extra_1.default.readFile(editFilePath);
return [`${editFile.toString('utf-8')}\n`];
}
exports.getEditCommit = getEditCommit;
//# sourceMappingURL=get-edit-commit.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"get-edit-commit.js","sourceRoot":"","sources":["../src/get-edit-commit.ts"],"names":[],"mappings":";;;;;;AAAA,sEAA6C;AAC7C,wDAA0B;AAC1B,6DAAqD;AAErD,qCAAqC;AAC9B,KAAK,UAAU,aAAa,CAClC,GAAY,EACZ,IAAuB;IAEvB,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAQ,EAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC5B,MAAM,IAAI,SAAS,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC;KAC3D;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,oCAAe,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAW,MAAM,kBAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEzD,OAAO,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAdD,sCAcC"}

View File

@ -0,0 +1,2 @@
export declare function getEditFilePath(top: string, edit?: boolean | string): Promise<string>;
//# sourceMappingURL=get-edit-file-path.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"get-edit-file-path.d.ts","sourceRoot":"","sources":["../src/get-edit-file-path.ts"],"names":[],"mappings":"AAKA,wBAAsB,eAAe,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAiBjB"}

View File

@ -0,0 +1,26 @@
"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 fs_extra_1 = __importDefault(require("fs-extra"));
// Get path to recently edited commit message file
async function getEditFilePath(top, edit) {
if (typeof edit === 'string') {
return path_1.default.resolve(top, edit);
}
const dotgitPath = path_1.default.join(top, '.git');
const dotgitStats = await fs_extra_1.default.lstat(dotgitPath);
if (dotgitStats.isDirectory()) {
return path_1.default.join(top, '.git/COMMIT_EDITMSG');
}
const gitFile = await fs_extra_1.default.readFile(dotgitPath, {
encoding: 'utf-8',
});
const relativeGitPath = gitFile.replace('gitdir: ', '').replace('\n', '');
return path_1.default.resolve(top, relativeGitPath, 'COMMIT_EDITMSG');
}
exports.getEditFilePath = getEditFilePath;
//# sourceMappingURL=get-edit-file-path.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"get-edit-file-path.js","sourceRoot":"","sources":["../src/get-edit-file-path.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAE1B,kDAAkD;AAC3C,KAAK,UAAU,eAAe,CACpC,GAAW,EACX,IAAuB;IAEvB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC7B,OAAO,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAC/B;IAED,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAU,MAAM,kBAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAEtD,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE;QAC9B,OAAO,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;KAC7C;IAED,MAAM,OAAO,GAAW,MAAM,kBAAE,CAAC,QAAQ,CAAC,UAAU,EAAE;QACrD,QAAQ,EAAE,OAAO;KACjB,CAAC,CAAC;IACH,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC1E,OAAO,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAC7D,CAAC;AApBD,0CAoBC"}

View File

@ -0,0 +1,7 @@
export declare function getHistoryCommits(options: {
from?: string;
to?: string;
}, opts?: {
cwd?: string;
}): Promise<string[]>;
//# sourceMappingURL=get-history-commits.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"get-history-commits.d.ts","sourceRoot":"","sources":["../src/get-history-commits.ts"],"names":[],"mappings":"AAIA,wBAAsB,iBAAiB,CACtC,OAAO,EAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EACrC,IAAI,GAAE;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAM,GACvB,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB"}

View File

@ -0,0 +1,14 @@
"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");
// 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 }));
}
exports.getHistoryCommits = getHistoryCommits;
//# sourceMappingURL=get-history-commits.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"get-history-commits.js","sourceRoot":"","sources":["../src/get-history-commits.ts"],"names":[],"mappings":";;;;;;AAAA,sEAA4C;AAC5C,2DAAoD;AAEpD,mCAAmC;AAC5B,KAAK,UAAU,iBAAiB,CACtC,OAAqC,EACrC,OAAuB,EAAE;IAEzB,OAAO,IAAA,mCAAe,EAAC,IAAA,yBAAa,EAAC,OAAO,EAAE,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AALD,8CAKC"}

9
node_modules/@commitlint/read/lib/read.d.ts generated vendored Normal file
View File

@ -0,0 +1,9 @@
interface GetCommitMessageOptions {
cwd?: string;
from?: string;
to?: string;
edit?: boolean | string;
}
export default function getCommitMessages(settings: GetCommitMessageOptions): Promise<string[]>;
export {};
//# sourceMappingURL=read.d.ts.map

1
node_modules/@commitlint/read/lib/read.d.ts.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAGA,UAAU,uBAAuB;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACxB;AAGD,wBAA8B,iBAAiB,CAC9C,QAAQ,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnB"}

14
node_modules/@commitlint/read/lib/read.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const get_history_commits_1 = require("./get-history-commits");
const get_edit_commit_1 = require("./get-edit-commit");
// Get commit messages
async function getCommitMessages(settings) {
const { cwd, from, to, edit } = settings;
if (edit) {
return (0, get_edit_commit_1.getEditCommit)(cwd, edit);
}
return (0, get_history_commits_1.getHistoryCommits)({ from, to }, { cwd });
}
exports.default = getCommitMessages;
//# sourceMappingURL=read.js.map

1
node_modules/@commitlint/read/lib/read.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"read.js","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":";;AAAA,+DAAwD;AACxD,uDAAgD;AAShD,sBAAsB;AACP,KAAK,UAAU,iBAAiB,CAC9C,QAAiC;IAEjC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAC,GAAG,QAAQ,CAAC;IAEvC,IAAI,IAAI,EAAE;QACT,OAAO,IAAA,+BAAa,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAChC;IAED,OAAO,IAAA,uCAAiB,EAAC,EAAC,IAAI,EAAE,EAAE,EAAC,EAAE,EAAC,GAAG,EAAC,CAAC,CAAC;AAC7C,CAAC;AAVD,oCAUC"}

View File

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

View File

@ -0,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,QAAQ,CAAC;AAEhC,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnE"}

12
node_modules/@commitlint/read/lib/stream-to-promise.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.streamToPromise = void 0;
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)));
}
exports.streamToPromise = streamToPromise;
//# sourceMappingURL=stream-to-promise.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"stream-to-promise.js","sourceRoot":"","sources":["../src/stream-to-promise.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,MAAgB;IAC/C,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CACtC,MAAM;SACJ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SACzD,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;SACnB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAChC,CAAC;AACH,CAAC;AARD,0CAQC"}