@html-validate/commitlint-config 1.3.0 → 2.1.1

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/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require("@commitlint/cli/cli.js");
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- extends: ["@commitlint/config-conventional"],
2
+ extends: [require.resolve("@commitlint/config-conventional")],
3
3
  rules: {
4
4
  "header-max-length": [2, "always", 90],
5
5
  },
package/install.js CHANGED
@@ -1,9 +1,59 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const fs = require("fs");
3
4
  const path = require("path");
4
5
  const { spawnSync } = require("child_process");
6
+ const isCI = require("is-ci");
5
7
 
6
- const gitmessage = path.join(path.relative(process.cwd(), __dirname), "gitmessage");
7
- const args = ["config", "commit.template", gitmessage];
8
- console.log(`git ${args.join(" ")}`);
9
- spawnSync("git", args);
8
+ /**
9
+ * Find the .git directory and return the absolute path.
10
+ *
11
+ * @param {string} cwd - Current working directory
12
+ * @returns {string} Absolute path to git or null if not found.
13
+ */
14
+ function findGit(cwd) {
15
+ let current = cwd;
16
+
17
+ // eslint-disable-next-line no-constant-condition
18
+ while (true) {
19
+ const search = path.join(current, ".git");
20
+
21
+ if (fs.existsSync(search)) {
22
+ return path.resolve(current);
23
+ }
24
+
25
+ /* get the parent directory */
26
+ const child = current;
27
+ current = path.dirname(current);
28
+
29
+ /* stop if this is the root directory */
30
+ if (current === child) {
31
+ break;
32
+ }
33
+ }
34
+
35
+ return null;
36
+ }
37
+
38
+ /**
39
+ * Calls "git config commit.template .."
40
+ *
41
+ * @returns {void}
42
+ */
43
+ function configureCommitTemplate() {
44
+ const gitDir = findGit(process.cwd());
45
+ if (!gitDir) {
46
+ console.warn("Failed to locate git directory, skipping gitmessage");
47
+ return;
48
+ }
49
+
50
+ const relPath = path.relative(gitDir, __dirname);
51
+ const gitmessage = path.join(relPath, "gitmessage");
52
+ const args = ["config", "commit.template", gitmessage];
53
+ console.info(`git ${args.join(" ")}`);
54
+ spawnSync("git", args);
55
+ }
56
+
57
+ if (!isCI) {
58
+ configureCommitTemplate();
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/commitlint-config",
3
- "version": "1.3.0",
3
+ "version": "2.1.1",
4
4
  "description": "Commitlint sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "commitlint"
@@ -17,17 +17,18 @@
17
17
  "author": "David Sveningsson <ext@sidvind.com>",
18
18
  "main": "index.js",
19
19
  "files": [
20
- "index.js",
21
- "install.js",
20
+ "*.js",
22
21
  "gitmessage"
23
22
  ],
24
- "bin": "install.js",
23
+ "bin": {
24
+ "commitlint": "cli.js",
25
+ "commitlint-config": "install.js"
26
+ },
25
27
  "scripts": {
26
28
  "prepare": "husky install",
27
29
  "postinstall": "node install.js",
28
30
  "prettier:check": "prettier --check .",
29
31
  "prettier:write": "prettier --write .",
30
- "semantic-release": "semantic-release",
31
32
  "test": "echo \"Error: no test specified\" && exit 1"
32
33
  },
33
34
  "commitlint": {
@@ -40,20 +41,21 @@
40
41
  },
41
42
  "prettier": "@html-validate/prettier-config",
42
43
  "dependencies": {
43
- "@commitlint/config-conventional": "^11.0.0"
44
+ "@commitlint/cli": "^13.2.0",
45
+ "@commitlint/config-conventional": "^13.0.0",
46
+ "is-ci": "^3.0.0"
44
47
  },
45
48
  "devDependencies": {
46
- "@commitlint/cli": "11.0.0",
47
- "@html-validate/prettier-config": "1.1.0",
48
- "@html-validate/semantic-release-config": "1.2.6",
49
- "husky": "5.0.9",
50
- "lint-staged": "10.5.4",
51
- "npm-pkg-lint": "1.3.0",
52
- "prettier": "2.2.1",
53
- "semantic-release": "17.3.9"
49
+ "@html-validate/prettier-config": "2.0.0",
50
+ "@html-validate/semantic-release-config": "3.0.1",
51
+ "husky": "7.0.2",
52
+ "lint-staged": "11.2.3",
53
+ "npm-pkg-lint": "1.5.0",
54
+ "prettier": "2.4.1",
55
+ "semantic-release": "18.0.0"
54
56
  },
55
57
  "engines": {
56
- "node": ">= 10.0"
58
+ "node": ">= 12.0"
57
59
  },
58
60
  "publishConfig": {
59
61
  "access": "public"
@@ -63,7 +65,15 @@
63
65
  },
64
66
  "renovate": {
65
67
  "extends": [
66
- "@html-validate:proxy"
68
+ "@html-validate"
69
+ ],
70
+ "packageRules": [
71
+ {
72
+ "matchSourceUrlPrefixes": [
73
+ "https://github.com/conventional-changelog/commitlint"
74
+ ],
75
+ "pin": true
76
+ }
67
77
  ]
68
78
  }
69
79
  }
