release-it 20.0.0 → 20.0.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/lib/config.js +9 -2
- package/package.json +4 -4
- package/test/config.js +13 -0
- package/types/config.d.ts +1 -1
package/lib/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import util from 'node:util';
|
|
2
2
|
import assert from 'node:assert';
|
|
3
3
|
import { isCI } from 'ci-info';
|
|
4
|
-
import
|
|
4
|
+
import { createDefu } from 'defu';
|
|
5
5
|
import { isObjectStrict } from '@phun-ky/typeof';
|
|
6
6
|
import merge from 'lodash.merge';
|
|
7
7
|
import { loadConfig as loadC12 } from 'c12';
|
|
@@ -10,6 +10,13 @@ import { get, getSystemInfo, readJSON } from './util.js';
|
|
|
10
10
|
const debug = util.debug('release-it:config');
|
|
11
11
|
const defaultConfig = readJSON(new URL('../config/release-it.json', import.meta.url));
|
|
12
12
|
|
|
13
|
+
const defu = createDefu((obj, key, value) => {
|
|
14
|
+
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
15
|
+
obj[key] = value;
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
13
20
|
class Config {
|
|
14
21
|
constructor(config = {}) {
|
|
15
22
|
this.constructorConfig = config;
|
|
@@ -92,7 +99,7 @@ class Config {
|
|
|
92
99
|
|
|
93
100
|
async function loadOptions(constructorConfig) {
|
|
94
101
|
const localConfig = await loadLocalConfig(constructorConfig);
|
|
95
|
-
const merged =
|
|
102
|
+
const merged = defu(
|
|
96
103
|
{},
|
|
97
104
|
constructorConfig,
|
|
98
105
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.1",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
},
|
|
79
79
|
"license": "MIT",
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@inquirer/prompts": "8.
|
|
82
|
-
"
|
|
81
|
+
"@inquirer/prompts": "8.4.2",
|
|
82
|
+
"defu": "^6.1.7",
|
|
83
83
|
"@octokit/rest": "22.0.1",
|
|
84
84
|
"@phun-ky/typeof": "2.0.3",
|
|
85
85
|
"async-retry": "1.3.3",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"eslint-plugin-import-x": "4.16.2",
|
|
111
111
|
"globals": "17.4.0",
|
|
112
112
|
"installed-check": "10.0.1",
|
|
113
|
-
"knip": "6.
|
|
113
|
+
"knip": "6.6.2",
|
|
114
114
|
"mentoss": "0.13.0",
|
|
115
115
|
"mock-stdio": "1.0.3",
|
|
116
116
|
"prettier": "3.8.1",
|
package/test/config.js
CHANGED
|
@@ -65,6 +65,19 @@ describe('config', async () => {
|
|
|
65
65
|
assert.equal(config.options.npm.publish, false);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
test('should replace (not concatenate) array options with user-provided arrays', async () => {
|
|
69
|
+
const config = new Config({ git: { pushArgs: ['--force'] }, npm: { publishArgs: ['--tag=next'] } });
|
|
70
|
+
await config.init();
|
|
71
|
+
assert.deepEqual(config.options.git.pushArgs, ['--force']);
|
|
72
|
+
assert.deepEqual(config.options.npm.publishArgs, ['--tag=next']);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('should allow empty array to clear default array option', async () => {
|
|
76
|
+
const config = new Config({ git: { pushArgs: [] } });
|
|
77
|
+
await config.init();
|
|
78
|
+
assert.deepEqual(config.options.git.pushArgs, []);
|
|
79
|
+
});
|
|
80
|
+
|
|
68
81
|
test('should read YAML config', async () => {
|
|
69
82
|
const config = new Config({ configDir: './test/stub/config/yaml' });
|
|
70
83
|
await config.init();
|