@commitlint/read 7.1.1 → 7.6.0
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 +55 -1
- package/README.md +1 -1
- package/lib/index.js +55 -7
- package/lib/index.js.map +1 -1
- package/license.md +21 -0
- package/package.json +9 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,8 +3,62 @@
|
|
|
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
|
+
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* use sander.readFile correctly ([#448](https://github.com/conventional-changelog/commitlint/issues/448)) ([#630](https://github.com/conventional-changelog/commitlint/issues/630)) ([8e47985](https://github.com/conventional-changelog/commitlint/commit/8e47985))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<a name="7.5.0"></a>
|
|
18
|
+
# [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* all broken website references ([#564](https://github.com/conventional-changelog/commitlint/issues/564)) ([82eeb5a](https://github.com/conventional-changelog/commitlint/commit/82eeb5a))
|
|
24
|
+
* replace all repository references with conventional changelog ([#561](https://github.com/conventional-changelog/commitlint/issues/561)) ([6c3afcd](https://github.com/conventional-changelog/commitlint/commit/6c3afcd))
|
|
25
|
+
* replace all website references with conventional changelog ([#563](https://github.com/conventional-changelog/commitlint/issues/563)) ([6b86fb1](https://github.com/conventional-changelog/commitlint/commit/6b86fb1))
|
|
26
|
+
* resolve path to commit message for git submodules ([83b1a47](https://github.com/conventional-changelog/commitlint/commit/83b1a47))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* add support for git submodules ([cc575fa](https://github.com/conventional-changelog/commitlint/commit/cc575fa))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<a name="7.3.1"></a>
|
|
37
|
+
## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @commitlint/read
|
|
43
|
+
|
|
44
|
+
<a name="7.3.0"></a>
|
|
45
|
+
# [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
**Note:** Version bump only for package @commitlint/read
|
|
51
|
+
|
|
52
|
+
<a name="7.1.2"></a>
|
|
53
|
+
## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
**Note:** Version bump only for package @commitlint/read
|
|
59
|
+
|
|
6
60
|
<a name="6.1.1"></a>
|
|
7
|
-
## [6.1.1](https://github.com/
|
|
61
|
+
## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
|
|
8
62
|
|
|
9
63
|
|
|
10
64
|
|
package/README.md
CHANGED
|
@@ -24,4 +24,4 @@ read({from: 'HEAD~2', to: 'HEAD~1'})
|
|
|
24
24
|
// => ['Initial commit\n\n']
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Consult [docs/api](
|
|
27
|
+
Consult [docs/api](https://conventional-changelog.github.io/commitlint/#/reference-api) for comprehensive documentation.
|
package/lib/index.js
CHANGED
|
@@ -61,21 +61,27 @@ function getHistoryCommits(options, opts = {}) {
|
|
|
61
61
|
function getEditCommit(cwd, edit) {
|
|
62
62
|
return new Promise(function ($return, $error) {
|
|
63
63
|
var top, editFilePath, editFile;
|
|
64
|
-
return Promise.resolve((0, _topLevel2.default)(cwd)).then(function ($
|
|
64
|
+
return Promise.resolve((0, _topLevel2.default)(cwd)).then(function ($await_3) {
|
|
65
65
|
try {
|
|
66
|
-
top = $
|
|
66
|
+
top = $await_3;
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
if (typeof top !== 'string') {
|
|
70
70
|
return $error(new TypeError(`Could not find git root from ${cwd}`));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
return Promise.resolve(sander.readFile(editFilePath)).then(function ($await_2) {
|
|
73
|
+
return Promise.resolve(getEditFilePath(top, edit)).then(function ($await_4) {
|
|
75
74
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
editFilePath = $await_4;
|
|
76
|
+
return Promise.resolve(sander.readFile(editFilePath)).then(function ($await_5) {
|
|
77
|
+
try {
|
|
78
|
+
editFile = $await_5;
|
|
79
|
+
|
|
80
|
+
return $return([`${editFile.toString('utf-8')}\n`]);
|
|
81
|
+
} catch ($boundEx) {
|
|
82
|
+
return $error($boundEx);
|
|
83
|
+
}
|
|
84
|
+
}.bind(this), $error);
|
|
79
85
|
} catch ($boundEx) {
|
|
80
86
|
return $error($boundEx);
|
|
81
87
|
}
|
|
@@ -86,5 +92,47 @@ function getEditCommit(cwd, edit) {
|
|
|
86
92
|
}.bind(this), $error);
|
|
87
93
|
}.bind(this));
|
|
88
94
|
}
|
|
95
|
+
|
|
96
|
+
// Get path to recently edited commit message file
|
|
97
|
+
// (top: string, edit: any) => Promise<String>
|
|
98
|
+
function getEditFilePath(top, edit) {
|
|
99
|
+
return new Promise(function ($return, $error) {
|
|
100
|
+
var dotgitPath, dotgitStats, gitFile, relativeGitPath;
|
|
101
|
+
let editFilePath;
|
|
102
|
+
|
|
103
|
+
if (typeof edit === 'string') {
|
|
104
|
+
editFilePath = _path2.default.resolve(top, edit);
|
|
105
|
+
return $If_1.call(this);
|
|
106
|
+
} else {
|
|
107
|
+
dotgitPath = _path2.default.join(top, '.git');
|
|
108
|
+
dotgitStats = sander.lstatSync(dotgitPath);
|
|
109
|
+
|
|
110
|
+
if (dotgitStats.isDirectory()) {
|
|
111
|
+
editFilePath = _path2.default.join(top, '.git/COMMIT_EDITMSG');
|
|
112
|
+
return $If_2.call(this);
|
|
113
|
+
} else {
|
|
114
|
+
return Promise.resolve(sander.readFile(dotgitPath, { encoding: 'utf-8' })).then(function ($await_6) {
|
|
115
|
+
try {
|
|
116
|
+
gitFile = $await_6;
|
|
117
|
+
relativeGitPath = gitFile.replace('gitdir: ', '').replace('\n', '');
|
|
118
|
+
|
|
119
|
+
editFilePath = _path2.default.resolve(top, relativeGitPath, 'COMMIT_EDITMSG');
|
|
120
|
+
return $If_2.call(this);
|
|
121
|
+
} catch ($boundEx) {
|
|
122
|
+
return $error($boundEx);
|
|
123
|
+
}
|
|
124
|
+
}.bind(this), $error);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function $If_2() {
|
|
128
|
+
return $If_1.call(this);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function $If_1() {
|
|
133
|
+
return $return(editFilePath);
|
|
134
|
+
}
|
|
135
|
+
}.bind(this));
|
|
136
|
+
}
|
|
89
137
|
module.exports = exports['default'];
|
|
90
138
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["sander","getCommitMessages","settings","cwd","from","to","edit","getEditCommit","getHistoryCommits","options","opts","Promise","resolve","reject","data","on","chunk","push","toString","top","TypeError","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["sander","getCommitMessages","settings","cwd","from","to","edit","getEditCommit","getHistoryCommits","options","opts","Promise","resolve","reject","data","on","chunk","push","toString","top","TypeError","getEditFilePath","editFilePath","readFile","editFile","dotgitPath","join","dotgitStats","lstatSync","isDirectory","encoding","gitFile","relativeGitPath","replace"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;IAAYA,M;;AAEZ;;;;;;;;kBAEeC,iB;;AAEf;AACA;;AACA,SAAeA,iBAAf,CAAiCC,QAAjC;AAAA;AAAA,QACQC,GADR,GAC+BD,QAD/B,CACQC,GADR;AAAA,QACaC,IADb,GAC+BF,QAD/B,CACaE,IADb;AAAA,QACmBC,EADnB,GAC+BH,QAD/B,CACmBG,EADnB;AAAA,QACuBC,IADvB,GAC+BJ,QAD/B,CACuBI,IADvB;;;AAGC,MAAIA,IAAJ,EAAU;AACT,kBAAOC,cAAcJ,GAAd,EAAmBG,IAAnB,CAAP;AACA;;AAED,iBAAOE,kBAAkB,EAACJ,IAAD,EAAOC,EAAP,EAAlB,EAA8B,EAACF,GAAD,EAA9B,CAAP;AAPD;AAAA;;AAUA;AACA;AACA,SAASK,iBAAT,CAA2BC,OAA3B,EAAoCC,OAAO,EAA3C,EAA+C;AAC9C,QAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACvC,QAAMC,OAAO,EAAb;AACA,+BAAcL,OAAd,EAAuB,EAACN,KAAKO,KAAKP,GAAX,EAAvB,EACEY,EADF,CACK,MADL,EACaC,SAASF,KAAKG,IAAL,CAAUD,MAAME,QAAN,CAAe,OAAf,CAAV,CADtB,EAEEH,EAFF,CAEK,OAFL,EAEcF,MAFd,EAGEE,EAHF,CAGK,KAHL,EAGY,MAAM;AAChBH,WAAQE,IAAR;AACA,GALF;AAMA,EARM,CAAP;AASA;;AAED;AACA;AACA,SAAeP,aAAf,CAA6BJ,GAA7B,EAAkCG,IAAlC;AAAA;AAAA;AACa,yBAAM,wBAASH,GAAT,CAAN;AAAA;AAANgB,OAAM;;;AAEZ,QAAI,OAAOA,GAAP,KAAe,QAAnB,EAA6B;AAC5B,mBAAM,IA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;AAAA","file":"index.js","sourcesContent":["import path from 'path';\nimport gitRawCommits from 'git-raw-commits';\nimport * as sander from '@marionebl/sander';\n\nimport toplevel from '@commitlint/top-level';\n\nexport default getCommitMessages;\n\n// Get commit messages\n// Object => Promise<Array<String>>\nasync function getCommitMessages(settings) {\n\tconst {cwd, from, to, edit} = settings;\n\n\tif (edit) {\n\t\treturn getEditCommit(cwd, edit);\n\t}\n\n\treturn getHistoryCommits({from, to}, {cwd});\n}\n\n// Get commit messages from history\n// Object => Promise<string[]>\nfunction getHistoryCommits(options, opts = {}) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst data = [];\n\t\tgitRawCommits(options, {cwd: opts.cwd})\n\t\t\t.on('data', chunk => data.push(chunk.toString('utf-8')))\n\t\t\t.on('error', reject)\n\t\t\t.on('end', () => {\n\t\t\t\tresolve(data);\n\t\t\t});\n\t});\n}\n\n// Get recently edited commit message\n// (cwd: string, edit: any) => Promise<Array<String>>\nasync function getEditCommit(cwd, edit) {\n\tconst top = await toplevel(cwd);\n\n\tif (typeof top !== 'string') {\n\t\tthrow new TypeError(`Could not find git root from ${cwd}`);\n\t}\n\n\tconst editFilePath = await getEditFilePath(top, edit);\n\n\tconst editFile = await sander.readFile(editFilePath);\n\treturn [`${editFile.toString('utf-8')}\\n`];\n}\n\n// Get path to recently edited commit message file\n// (top: string, edit: any) => Promise<String>\nasync function getEditFilePath(top, edit) {\n\tlet editFilePath;\n\tif (typeof edit === 'string') {\n\t\teditFilePath = path.resolve(top, edit);\n\t} else {\n\t\tconst dotgitPath = path.join(top, '.git');\n\t\tconst dotgitStats = sander.lstatSync(dotgitPath);\n\t\tif (dotgitStats.isDirectory()) {\n\t\t\teditFilePath = path.join(top, '.git/COMMIT_EDITMSG');\n\t\t} else {\n\t\t\tconst gitFile = await sander.readFile(dotgitPath, {encoding: 'utf-8'});\n\t\t\tconst relativeGitPath = gitFile.replace('gitdir: ', '').replace('\\n', '');\n\t\t\teditFilePath = path.resolve(top, relativeGitPath, 'COMMIT_EDITMSG');\n\t\t}\n\t}\n\n\treturn editFilePath;\n}\n"]}
|
package/license.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 - present Mario Nebl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/read",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Read commit messages from a specified range or last edit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
|
|
11
|
-
"clean": "npx rimraf lib",
|
|
12
11
|
"deps": "dep-check",
|
|
13
12
|
"pkg": "pkg-check --skip-import",
|
|
14
|
-
"lint": "xo",
|
|
15
13
|
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
|
|
16
14
|
"test": "ava -c 4 --verbose",
|
|
17
15
|
"watch": "babel src --out-dir lib --watch --source-maps"
|
|
@@ -35,18 +33,17 @@
|
|
|
35
33
|
"babel-preset-commitlint"
|
|
36
34
|
]
|
|
37
35
|
},
|
|
38
|
-
"xo": false,
|
|
39
36
|
"engines": {
|
|
40
37
|
"node": ">=4"
|
|
41
38
|
},
|
|
42
39
|
"repository": {
|
|
43
40
|
"type": "git",
|
|
44
|
-
"url": "https://github.com/
|
|
41
|
+
"url": "https://github.com/conventional-changelog/commitlint.git"
|
|
45
42
|
},
|
|
46
43
|
"bugs": {
|
|
47
|
-
"url": "https://github.com/
|
|
44
|
+
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
|
48
45
|
},
|
|
49
|
-
"homepage": "https://github.com/
|
|
46
|
+
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
|
|
50
47
|
"keywords": [
|
|
51
48
|
"conventional-changelog",
|
|
52
49
|
"commitlint",
|
|
@@ -59,20 +56,18 @@
|
|
|
59
56
|
},
|
|
60
57
|
"license": "MIT",
|
|
61
58
|
"devDependencies": {
|
|
62
|
-
"@commitlint/test": "^7.
|
|
63
|
-
"@commitlint/utils": "^7.
|
|
59
|
+
"@commitlint/test": "^7.6.0",
|
|
60
|
+
"@commitlint/utils": "^7.6.0",
|
|
64
61
|
"ava": "0.22.0",
|
|
65
62
|
"babel-cli": "6.26.0",
|
|
66
|
-
"babel-preset-commitlint": "^7.
|
|
63
|
+
"babel-preset-commitlint": "^7.6.0",
|
|
67
64
|
"babel-register": "6.26.0",
|
|
68
65
|
"concurrently": "3.5.1",
|
|
69
66
|
"cross-env": "5.1.1",
|
|
70
|
-
"execa": "0.9.0"
|
|
71
|
-
"rimraf": "2.6.1",
|
|
72
|
-
"xo": "0.20.3"
|
|
67
|
+
"execa": "0.9.0"
|
|
73
68
|
},
|
|
74
69
|
"dependencies": {
|
|
75
|
-
"@commitlint/top-level": "^7.
|
|
70
|
+
"@commitlint/top-level": "^7.6.0",
|
|
76
71
|
"@marionebl/sander": "^0.6.0",
|
|
77
72
|
"babel-runtime": "^6.23.0",
|
|
78
73
|
"git-raw-commits": "^1.3.0"
|