@commitlint/read 8.2.0 → 8.3.6
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/CHANGELOG.md +24 -0
- package/lib/get-edit-commit.d.ts +2 -0
- package/lib/get-edit-commit.d.ts.map +1 -0
- package/lib/get-edit-commit.js +21 -0
- package/lib/get-edit-commit.js.map +1 -0
- package/lib/get-edit-file-path.d.ts +2 -0
- package/lib/get-edit-file-path.d.ts.map +1 -0
- package/lib/get-edit-file-path.js +26 -0
- package/lib/get-edit-file-path.js.map +1 -0
- package/lib/get-history-commits.d.ts +7 -0
- package/lib/get-history-commits.d.ts.map +1 -0
- package/lib/get-history-commits.js +14 -0
- package/lib/get-history-commits.js.map +1 -0
- package/lib/read.d.ts +9 -0
- package/lib/read.d.ts.map +1 -0
- package/lib/read.js +14 -0
- package/lib/read.js.map +1 -0
- package/lib/stream-to-promise.d.ts +4 -0
- package/lib/stream-to-promise.d.ts.map +1 -0
- package/lib/stream-to-promise.js +12 -0
- package/lib/stream-to-promise.js.map +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.3.6](https://github.com/conventional-changelog/commitlint/compare/v8.3.5...v8.3.6) (2021-11-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @commitlint/read
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.3.4](https://github.com/conventional-changelog/commitlint/compare/v8.3.3...v8.3.4) (2020-01-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @commitlint/read
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [8.3.0](https://github.com/conventional-changelog/commitlint/compare/v8.2.0...v8.3.0) (2019-10-16)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @commitlint/read
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [8.2.0](https://github.com/conventional-changelog/commitlint/compare/v8.1.0...v8.2.0) (2019-09-16)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @commitlint/read
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getEditCommit = void 0;
|
|
7
|
+
const top_level_1 = __importDefault(require("@commitlint/top-level"));
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const get_edit_file_path_1 = require("./get-edit-file-path");
|
|
10
|
+
// Get recently edited commit message
|
|
11
|
+
async function getEditCommit(cwd, edit) {
|
|
12
|
+
const top = await (0, top_level_1.default)(cwd);
|
|
13
|
+
if (typeof top !== 'string') {
|
|
14
|
+
throw new TypeError(`Could not find git root from ${cwd}`);
|
|
15
|
+
}
|
|
16
|
+
const editFilePath = await (0, get_edit_file_path_1.getEditFilePath)(top, edit);
|
|
17
|
+
const editFile = await fs_extra_1.default.readFile(editFilePath);
|
|
18
|
+
return [`${editFile.toString('utf-8')}\n`];
|
|
19
|
+
}
|
|
20
|
+
exports.getEditCommit = getEditCommit;
|
|
21
|
+
//# sourceMappingURL=get-edit-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getEditFilePath = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
// Get path to recently edited commit message file
|
|
10
|
+
async function getEditFilePath(top, edit) {
|
|
11
|
+
if (typeof edit === 'string') {
|
|
12
|
+
return path_1.default.resolve(top, edit);
|
|
13
|
+
}
|
|
14
|
+
const dotgitPath = path_1.default.join(top, '.git');
|
|
15
|
+
const dotgitStats = await fs_extra_1.default.lstat(dotgitPath);
|
|
16
|
+
if (dotgitStats.isDirectory()) {
|
|
17
|
+
return path_1.default.join(top, '.git/COMMIT_EDITMSG');
|
|
18
|
+
}
|
|
19
|
+
const gitFile = await fs_extra_1.default.readFile(dotgitPath, {
|
|
20
|
+
encoding: 'utf-8',
|
|
21
|
+
});
|
|
22
|
+
const relativeGitPath = gitFile.replace('gitdir: ', '').replace('\n', '');
|
|
23
|
+
return path_1.default.resolve(top, relativeGitPath, 'COMMIT_EDITMSG');
|
|
24
|
+
}
|
|
25
|
+
exports.getEditFilePath = getEditFilePath;
|
|
26
|
+
//# sourceMappingURL=get-edit-file-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getHistoryCommits = void 0;
|
|
7
|
+
const git_raw_commits_1 = __importDefault(require("git-raw-commits"));
|
|
8
|
+
const stream_to_promise_1 = require("./stream-to-promise");
|
|
9
|
+
// Get commit messages from history
|
|
10
|
+
async function getHistoryCommits(options, opts = {}) {
|
|
11
|
+
return (0, stream_to_promise_1.streamToPromise)((0, git_raw_commits_1.default)(options, { cwd: opts.cwd }));
|
|
12
|
+
}
|
|
13
|
+
exports.getHistoryCommits = getHistoryCommits;
|
|
14
|
+
//# sourceMappingURL=get-history-commits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/lib/read.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/lib/read.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const get_history_commits_1 = require("./get-history-commits");
|
|
4
|
+
const get_edit_commit_1 = require("./get-edit-commit");
|
|
5
|
+
// Get commit messages
|
|
6
|
+
async function getCommitMessages(settings) {
|
|
7
|
+
const { cwd, from, to, edit } = settings;
|
|
8
|
+
if (edit) {
|
|
9
|
+
return (0, get_edit_commit_1.getEditCommit)(cwd, edit);
|
|
10
|
+
}
|
|
11
|
+
return (0, get_history_commits_1.getHistoryCommits)({ from, to }, { cwd });
|
|
12
|
+
}
|
|
13
|
+
exports.default = getCommitMessages;
|
|
14
|
+
//# sourceMappingURL=read.js.map
|
package/lib/read.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamToPromise = void 0;
|
|
4
|
+
function streamToPromise(stream) {
|
|
5
|
+
const data = [];
|
|
6
|
+
return new Promise((resolve, reject) => stream
|
|
7
|
+
.on('data', (chunk) => data.push(chunk.toString('utf-8')))
|
|
8
|
+
.on('error', reject)
|
|
9
|
+
.on('end', () => resolve(data)));
|
|
10
|
+
}
|
|
11
|
+
exports.streamToPromise = streamToPromise;
|
|
12
|
+
//# sourceMappingURL=stream-to-promise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/read",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.6",
|
|
4
4
|
"description": "Read commit messages from a specified range or last edit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -56,21 +56,21 @@
|
|
|
56
56
|
},
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@commitlint/test": "
|
|
60
|
-
"@commitlint/utils": "^8.
|
|
59
|
+
"@commitlint/test": "8.2.0",
|
|
60
|
+
"@commitlint/utils": "^8.3.6",
|
|
61
61
|
"ava": "0.22.0",
|
|
62
62
|
"babel-cli": "6.26.0",
|
|
63
63
|
"babel-preset-commitlint": "^8.2.0",
|
|
64
64
|
"babel-register": "6.26.0",
|
|
65
65
|
"concurrently": "3.6.1",
|
|
66
|
-
"cross-env": "
|
|
66
|
+
"cross-env": "6.0.3",
|
|
67
67
|
"execa": "0.11.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@commitlint/top-level": "^8.
|
|
70
|
+
"@commitlint/top-level": "^8.3.6",
|
|
71
71
|
"@marionebl/sander": "^0.6.0",
|
|
72
72
|
"babel-runtime": "^6.23.0",
|
|
73
|
-
"git-raw-commits": "^
|
|
73
|
+
"git-raw-commits": "^2.0.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "9ef77c205ce9338850b15374fd003f2052211803"
|
|
76
76
|
}
|