package/CHANGELOG.md DELETED
@@ -1,45 +0,0 @@
1
- # @html-validate/commitlint-config changelog
2
-
3
- ## [1.3.0](https://gitlab.com/html-validate/commitlint-config/compare/v1.2.0...v1.3.0) (2021-02-21)
4
-
5
- ### Features
6
-
7
- - automatically configure git message ([0c087e9](https://gitlab.com/html-validate/commitlint-config/commit/0c087e910184a61f070ce21a4cf7b7e899013bd0))
8
-
9
- ### Dependency upgrades
10
-
11
- - **deps:** revert `@commitlint/cli` dependency ([644221a](https://gitlab.com/html-validate/commitlint-config/commit/644221a5757600c8eea9a3fbf3dce2eafd167fd0))
12
-
13
- ## [1.2.0](https://gitlab.com/html-validate/commitlint-config/compare/v1.1.1...v1.2.0) (2020-12-03)
14
-
15
- ### Features
16
-
17
- - include `@commitlint/cli` as dependency ([51baad8](https://gitlab.com/html-validate/commitlint-config/commit/51baad883eb19a9de907b316578e326d64a8ff27))
18
-
19
- ## [1.1.1](https://gitlab.com/html-validate/commitlint-config/compare/v1.1.0...v1.1.1) (2020-11-01)
20
-
21
- ### Bug Fixes
22
-
23
- - add missing file ([d6428e2](https://gitlab.com/html-validate/commitlint-config/commit/d6428e26a633f45185f4dc4623a4c4f451de38c0))
24
-
25
- # [1.1.0](https://gitlab.com/html-validate/commitlint-config/compare/v1.0.3...v1.1.0) (2020-11-01)
26
-
27
- ### Features
28
-
29
- - add `gitmessage` and instructions to use it ([2f8de28](https://gitlab.com/html-validate/commitlint-config/commit/2f8de2890b8b0f7aa4abf23e289748b6dd390ce4))
30
-
31
- ## [1.0.3](https://gitlab.com/html-validate/commitlint-config/compare/v1.0.2...v1.0.3) (2020-03-30)
32
-
33
- ## [1.0.2](https://gitlab.com/html-validate/commitlint-config/compare/v1.0.1...v1.0.2) (2020-03-22)
34
-
35
- ## [1.0.1](https://gitlab.com/html-validate/commitlint-config/compare/v1.0.0...v1.0.1) (2019-12-25)
36
-
37
- ### Bug Fixes
38
-
39
- - use regular dependency ([50c8919](https://gitlab.com/html-validate/commitlint-config/commit/50c8919b354248ea7de2e0b6da6787f9331674a1))
40
-
41
- # 1.0.0 (2019-12-25)
42
-
43
- ### Features
44
-
45
- - initial release refactored from html-validate ([f0515cd](https://gitlab.com/html-validate/commitlint-config/commit/f0515cd2ebb43f23396360e134dc523bb9322737))