commitizen 5.0.2 → 6.0.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/.github/workflows/publish-approved-releases.yml +42 -0
- package/CONTRIBUTING.md +13 -2
- package/README.md +97 -6
- package/SECURITY.md +17 -0
- package/bin/git-cz.js +9 -6
- package/dist/cli/strategies/git-cz.js +1 -1
- package/dist/commitizen/adapter.js +26 -3
- package/dist/commitizen/configLoader.js +7 -7
- package/dist/commitizen/protocol.js +156 -0
- package/dist/common/util.js +0 -4
- package/docs/migrating-adapters.md +212 -0
- package/junit-testresults.xml +113 -110
- package/package.json +10 -11
- package/pnpm-workspace.yaml +8 -0
- package/renovate.json +12 -0
- package/dist/configLoader/findup.js +0 -33
- package/dist/configLoader/getContent.js +0 -72
- package/dist/configLoader/getNormalizedConfig.js +0 -30
- package/dist/configLoader/loader.js +0 -59
- package/dist/configLoader.js +0 -34
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commitizen",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Git commit, but play nice with conventions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"packageManager": "pnpm@12.
|
|
6
|
+
"packageManager": "pnpm@12.26.0",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
|
|
9
9
|
"commit": "node bin/git-cz",
|
|
@@ -45,19 +45,20 @@
|
|
|
45
45
|
"author": "Jim Cummins <jimthedev@gmail.com> (https://github.com/jimthedev)",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@babel/cli": "8.1.
|
|
49
|
-
"@babel/core": "8.1.
|
|
50
|
-
"@babel/preset-env": "8.1.
|
|
51
|
-
"@babel/register": "8.1.
|
|
48
|
+
"@babel/cli": "8.1.5",
|
|
49
|
+
"@babel/core": "8.1.5",
|
|
50
|
+
"@babel/preset-env": "8.1.5",
|
|
51
|
+
"@babel/register": "8.1.5",
|
|
52
52
|
"@istanbuljs/nyc-config-babel": "3.0.0",
|
|
53
53
|
"@semantic-release/exec": "7.1.0",
|
|
54
54
|
"babel-plugin-istanbul": "8.0.0",
|
|
55
55
|
"chai": "6.3.0",
|
|
56
56
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
57
|
+
"cz-conventional-changelog": "6.0.0",
|
|
57
58
|
"cz-conventional-changelog-default-export": "0.0.0-semantically-released.1",
|
|
58
59
|
"husky": "9.1.7",
|
|
59
60
|
"mocha": "12.0.3",
|
|
60
|
-
"npm-cli": "npm:npm@
|
|
61
|
+
"npm-cli": "npm:npm@12.2.3",
|
|
61
62
|
"nyc": "18.0.0",
|
|
62
63
|
"proxyquire": "2.1.3",
|
|
63
64
|
"semantic-release": "26.0.1",
|
|
@@ -66,14 +67,12 @@
|
|
|
66
67
|
"yarn-cli": "npm:yarn@1.22.22"
|
|
67
68
|
},
|
|
68
69
|
"dependencies": {
|
|
70
|
+
"@commitizen/config": "1.0.1",
|
|
69
71
|
"cachedir": "2.4.0",
|
|
70
|
-
"cz-conventional-changelog": "3.3.0",
|
|
71
72
|
"dedent": "1.7.2",
|
|
72
73
|
"detect-indent": "7.0.2",
|
|
73
|
-
"glob": "15.0.0",
|
|
74
74
|
"inquirer": "8.2.7",
|
|
75
|
-
"minimist": "1.2.8"
|
|
76
|
-
"strip-json-comments": "5.1.0"
|
|
75
|
+
"minimist": "1.2.8"
|
|
77
76
|
},
|
|
78
77
|
"nyc": {
|
|
79
78
|
"extends": "@istanbuljs/nyc-config-babel",
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -5,3 +5,11 @@ allowBuilds:
|
|
|
5
5
|
# yarn 1's preinstall only checks for corepack; the test suite runs the
|
|
6
6
|
# pinned yarn from node_modules/.bin and does not need it.
|
|
7
7
|
yarn: false
|
|
8
|
+
|
|
9
|
+
# Packages the commitizen maintainers publish skip pnpm's minimumReleaseAge wait
|
|
10
|
+
# (one day by default). They are released through npm staged publishing, so a
|
|
11
|
+
# maintainer approves every version with 2FA before it can be installed.
|
|
12
|
+
minimumReleaseAgeExclude:
|
|
13
|
+
- commitizen
|
|
14
|
+
- cz-conventional-changelog
|
|
15
|
+
- '@commitizen/*'
|
package/renovate.json
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
3
|
"github>commitizen/commitizen-renovate-config"
|
|
4
|
+
],
|
|
5
|
+
"packageRules": [
|
|
6
|
+
{
|
|
7
|
+
"description": "Adapters receive commitizen's inquirer 8 instance and many rely on its API, so inquirer stays on major version 8.",
|
|
8
|
+
"matchPackageNames": [
|
|
9
|
+
"inquirer"
|
|
10
|
+
],
|
|
11
|
+
"matchUpdateTypes": [
|
|
12
|
+
"major"
|
|
13
|
+
],
|
|
14
|
+
"enabled": false
|
|
15
|
+
}
|
|
4
16
|
]
|
|
5
17
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
8
|
-
var _glob = require("glob");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
var _default = exports.default = findup; // Before, "findup-sync" package was used,
|
|
11
|
-
// but it does not provide filter callback
|
|
12
|
-
function findup(patterns, options, fn) {
|
|
13
|
-
/* jshint -W083 */
|
|
14
|
-
|
|
15
|
-
var lastpath;
|
|
16
|
-
var file;
|
|
17
|
-
options = Object.create(options);
|
|
18
|
-
options.maxDepth = 1;
|
|
19
|
-
options.cwd = _nodePath.default.resolve(options.cwd);
|
|
20
|
-
do {
|
|
21
|
-
file = patterns.filter(function (pattern) {
|
|
22
|
-
var configPath = (0, _glob.globSync)(pattern, options)[0];
|
|
23
|
-
if (configPath) {
|
|
24
|
-
return fn(_nodePath.default.join(options.cwd, configPath));
|
|
25
|
-
}
|
|
26
|
-
})[0];
|
|
27
|
-
if (file) {
|
|
28
|
-
return _nodePath.default.join(options.cwd, file);
|
|
29
|
-
}
|
|
30
|
-
lastpath = options.cwd;
|
|
31
|
-
options.cwd = _nodePath.default.resolve(options.cwd, '..');
|
|
32
|
-
} while (options.cwd !== lastpath);
|
|
33
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
8
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
9
|
-
var _stripJsonComments = _interopRequireDefault(require("strip-json-comments"));
|
|
10
|
-
var _nodeBuffer = require("node:buffer");
|
|
11
|
-
var _configLoader = require("../configLoader");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
var _default = exports.default = getConfigContent;
|
|
14
|
-
/**
|
|
15
|
-
* Read the content of a configuration file
|
|
16
|
-
* - if not js or json: strip any comments
|
|
17
|
-
* - if js or json: require it
|
|
18
|
-
* @param {String} configPath - full path to configuration file
|
|
19
|
-
* @return {Object}
|
|
20
|
-
*/
|
|
21
|
-
function readConfigContent(configPath) {
|
|
22
|
-
const parsedPath = _nodePath.default.parse(configPath);
|
|
23
|
-
const isRcFile = parsedPath.ext !== '.js' && parsedPath.ext !== '.json';
|
|
24
|
-
const jsonString = readConfigFileContent(configPath);
|
|
25
|
-
const parse = isRcFile ? contents => JSON.parse((0, _stripJsonComments.default)(contents)) : contents => JSON.parse(contents);
|
|
26
|
-
try {
|
|
27
|
-
const parsed = parse(jsonString);
|
|
28
|
-
Object.defineProperty(parsed, 'configPath', {
|
|
29
|
-
value: configPath
|
|
30
|
-
});
|
|
31
|
-
return parsed;
|
|
32
|
-
} catch (error) {
|
|
33
|
-
error.message = [`Parsing JSON at ${configPath} for commitizen config failed:`, error.mesasge].join('\n');
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get content of the configuration file
|
|
40
|
-
* @param {String} configPath - partial path to configuration file
|
|
41
|
-
* @param {String} directory - directory path which will be joined with config argument
|
|
42
|
-
* @return {Object}
|
|
43
|
-
*/
|
|
44
|
-
function getConfigContent(configPath, baseDirectory) {
|
|
45
|
-
if (!configPath) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const resolvedPath = _nodePath.default.resolve(baseDirectory, configPath);
|
|
49
|
-
const configBasename = _nodePath.default.basename(resolvedPath);
|
|
50
|
-
if (!_nodeFs.default.existsSync(resolvedPath)) {
|
|
51
|
-
return (0, _configLoader.getNormalizedConfig)(resolvedPath);
|
|
52
|
-
}
|
|
53
|
-
const content = readConfigContent(resolvedPath);
|
|
54
|
-
return (0, _configLoader.getNormalizedConfig)(configBasename, content);
|
|
55
|
-
}
|
|
56
|
-
;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Read proper content from config file.
|
|
60
|
-
* If the chartset of the config file is not utf-8, one error will be thrown.
|
|
61
|
-
* @param {String} configPath
|
|
62
|
-
* @return {String}
|
|
63
|
-
*/
|
|
64
|
-
function readConfigFileContent(configPath) {
|
|
65
|
-
let rawBufContent = _nodeFs.default.readFileSync(configPath);
|
|
66
|
-
if (!(0, _nodeBuffer.isUtf8)(rawBufContent)) {
|
|
67
|
-
throw new Error(`The config file at "${configPath}" contains invalid charset, expect utf8`);
|
|
68
|
-
}
|
|
69
|
-
const content = rawBufContent.toString("utf8");
|
|
70
|
-
// Strip a UTF-8 byte order mark, if present.
|
|
71
|
-
return content.charCodeAt(0) === 0xFEFF ? content.slice(1) : content;
|
|
72
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = getNormalizedConfig; // Given a config and content, plucks the actual
|
|
8
|
-
// settings that we're interested in
|
|
9
|
-
function getNormalizedConfig(config, content) {
|
|
10
|
-
if (content && config === 'package.json') {
|
|
11
|
-
// PACKAGE.JSON
|
|
12
|
-
|
|
13
|
-
// Use the npm config key, be good citizens
|
|
14
|
-
if (content.config && content.config.commitizen) {
|
|
15
|
-
return content.config.commitizen;
|
|
16
|
-
} else if (content.czConfig) {
|
|
17
|
-
// Old method, will be deprecated in 3.0.0
|
|
18
|
-
|
|
19
|
-
// Suppress during test
|
|
20
|
-
/* istanbul ignore if */
|
|
21
|
-
if (typeof global.it !== 'function') {
|
|
22
|
-
console.error("\n********\nWARNING: This repository's package.json is using czConfig. czConfig will be deprecated in Commitizen 3. \nPlease use this instead:\n{\n \"config\": {\n \"commitizen\": {\n \"path\": \"./path/to/adapter\"\n }\n }\n}\nFor more information, see: http://commitizen.github.io/cz-cli/\n********\n");
|
|
23
|
-
}
|
|
24
|
-
return content.czConfig;
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
// .cz.json or .czrc
|
|
28
|
-
return content;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
8
|
-
var _configLoader = require("../configLoader");
|
|
9
|
-
var _util = require("../common/util.js");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
var _default = exports.default = loader;
|
|
12
|
-
/**
|
|
13
|
-
* Command line config helpers
|
|
14
|
-
* Shamelessly ripped from with slight modifications:
|
|
15
|
-
* https://github.com/jscs-dev/node-jscs/blob/master/lib/cli-config.js
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Get content of the configuration file
|
|
19
|
-
* @param {String} config - partial path to configuration file
|
|
20
|
-
* @param {String} [cwd = process.cwd()] - directory path which will be joined with config argument
|
|
21
|
-
* @return {Object|undefined}
|
|
22
|
-
*/
|
|
23
|
-
function loader(configs, config, cwd) {
|
|
24
|
-
var content;
|
|
25
|
-
var directory = cwd || process.cwd();
|
|
26
|
-
|
|
27
|
-
// If config option is given, attempt to load it
|
|
28
|
-
if (config) {
|
|
29
|
-
return (0, _configLoader.getContent)(config, directory);
|
|
30
|
-
}
|
|
31
|
-
content = (0, _configLoader.getContent)((0, _configLoader.findup)(configs, {
|
|
32
|
-
nocase: true,
|
|
33
|
-
cwd: directory
|
|
34
|
-
}, function (configPath) {
|
|
35
|
-
if (_nodePath.default.basename(configPath) === 'package.json') {
|
|
36
|
-
// return !!this.getContent(configPath);
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}));
|
|
40
|
-
if (content) {
|
|
41
|
-
return content;
|
|
42
|
-
}
|
|
43
|
-
/* istanbul ignore if */
|
|
44
|
-
if (!(0, _util.isInTest)()) {
|
|
45
|
-
// Try to load standard configs from home dir
|
|
46
|
-
var directoryArr = [process.env.USERPROFILE, process.env.HOMEPATH, process.env.HOME];
|
|
47
|
-
for (var i = 0, dirLen = directoryArr.length; i < dirLen; i++) {
|
|
48
|
-
if (!directoryArr[i]) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
for (var j = 0, len = configs.length; j < len; j++) {
|
|
52
|
-
content = (0, _configLoader.getContent)(configs[j], directoryArr[i]);
|
|
53
|
-
if (content) {
|
|
54
|
-
return content;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
package/dist/configLoader.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "findup", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _findup.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getContent", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _getContent.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "getNormalizedConfig", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _getNormalizedConfig.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "loader", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _loader.default;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var _findup = _interopRequireDefault(require("./configLoader/findup"));
|
|
31
|
-
var _getContent = _interopRequireDefault(require("./configLoader/getContent"));
|
|
32
|
-
var _getNormalizedConfig = _interopRequireDefault(require("./configLoader/getNormalizedConfig"));
|
|
33
|
-
var _loader = _interopRequireDefault(require("./configLoader/loader"));
|
|
34
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|