commit-and-tag-version 12.7.1 → 13.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/ci.yaml +8 -15
- package/.github/workflows/release-please.yml +7 -5
- package/CHANGELOG.md +36 -0
- package/MIGRATION.md +51 -0
- package/README.md +22 -21
- package/bin/cli.js +2 -2
- package/command.js +9 -4
- package/defaults.js +5 -3
- package/eslint.config.mjs +52 -42
- package/index.js +12 -12
- package/lib/checkpoint.js +5 -5
- package/lib/configuration.js +9 -6
- package/lib/detect-package-manager.js +4 -8
- package/lib/format-commit-message.js +2 -2
- package/lib/latest-semver-tag.js +30 -30
- package/lib/lifecycles/bump.js +97 -65
- package/lib/lifecycles/changelog.js +48 -60
- package/lib/lifecycles/commit.js +8 -8
- package/lib/lifecycles/tag.js +10 -10
- package/lib/preset-loader.js +73 -9
- package/lib/print-error.js +3 -3
- package/lib/run-exec.js +6 -5
- package/lib/run-execFile.js +6 -5
- package/lib/run-lifecycle-script.js +6 -6
- package/lib/stringify-package.js +1 -5
- package/lib/updaters/index.js +25 -12
- package/lib/updaters/types/csproj.js +4 -4
- package/lib/updaters/types/gradle.js +4 -4
- package/lib/updaters/types/json.js +9 -9
- package/lib/updaters/types/maven.js +25 -8
- package/lib/updaters/types/openapi.js +6 -6
- package/lib/updaters/types/plain-text.js +4 -4
- package/lib/updaters/types/python.js +4 -4
- package/lib/updaters/types/yaml.js +6 -6
- package/lib/write-file.js +3 -3
- package/package.json +25 -15
- package/test/commit-message-config.integration-test.js +23 -10
- package/test/config-files.integration-test.js +25 -10
- package/test/config-keys.integration-test.js +20 -7
- package/test/core.spec.js +103 -37
- package/test/git.integration-test.js +23 -15
- package/test/invalid-config.integration-test.js +19 -9
- package/test/mocks/pom-6.3.1-attrs-lf.xml +28 -0
- package/test/mocks/pom-6.4.0-attrs-lf.xml +29 -0
- package/test/mocks/vitest-mocks.js +260 -0
- package/test/package.json +3 -0
- package/test/pre-commit-hook.integration-test.js +22 -14
- package/test/preset.integration-test.js +7 -5
- package/test/setup-coverage.js +47 -0
- package/test/stringify-package.spec.js +1 -3
- package/test/utils.spec.js +3 -4
- package/vitest.config.js +26 -0
- package/jest.config.js +0 -28
- package/test/mocks/jest-mocks.js +0 -66
package/lib/updaters/index.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import defaults from '../../defaults.js';
|
|
4
|
+
import * as json from './types/json.js';
|
|
5
|
+
import * as plainText from './types/plain-text.js';
|
|
6
|
+
import * as maven from './types/maven.js';
|
|
7
|
+
import * as gradle from './types/gradle.js';
|
|
8
|
+
import * as csproj from './types/csproj.js';
|
|
9
|
+
import * as yaml from './types/yaml.js';
|
|
10
|
+
import * as openapi from './types/openapi.js';
|
|
11
|
+
import * as python from './types/python.js';
|
|
12
|
+
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
|
|
15
|
+
const JSON_BUMP_FILES = defaults.bumpFiles;
|
|
3
16
|
const updatersByType = {
|
|
4
|
-
json
|
|
5
|
-
'plain-text':
|
|
6
|
-
maven
|
|
7
|
-
gradle
|
|
8
|
-
csproj
|
|
9
|
-
yaml
|
|
10
|
-
openapi
|
|
11
|
-
python
|
|
17
|
+
json,
|
|
18
|
+
'plain-text': plainText,
|
|
19
|
+
maven,
|
|
20
|
+
gradle,
|
|
21
|
+
csproj,
|
|
22
|
+
yaml,
|
|
23
|
+
openapi,
|
|
24
|
+
python,
|
|
12
25
|
};
|
|
13
26
|
const PLAIN_TEXT_BUMP_FILES = ['VERSION.txt', 'version.txt'];
|
|
14
27
|
|
|
@@ -76,7 +89,7 @@ function isValidUpdater(obj) {
|
|
|
76
89
|
);
|
|
77
90
|
}
|
|
78
91
|
|
|
79
|
-
|
|
92
|
+
export function resolveUpdaterObjectFromArgument(arg) {
|
|
80
93
|
/**
|
|
81
94
|
* If an Object was not provided, we assume it's the path/filename
|
|
82
95
|
* of the updater.
|
|
@@ -117,4 +130,4 @@ module.exports.resolveUpdaterObjectFromArgument = function (arg) {
|
|
|
117
130
|
}
|
|
118
131
|
|
|
119
132
|
return updater;
|
|
120
|
-
}
|
|
133
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const versionRegex = /<Version>(.*)<\/Version>/;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export function readVersion(contents) {
|
|
4
4
|
const matches = versionRegex.exec(contents);
|
|
5
5
|
if (matches === null || matches.length !== 2) {
|
|
6
6
|
throw new Error(
|
|
@@ -8,8 +8,8 @@ module.exports.readVersion = function (contents) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
return matches[1];
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
export function writeVersion(contents, version) {
|
|
14
14
|
return contents.replace(versionRegex, `<Version>${version}</Version>`);
|
|
15
|
-
}
|
|
15
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const versionRegex = /^version\s*=\s*['"]([\d.]+.*)['"]/m;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export function readVersion(contents) {
|
|
4
4
|
const matches = versionRegex.exec(contents);
|
|
5
5
|
if (matches === null) {
|
|
6
6
|
throw new Error(
|
|
@@ -9,10 +9,10 @@ module.exports.readVersion = function (contents) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return matches[1];
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
export function writeVersion(contents, version) {
|
|
15
15
|
return contents.replace(versionRegex, () => {
|
|
16
16
|
return `version = "${version}"`;
|
|
17
17
|
});
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import detectIndent from 'detect-indent';
|
|
2
|
+
import detectNewline from 'detect-newline';
|
|
3
|
+
import stringifyPackage from '../../stringify-package.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export function readVersion(contents) {
|
|
6
6
|
return JSON.parse(contents).version;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
export function writeVersion(contents, version) {
|
|
10
10
|
const json = JSON.parse(contents);
|
|
11
11
|
const indent = detectIndent(contents).indent;
|
|
12
12
|
const newline = detectNewline(contents);
|
|
@@ -18,8 +18,8 @@ module.exports.writeVersion = function (contents, version) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return stringifyPackage(json, indent, newline);
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
export function isPrivate(contents) {
|
|
24
24
|
return JSON.parse(contents).private;
|
|
25
|
-
}
|
|
25
|
+
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import detectNewline from 'detect-newline';
|
|
2
|
+
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
|
|
3
3
|
|
|
4
4
|
const CRLF = '\r\n';
|
|
5
5
|
const LF = '\n';
|
|
6
6
|
|
|
7
7
|
function pomDocument(contents) {
|
|
8
|
-
const parser = new XMLParser(
|
|
8
|
+
const parser = new XMLParser({
|
|
9
|
+
// Preserve attributes on XML elements (fast-xml-parser strips them by default)
|
|
10
|
+
ignoreAttributes: false,
|
|
11
|
+
// Don't coerce element text to numbers/booleans (e.g. keep version "1.0" as a string)
|
|
12
|
+
parseTagValue: false,
|
|
13
|
+
// Don't coerce attribute values to numbers/booleans (e.g. keep port="8080" as a string)
|
|
14
|
+
parseAttributeValue: false,
|
|
15
|
+
// Preserve comments
|
|
16
|
+
commentPropName: '#comment',
|
|
17
|
+
});
|
|
9
18
|
return parser.parse(contents);
|
|
10
19
|
}
|
|
11
20
|
|
|
@@ -21,18 +30,26 @@ function pomVersion(document) {
|
|
|
21
30
|
return version;
|
|
22
31
|
}
|
|
23
32
|
|
|
24
|
-
|
|
33
|
+
export function readVersion(contents) {
|
|
25
34
|
const document = pomDocument(contents);
|
|
26
35
|
return pomVersion(document);
|
|
27
|
-
}
|
|
36
|
+
}
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
export function writeVersion(contents, version) {
|
|
30
39
|
const newline = detectNewline(contents);
|
|
31
40
|
const document = pomDocument(contents);
|
|
32
41
|
|
|
33
42
|
document.project.version = version;
|
|
34
43
|
|
|
35
|
-
const builder = new XMLBuilder({
|
|
44
|
+
const builder = new XMLBuilder({
|
|
45
|
+
// Preserve attributes on XML elements (fast-xml-parser strips them by default)
|
|
46
|
+
ignoreAttributes: false,
|
|
47
|
+
// Write fork="true" instead of shorthand fork (which is invalid in XML)
|
|
48
|
+
suppressBooleanAttributes: false,
|
|
49
|
+
format: true,
|
|
50
|
+
// Preserve comments
|
|
51
|
+
commentPropName: '#comment',
|
|
52
|
+
});
|
|
36
53
|
const xml = builder.build(document);
|
|
37
54
|
|
|
38
55
|
if (newline === CRLF) {
|
|
@@ -40,4 +57,4 @@ module.exports.writeVersion = function (contents, version) {
|
|
|
40
57
|
}
|
|
41
58
|
|
|
42
59
|
return xml + LF;
|
|
43
|
-
}
|
|
60
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import yaml from 'yaml';
|
|
2
|
+
import detectNewline from 'detect-newline';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export function readVersion(contents) {
|
|
5
5
|
return yaml.parse(contents).info.version;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export function writeVersion(contents, version) {
|
|
9
9
|
const newline = detectNewline(contents);
|
|
10
10
|
const document = yaml.parseDocument(contents);
|
|
11
11
|
|
|
12
12
|
document.get('info').set('version', version);
|
|
13
13
|
|
|
14
14
|
return document.toString().replace(/\r?\n/g, newline);
|
|
15
|
-
}
|
|
15
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export function readVersion(contents) {
|
|
2
2
|
return contents;
|
|
3
|
-
}
|
|
3
|
+
}
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export function writeVersion(_contents, version) {
|
|
6
6
|
return version;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
@@ -14,17 +14,17 @@ const getVersionIndex = function (lines) {
|
|
|
14
14
|
return { version, lineNumber };
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
export function readVersion(contents) {
|
|
18
18
|
const lines = contents.split('\n');
|
|
19
19
|
const versionIndex = getVersionIndex(lines);
|
|
20
20
|
return versionIndex.version;
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
export function writeVersion(contents, version) {
|
|
24
24
|
const lines = contents.split('\n');
|
|
25
25
|
const versionIndex = getVersionIndex(lines);
|
|
26
26
|
const versionLine = lines[versionIndex.lineNumber];
|
|
27
27
|
const newVersionLine = versionLine.replace(versionIndex.version, version);
|
|
28
28
|
lines[versionIndex.lineNumber] = newVersionLine;
|
|
29
29
|
return lines.join('\n');
|
|
30
|
-
}
|
|
30
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import yaml from 'yaml';
|
|
2
|
+
import detectNewline from 'detect-newline';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export function readVersion(contents) {
|
|
5
5
|
return yaml.parse(contents).version;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export function writeVersion(contents, version) {
|
|
9
9
|
const newline = detectNewline(contents);
|
|
10
10
|
const document = yaml.parseDocument(contents);
|
|
11
11
|
|
|
12
12
|
document.set('version', version);
|
|
13
13
|
|
|
14
14
|
return document.toString().replace(/\r?\n/g, newline);
|
|
15
|
-
}
|
|
15
|
+
}
|
package/lib/write-file.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commit-and-tag-version",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "replacement for `npm version` with automatic CHANGELOG generation",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"commit-and-tag-version": "bin/cli.js"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {
|
|
7
11
|
"lint": "eslint .",
|
|
8
12
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -10,14 +14,17 @@
|
|
|
10
14
|
"format:base": "prettier \"./**/*.{ts,js}\"",
|
|
11
15
|
"format:fix": "npm run format:base -- --write",
|
|
12
16
|
"format:check": "npm run format:base -- --check",
|
|
13
|
-
"test": "
|
|
14
|
-
"test:unit": "
|
|
15
|
-
"test:git-integration": "
|
|
17
|
+
"test": "vitest run --coverage",
|
|
18
|
+
"test:unit": "vitest run --exclude 'test/*.integration-test.js'",
|
|
19
|
+
"test:git-integration": "vitest run test/git.integration-test.js",
|
|
16
20
|
"release": "bin/cli.js"
|
|
17
21
|
},
|
|
18
|
-
"repository":
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/absolute-version/commit-and-tag-version.git"
|
|
25
|
+
},
|
|
19
26
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
27
|
+
"node": ">=22"
|
|
21
28
|
},
|
|
22
29
|
"keywords": [
|
|
23
30
|
"conventional-changelog",
|
|
@@ -39,34 +46,37 @@
|
|
|
39
46
|
},
|
|
40
47
|
"homepage": "https://github.com/absolute-version/commit-and-tag-version#readme",
|
|
41
48
|
"dependencies": {
|
|
49
|
+
"@conventional-changelog/git-client": "3.1.0",
|
|
42
50
|
"chalk": "^2.4.2",
|
|
43
|
-
"conventional-changelog": "
|
|
51
|
+
"conventional-changelog": "8.1.0",
|
|
44
52
|
"conventional-changelog-config-spec": "2.1.0",
|
|
45
|
-
"conventional-changelog-conventionalcommits": "
|
|
46
|
-
"conventional-recommended-bump": "
|
|
53
|
+
"conventional-changelog-conventionalcommits": "10.2.1",
|
|
54
|
+
"conventional-recommended-bump": "12.1.0",
|
|
47
55
|
"detect-indent": "^6.1.0",
|
|
48
56
|
"detect-newline": "^3.1.0",
|
|
49
57
|
"dotgitignore": "^2.1.0",
|
|
50
58
|
"fast-xml-parser": "^5.5.6",
|
|
51
59
|
"figures": "^3.2.0",
|
|
52
60
|
"find-up": "^5.0.0",
|
|
53
|
-
"git-semver-tags": "^5.0.1",
|
|
54
61
|
"semver": "^7.7.2",
|
|
55
62
|
"yaml": "^2.6.0",
|
|
56
63
|
"yargs": "^17.7.2"
|
|
57
64
|
},
|
|
58
65
|
"devDependencies": {
|
|
59
66
|
"@eslint/js": "^9.36.0",
|
|
67
|
+
"@vitest/coverage-istanbul": "^4.1.0",
|
|
68
|
+
"@vitest/eslint-plugin": "^1.6.23",
|
|
69
|
+
"conventional-changelog-angular": "^9.2.1",
|
|
60
70
|
"eslint": "^9.13.0",
|
|
61
71
|
"eslint-config-prettier": "^10.1.8",
|
|
62
72
|
"eslint-plugin-import": "^2.31.0",
|
|
63
|
-
"eslint-plugin-jest": "^28.8.3",
|
|
64
73
|
"eslint-plugin-n": "^17.21.3",
|
|
65
74
|
"eslint-plugin-promise": "^7.2.1",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
75
|
+
"istanbul-lib-instrument": "^6.0.3",
|
|
76
|
+
"pirates": "^4.0.7",
|
|
68
77
|
"prettier": "^3.3.3",
|
|
69
78
|
"shelljs": "^0.10.0",
|
|
70
|
-
"strip-ansi": "^6.0.1"
|
|
79
|
+
"strip-ansi": "^6.0.1",
|
|
80
|
+
"vitest": "^4.1.0"
|
|
71
81
|
}
|
|
72
82
|
}
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import shell from 'shelljs';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
const mockers = vi.hoisted(() => require('./mocks/vitest-mocks').setup());
|
|
5
|
+
vi.mock('conventional-changelog', () => mockers.conventionalChangelogModule());
|
|
6
|
+
vi.mock('conventional-recommended-bump', async (importOriginal) =>
|
|
7
|
+
mockers.conventionalRecommendedBumpModule(
|
|
8
|
+
await importOriginal(),
|
|
9
|
+
await import('@conventional-changelog/git-client'),
|
|
10
|
+
),
|
|
11
|
+
);
|
|
12
|
+
vi.mock('@conventional-changelog/git-client', async (importOriginal) =>
|
|
13
|
+
mockers.gitClientModule(await importOriginal()),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
vi.spyOn(console, 'info').mockImplementation(() => {});
|
|
17
|
+
vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
18
|
+
|
|
19
|
+
async function exec(opt = '') {
|
|
20
|
+
vi.resetModules();
|
|
21
|
+
const { default: cli } = await import('../command');
|
|
9
22
|
if (typeof opt === 'string') {
|
|
10
|
-
const cli = require('../command');
|
|
11
23
|
opt = cli.parse(`commit-and-tag-version ${opt}`);
|
|
12
24
|
}
|
|
13
|
-
|
|
25
|
+
const { default: standardVersion } = await import('../index');
|
|
26
|
+
return standardVersion(opt);
|
|
14
27
|
}
|
|
15
28
|
|
|
16
29
|
/**
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import shell from 'shelljs';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
const mockers = vi.hoisted(() => require('./mocks/vitest-mocks').setup());
|
|
5
|
+
vi.mock('conventional-changelog', () => mockers.conventionalChangelogModule());
|
|
6
|
+
vi.mock('conventional-recommended-bump', async (importOriginal) =>
|
|
7
|
+
mockers.conventionalRecommendedBumpModule(
|
|
8
|
+
await importOriginal(),
|
|
9
|
+
await import('@conventional-changelog/git-client'),
|
|
10
|
+
),
|
|
11
|
+
);
|
|
12
|
+
vi.mock('@conventional-changelog/git-client', async (importOriginal) =>
|
|
13
|
+
mockers.gitClientModule(await importOriginal()),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
vi.spyOn(console, 'info').mockImplementation(() => {});
|
|
17
|
+
vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
18
|
+
|
|
19
|
+
// command.js must be loaded AFTER shell.cd() changes CWD, because yargs.config()
|
|
20
|
+
// reads .versionrc at module load time. Use dynamic import with vi.resetModules().
|
|
21
|
+
async function exec() {
|
|
22
|
+
vi.resetModules();
|
|
23
|
+
const { default: cli } = await import('../command');
|
|
10
24
|
const opt = cli.parse('commit-and-tag-version');
|
|
11
25
|
opt.skip = { commit: true, tag: true };
|
|
12
|
-
|
|
26
|
+
const { default: standardVersion } = await import('../index');
|
|
27
|
+
return standardVersion(opt);
|
|
13
28
|
}
|
|
14
29
|
|
|
15
30
|
/**
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import shell from 'shelljs';
|
|
2
|
+
import fs from 'fs';
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
-
|
|
4
|
+
const mockers = vi.hoisted(() => require('./mocks/vitest-mocks').setup());
|
|
5
|
+
vi.mock('conventional-changelog', () => mockers.conventionalChangelogModule());
|
|
6
|
+
vi.mock('conventional-recommended-bump', async (importOriginal) =>
|
|
7
|
+
mockers.conventionalRecommendedBumpModule(
|
|
8
|
+
await importOriginal(),
|
|
9
|
+
await import('@conventional-changelog/git-client'),
|
|
10
|
+
),
|
|
11
|
+
);
|
|
12
|
+
vi.mock('@conventional-changelog/git-client', async (importOriginal) =>
|
|
13
|
+
mockers.gitClientModule(await importOriginal()),
|
|
14
|
+
);
|
|
5
15
|
|
|
6
|
-
|
|
16
|
+
vi.spyOn(console, 'info').mockImplementation(() => {});
|
|
17
|
+
vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
7
18
|
|
|
8
|
-
function exec() {
|
|
9
|
-
|
|
19
|
+
async function exec() {
|
|
20
|
+
vi.resetModules();
|
|
21
|
+
const { default: cli } = await import('../command');
|
|
10
22
|
const opt = cli.parse('commit-and-tag-version');
|
|
11
23
|
opt.skip = { commit: true, tag: true };
|
|
12
|
-
|
|
24
|
+
const { default: standardVersion } = await import('../index');
|
|
25
|
+
return standardVersion(opt);
|
|
13
26
|
}
|
|
14
27
|
|
|
15
28
|
/**
|