@polygontech/commit-template 1.0.0 → 1.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/CZRC.js CHANGED
@@ -39,6 +39,7 @@ CZRC.prototype.overwrite = function (overwrite) {
39
39
  CZRC.prototype.pushExtraImperativeVerbs = function (extraImperativeVerbs) {
40
40
  if (!Array.isArray(extraImperativeVerbs)) return;
41
41
  if (extraImperativeVerbs.length == 0) return;
42
+ extraImperativeVerbs = extraImperativeVerbs.map((v) => v.toLowerCase());
42
43
  this.extraImperativeVerbs = [...this.extraImperativeVerbs, ...extraImperativeVerbs];
43
44
  };
44
45
 
package/CZRCLoader.js CHANGED
@@ -57,7 +57,7 @@ CZRCLoader.prototype.overwriteFromProject = async function () {
57
57
  };
58
58
 
59
59
  CZRCLoader.prototype.loadFromProjectURL = async function () {
60
- let urlFile = process.cwd() + "/" + project_rc_url_file_name;
60
+ let urlFile = getProjectFolder() + "/" + project_rc_url_file_name;
61
61
 
62
62
  if (!fs.existsSync(urlFile)) return;
63
63
 
@@ -65,7 +65,7 @@ CZRCLoader.prototype.loadFromProjectURL = async function () {
65
65
  };
66
66
 
67
67
  CZRCLoader.prototype.loadFromProjectRC = function () {
68
- let project_rc_file_fqn = process.cwd() + "/" + project_rc_file_name;
68
+ let project_rc_file_fqn = getProjectFolder() + "/" + project_rc_file_name;
69
69
 
70
70
  if (!fs.existsSync(project_rc_file_fqn)) return;
71
71
 
@@ -104,14 +104,24 @@ async function ensureFile(file_fqn, file_url) {
104
104
 
105
105
  function getUrlFromFile(urlFile) {
106
106
  return read(urlFile)
107
- .split(/(?:\r\n|\r|\n)/g)
108
- .reduce((prev, cur) => {
109
- if (cur.startsWith("URL=")) return cur.replace("URL=", "");
110
- });
107
+ .trim()
108
+ .split(/(?:\r\n|\r|\n)/g)[1]
109
+ .replace("URL=", "");
111
110
  }
112
111
 
113
112
  function getProjectRCDownloadFileFQN() {
114
113
  return rc_folder_name + "/" + process.cwd().replace("/", "").replaceAll("/", "_").replaceAll("-", "_") + ".json";
115
114
  }
116
115
 
116
+ function getProjectFolder() {
117
+ let current = process.cwd();
118
+
119
+ while (current.length > 1) {
120
+ if (fs.existsSync(current + '/.git')) break;
121
+ current = current.split("/").slice(0, -1).join("/");
122
+ }
123
+
124
+ return current;
125
+ }
126
+
117
127
  module.exports = CZRCLoader;
package/README.md CHANGED
@@ -3,4 +3,4 @@ JS wrapper for the [commit template](https://github.com/ShafiqIslam/dotfiles/blo
3
3
 
4
4
  # usage
5
5
  Not for open use. Meant to be used with
6
- [@sheba/cz-convention](https://github.com/ShafiqIslam/cz-convention) and [@sheba/commitlint](https://github.com/ShafiqIslam/commitlint)
6
+ [@polygontech/cz-convention](https://github.com/ShafiqIslam/cz-convention) and [@polygontech/commitlint](https://github.com/ShafiqIslam/commitlint)
package/dto/message.js CHANGED
@@ -101,7 +101,7 @@ function validateSubject(subject) {
101
101
  }
102
102
 
103
103
  function isImperative(sentence) {
104
- let first_word = sentence.split(" ")[0];
104
+ let first_word = sentence.split(" ")[0].toLowerCase();
105
105
  let imperative = nlp(first_word).verbs().isImperative().text();
106
106
  if (first_word == imperative) return true;
107
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polygontech/commit-template",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "JS wrapper of https://github.com/ShafiqIslam/dotfiles/blob/master/git/.gitmessage.",
5
5
  "homepage": "https://github.com/ShafiqIslam/commit-template",
6
6
  "main": "index.js",
@@ -8,6 +8,9 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/ShafiqIslam/commit-template.git"
10
10
  },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
11
14
  "author": "Shafiqul Islam <islamshafiq003@gmail.com>",
12
15
  "license": "MIT",
13
16
  "dependencies": {