@commitlint/read 7.3.1 → 8.1.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 CHANGED
@@ -3,8 +3,46 @@
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.1.0](https://github.com/conventional-changelog/commitlint/compare/v8.0.0...v8.1.0) (2019-07-15)
7
+
8
+ **Note:** Version bump only for package @commitlint/read
9
+
10
+
11
+
12
+
13
+
14
+ # [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * 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))
20
+
21
+
22
+
23
+
24
+
25
+ <a name="7.5.0"></a>
26
+ # [7.5.0](https://github.com/conventional-changelog/commitlint/compare/v7.4.0...v7.5.0) (2019-01-31)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * all broken website references ([#564](https://github.com/conventional-changelog/commitlint/issues/564)) ([82eeb5a](https://github.com/conventional-changelog/commitlint/commit/82eeb5a))
32
+ * 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))
33
+ * 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))
34
+ * resolve path to commit message for git submodules ([83b1a47](https://github.com/conventional-changelog/commitlint/commit/83b1a47))
35
+
36
+
37
+ ### Features
38
+
39
+ * add support for git submodules ([cc575fa](https://github.com/conventional-changelog/commitlint/commit/cc575fa))
40
+
41
+
42
+
43
+
6
44
  <a name="7.3.1"></a>
7
- ## [7.3.1](https://github.com/marionebl/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
45
+ ## [7.3.1](https://github.com/conventional-changelog/commitlint/compare/v7.3.0...v7.3.1) (2019-01-11)
8
46
 
9
47
 
10
48
 
@@ -12,7 +50,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
12
50
  **Note:** Version bump only for package @commitlint/read
13
51
 
14
52
  <a name="7.3.0"></a>
15
- # [7.3.0](https://github.com/marionebl/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
53
+ # [7.3.0](https://github.com/conventional-changelog/commitlint/compare/v7.2.1...v7.3.0) (2019-01-11)
16
54
 
17
55
 
18
56
 
@@ -20,7 +58,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
20
58
  **Note:** Version bump only for package @commitlint/read
21
59
 
22
60
  <a name="7.1.2"></a>
23
- ## [7.1.2](https://github.com/marionebl/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
61
+ ## [7.1.2](https://github.com/conventional-changelog/commitlint/compare/v7.1.1...v7.1.2) (2018-09-04)
24
62
 
25
63
 
26
64
 
@@ -28,7 +66,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
28
66
  **Note:** Version bump only for package @commitlint/read
29
67
 
30
68
  <a name="6.1.1"></a>
31
- ## [6.1.1](https://github.com/marionebl/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
69
+ ## [6.1.1](https://github.com/conventional-changelog/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)
32
70
 
33
71
 
34
72
 
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](http://marionebl.github.io/commitlint/#/reference-api) for comprehensive documentation.
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 ($await_1) {
64
+ return Promise.resolve((0, _topLevel2.default)(cwd)).then(function ($await_3) {
65
65
  try {
66
- top = $await_1;
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
- editFilePath = typeof edit === 'string' ? _path2.default.resolve(top, edit) : _path2.default.join(top, '.git/COMMIT_EDITMSG');
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
- editFile = $await_2;
77
-
78
- return $return([`${editFile.toString('utf-8')}\n`]);
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","editFilePath","join","readFile","editFile"],"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,IAAIC,SAAJ,CAAe,gCAA+BjB,GAAI,EAAlD,CAAN;AACA;;AAEKkB,gBANM,GAOX,OAAOf,IAAP,KAAgB,QAAhB,GACG,eAAKM,OAAL,CAAaO,GAAb,EAAkBb,IAAlB,CADH,GAEG,eAAKgB,IAAL,CAAUH,GAAV,EAAe,qBAAf,CATQ;AAWK,2BAAMnB,OAAOuB,QAAP,CAAgBF,YAAhB,CAAN;AAAA;AAAXG,cAAW;;AACjB,qBAAO,CAAE,GAAEA,SAASN,QAAT,CAAkB,OAAlB,CAA2B,IAA/B,CAAP;AADiB;AAAA;AAAA;AAAA;AAXL;AAAA;AAAA;AAAA;AADb;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 =\n\t\ttypeof edit === 'string'\n\t\t\t? path.resolve(top, edit)\n\t\t\t: path.join(top, '.git/COMMIT_EDITMSG');\n\n\tconst editFile = await sander.readFile(editFilePath);\n\treturn [`${editFile.toString('utf-8')}\\n`];\n}\n"]}
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,iBAA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e,eAAKV,OAAL,CAAaO,GAAb,EAAkBb,IAAlB,CAAf;AAD6B;AAE7B,GAFD,MAEO;AACAmB,aADA,GACa,eAAKC,IAAL,CAAUP,GAAV,EAAe,MAAf,CADb;AAEAQ,cAFA,GAEc3B,OAAO4B,SAAP,CAAiBH,UAAjB,CAFd;;AAGN,OAAIE,YAAYE,WAAZ,EAAJ,EAA+B;AAC9BP,mBAAe,eAAKI,IAAL,CAAUP,GAAV,EAAe,qBAAf,CAAf;AAD8B;AAE9B,IAFD,MAEO;AACU,2BAAMnB,OAAOuB,QAAP,CAAgBE,UAAhB,EAA4B,EAACK,UAAU,OAAX,EAA5B,CAAN;AAAA;AAAVC,aAAU;AACVC,qBADU,GACQD,QAAQE,OAAR,CAAgB,UAAhB,EAA4B,EAA5B,EAAgCA,OAAhC,CAAwC,IAAxC,EAA8C,EAA9C,CADR;;AAEhBX,qBAAe,eAAKV,OAAL,CAAaO,GAAb,EAAkBa,eAAlB,EAAmC,gBAAnC,CAAf;AAFgB;AAAA;AAAA;AAAA;AAAA;AAGhB;;AATK;AAAA;AAAA;AAUN;;AAdF;AAgBC,kBAAOV,YAAP;AAhBD;AAAA;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commitlint/read",
3
- "version": "7.3.1",
3
+ "version": "8.1.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/marionebl/commitlint.git"
41
+ "url": "https://github.com/conventional-changelog/commitlint.git"
45
42
  },
46
43
  "bugs": {
47
- "url": "https://github.com/marionebl/commitlint/issues"
44
+ "url": "https://github.com/conventional-changelog/commitlint/issues"
48
45
  },
49
- "homepage": "https://github.com/marionebl/commitlint#readme",
46
+ "homepage": "https://github.com/conventional-changelog/commitlint#readme",
50
47
  "keywords": [
51
48
  "conventional-changelog",
52
49
  "commitlint",
@@ -59,22 +56,21 @@
59
56
  },
60
57
  "license": "MIT",
61
58
  "devDependencies": {
62
- "@commitlint/test": "^7.3.1",
63
- "@commitlint/utils": "^7.3.1",
59
+ "@commitlint/test": "8.0.0",
60
+ "@commitlint/utils": "^8.1.0",
64
61
  "ava": "0.22.0",
65
62
  "babel-cli": "6.26.0",
66
- "babel-preset-commitlint": "^7.3.1",
63
+ "babel-preset-commitlint": "^8.0.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.3.1",
70
+ "@commitlint/top-level": "^8.1.0",
76
71
  "@marionebl/sander": "^0.6.0",
77
72
  "babel-runtime": "^6.23.0",
78
73
  "git-raw-commits": "^1.3.0"
79
- }
74
+ },
75
+ "gitHead": "c17420d67adafdf37f68d6861d29a0e85a4a3bd7"
80
76
  }