node-publisher 3.1.0 → 3.2.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/.eslintrc.json +2 -4
- package/.nvmrc +1 -1
- package/CHANGELOG.md +27 -15
- package/package.json +9 -9
- package/src/client/yarn.js +23 -1
- package/src/client/yarn.spec.js +90 -16
- package/src/setup/release-branch/index.js +3 -5
- package/src/utils/index.js +12 -12
package/.eslintrc.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"env": {
|
|
3
3
|
"browser": false,
|
|
4
4
|
"es6": true,
|
|
5
|
-
"jest
|
|
5
|
+
"jest": true,
|
|
6
6
|
"node": true
|
|
7
7
|
},
|
|
8
8
|
"extends": ["standard", "prettier", "prettier/standard"],
|
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
"SharedArrayBuffer": "readonly"
|
|
12
12
|
},
|
|
13
13
|
"parser": "babel-eslint",
|
|
14
|
-
"plugins": [
|
|
15
|
-
"jest"
|
|
16
|
-
],
|
|
14
|
+
"plugins": ["jest"],
|
|
17
15
|
"rules": {
|
|
18
16
|
"react/no-unused-prop-types": "off",
|
|
19
17
|
"react/prop-types": "off",
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v22.16.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
### v3.1.0 (2024-01-24)
|
|
2
|
+
|
|
3
|
+
#### Pull requests
|
|
4
|
+
|
|
5
|
+
- [#55](https://github.com/zendesk/node-publisher/pull/55) Upgrade offline-github-changelog to fix duplicate authors ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
6
|
+
- [#54](https://github.com/zendesk/node-publisher/pull/54) Make local installs work with yarn v4 ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
7
|
+
|
|
8
|
+
#### Commits to master
|
|
9
|
+
|
|
10
|
+
- [v3.1.0](https://github.com/zendesk/node-publisher/commit/5a1605e05a331211d8533533aba481aa724263ab) ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
11
|
+
- [Update changelog](https://github.com/zendesk/node-publisher/commit/f06d6612e0a3fc350ba06b9925c42852e92c32c8) ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
12
|
+
|
|
1
13
|
### v3.0.0 (2022-12-06)
|
|
2
14
|
|
|
3
15
|
#### Pull requests
|
|
4
16
|
|
|
5
|
-
- [#47](https://github.com/zendesk/node-publisher/pull/47) Upgrade offline-github-changelog \(Major\) ([Sune Simonsen](mailto:sune@we-knowhow.dk)
|
|
17
|
+
- [#47](https://github.com/zendesk/node-publisher/pull/47) Upgrade offline-github-changelog \(Major\) ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
6
18
|
- [#46](https://github.com/zendesk/node-publisher/pull/46) Upgrade offline-github-changelog ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
7
19
|
|
|
8
20
|
#### Commits to master
|
|
@@ -33,7 +45,7 @@
|
|
|
33
45
|
|
|
34
46
|
#### Pull requests
|
|
35
47
|
|
|
36
|
-
- [#45](https://github.com/zendesk/node-publisher/pull/45) Upgrade offline-github-changelog to the latest version \(Major\) ([Sune Simonsen](mailto:sune@we-knowhow.dk)
|
|
48
|
+
- [#45](https://github.com/zendesk/node-publisher/pull/45) Upgrade offline-github-changelog to the latest version \(Major\) ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
37
49
|
|
|
38
50
|
#### Commits to master
|
|
39
51
|
|
|
@@ -45,7 +57,7 @@
|
|
|
45
57
|
#### Pull requests
|
|
46
58
|
|
|
47
59
|
- [#44](https://github.com/zendesk/node-publisher/pull/44) Upgrade offline-github-changelog to the latest version ([Sune Simonsen](mailto:sune@we-knowhow.dk))
|
|
48
|
-
- [#42](https://github.com/zendesk/node-publisher/pull/42) Add GitHub Actions workflows to migrate away from Travis-CI ([Attila Večerek](mailto:avecerek@zendesk.com), [
|
|
60
|
+
- [#42](https://github.com/zendesk/node-publisher/pull/42) Add GitHub Actions workflows to migrate away from Travis-CI ([Attila Večerek](mailto:avecerek@zendesk.com), [John Shen](mailto:john@everops.com))
|
|
49
61
|
- [#43](https://github.com/zendesk/node-publisher/pull/43) Use node version from .nvmrc in GHA workflow ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
50
62
|
|
|
51
63
|
#### Commits to master
|
|
@@ -58,7 +70,7 @@
|
|
|
58
70
|
#### Pull requests
|
|
59
71
|
|
|
60
72
|
- [#41](https://github.com/zendesk/node-publisher/pull/41) Fix reading the contents of .nvmrc ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
61
|
-
- [#40](https://github.com/zendesk/node-publisher/pull/40) Remove dependency on NVM ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
73
|
+
- [#40](https://github.com/zendesk/node-publisher/pull/40) Remove dependency on NVM ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
62
74
|
|
|
63
75
|
#### Commits to master
|
|
64
76
|
|
|
@@ -71,11 +83,11 @@
|
|
|
71
83
|
|
|
72
84
|
- [#37](https://github.com/zendesk/node-publisher/pull/37) Update jest ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
73
85
|
- [#36](https://github.com/zendesk/node-publisher/pull/36) Update lint-staged ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
74
|
-
- [#33](https://github.com/zendesk/node-publisher/pull/33) Update dependencies ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
86
|
+
- [#33](https://github.com/zendesk/node-publisher/pull/33) Update dependencies ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
75
87
|
- [#35](https://github.com/zendesk/node-publisher/pull/35) Fix the generated config for custom release branches ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
76
88
|
- [#34](https://github.com/zendesk/node-publisher/pull/34) Order branches during the release branch selection setup process ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
77
|
-
- [#32](https://github.com/zendesk/node-publisher/pull/32) Implement a setup script, take 2 ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
78
|
-
- [#31](https://github.com/zendesk/node-publisher/pull/31) Address security alerts ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
89
|
+
- [#32](https://github.com/zendesk/node-publisher/pull/32) Implement a setup script, take 2 ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
90
|
+
- [#31](https://github.com/zendesk/node-publisher/pull/31) Address security alerts ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
79
91
|
|
|
80
92
|
#### Commits to master
|
|
81
93
|
|
|
@@ -87,7 +99,7 @@
|
|
|
87
99
|
#### Pull requests
|
|
88
100
|
|
|
89
101
|
- [#30](https://github.com/zendesk/node-publisher/pull/30) Fix the build step not committing the changes ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
90
|
-
- [#28](https://github.com/zendesk/node-publisher/pull/28) Add --branch release param ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
102
|
+
- [#28](https://github.com/zendesk/node-publisher/pull/28) Add --branch release param ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
91
103
|
|
|
92
104
|
#### Commits to master
|
|
93
105
|
|
|
@@ -98,7 +110,7 @@
|
|
|
98
110
|
|
|
99
111
|
#### Pull requests
|
|
100
112
|
|
|
101
|
-
- [#26](https://github.com/zendesk/node-publisher/pull/26) Support multiple release configurations ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
113
|
+
- [#26](https://github.com/zendesk/node-publisher/pull/26) Support multiple release configurations ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
102
114
|
|
|
103
115
|
#### Commits to master
|
|
104
116
|
|
|
@@ -109,7 +121,7 @@
|
|
|
109
121
|
|
|
110
122
|
#### Pull requests
|
|
111
123
|
|
|
112
|
-
- [#27](https://github.com/zendesk/node-publisher/pull/27) Remove version constraints and add prerelease option ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
124
|
+
- [#27](https://github.com/zendesk/node-publisher/pull/27) Remove version constraints and add prerelease option ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
113
125
|
|
|
114
126
|
#### Commits to master
|
|
115
127
|
|
|
@@ -120,7 +132,7 @@
|
|
|
120
132
|
|
|
121
133
|
#### Pull requests
|
|
122
134
|
|
|
123
|
-
- [#24](https://github.com/zendesk/node-publisher/pull/24) Add details to package.json + minor adjustments ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
135
|
+
- [#24](https://github.com/zendesk/node-publisher/pull/24) Add details to package.json + minor adjustments ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
124
136
|
- [#23](https://github.com/zendesk/node-publisher/pull/23) Fix small typo in readme ([Marc Høegh](mailto:Anifacted@users.noreply.github.com))
|
|
125
137
|
|
|
126
138
|
#### Commits to master
|
|
@@ -134,8 +146,8 @@
|
|
|
134
146
|
|
|
135
147
|
- [#22](https://github.com/zendesk/node-publisher/pull/22) Add publish config to be able to release with yarn again ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
136
148
|
- [#21](https://github.com/zendesk/node-publisher/pull/21) Rename package and adds licenses field to package.json ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
137
|
-
- [#20](https://github.com/zendesk/node-publisher/pull/20) Remove private repo configuration ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
138
|
-
- [#18](https://github.com/zendesk/node-publisher/pull/18) Update README ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
149
|
+
- [#20](https://github.com/zendesk/node-publisher/pull/20) Remove private repo configuration ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
150
|
+
- [#18](https://github.com/zendesk/node-publisher/pull/18) Update README ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
139
151
|
|
|
140
152
|
#### Commits to master
|
|
141
153
|
|
|
@@ -180,7 +192,7 @@
|
|
|
180
192
|
|
|
181
193
|
#### Pull requests
|
|
182
194
|
|
|
183
|
-
- [#14](https://github.com/zendesk/node-publisher/pull/14) Add test runner whitelist ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
195
|
+
- [#14](https://github.com/zendesk/node-publisher/pull/14) Add test runner whitelist ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
184
196
|
|
|
185
197
|
#### Commits to master
|
|
186
198
|
|
|
@@ -273,7 +285,7 @@
|
|
|
273
285
|
|
|
274
286
|
#### Pull requests
|
|
275
287
|
|
|
276
|
-
- [#2](https://github.com/zendesk/node-publisher/pull/2) Fix rollback and own release ([Attila Večerek](mailto:avecerek@zendesk.com)
|
|
288
|
+
- [#2](https://github.com/zendesk/node-publisher/pull/2) Fix rollback and own release ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
277
289
|
- [#1](https://github.com/zendesk/node-publisher/pull/1) Initial PR ([Attila Večerek](mailto:avecerek@zendesk.com))
|
|
278
290
|
|
|
279
291
|
#### Commits to master
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-publisher",
|
|
3
|
+
"version": "3.2.0",
|
|
3
4
|
"description": "A configurable release automation tool inspired by create-react-app and Travis CI.",
|
|
4
5
|
"author": "Attila Večerek <avecerek@zendesk.com>",
|
|
5
6
|
"homepage": "https://github.com/zendesk/node-publisher#readme",
|
|
@@ -10,12 +11,11 @@
|
|
|
10
11
|
"bugs": {
|
|
11
12
|
"url": "https://github.com/zendesk/node-publisher/issues"
|
|
12
13
|
},
|
|
13
|
-
"version": "3.1.0",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"bin": "./bin/node-publisher",
|
|
16
16
|
"scripts": {
|
|
17
17
|
"coverage": "jest --coverage",
|
|
18
|
-
"lint": "eslint
|
|
18
|
+
"lint": "eslint src/**/*.js bin/**",
|
|
19
19
|
"lint-staged": "lint-staged",
|
|
20
20
|
"release": "./bin/node-publisher release",
|
|
21
21
|
"test": "jest",
|
|
@@ -26,24 +26,24 @@
|
|
|
26
26
|
"commander": "2.15.1",
|
|
27
27
|
"inquirer": "6.5.0",
|
|
28
28
|
"js-yaml": "3.13.1",
|
|
29
|
-
"offline-github-changelog": "3.0
|
|
30
|
-
"semver": "
|
|
29
|
+
"offline-github-changelog": "3.1.0",
|
|
30
|
+
"semver": "7.7.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"babel-eslint": "10.0
|
|
33
|
+
"babel-eslint": "10.1.0",
|
|
34
34
|
"eslint": "^6.0.0",
|
|
35
35
|
"eslint-config-prettier": "^6.0.0",
|
|
36
36
|
"eslint-config-standard": "^14.0.0",
|
|
37
37
|
"eslint-plugin-import": "^2.18.0",
|
|
38
|
-
"eslint-plugin-jest": "^
|
|
38
|
+
"eslint-plugin-jest": "^23.20.0",
|
|
39
39
|
"eslint-plugin-node": "^9.1.0",
|
|
40
40
|
"eslint-plugin-promise": "^4.2.0",
|
|
41
41
|
"eslint-plugin-standard": "^4.0.0",
|
|
42
|
-
"jest": "
|
|
42
|
+
"jest": "^27.0.0",
|
|
43
43
|
"lint-staged": "^9.0.0",
|
|
44
44
|
"pre-commit": "1.2.2",
|
|
45
45
|
"prettier": "1.18.2",
|
|
46
|
-
"prettier-package-json": "2.0
|
|
46
|
+
"prettier-package-json": "2.8.0"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"lerna",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"yarn"
|
|
53
53
|
],
|
|
54
54
|
"engines": {
|
|
55
|
-
"node": ">=
|
|
55
|
+
"node": ">=20"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public",
|
package/src/client/yarn.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
|
|
3
|
+
const getYarnVersion = () => {
|
|
4
|
+
try {
|
|
5
|
+
const output = execSync('yarn --version', { encoding: 'utf8' });
|
|
6
|
+
return output.trim();
|
|
7
|
+
} catch (error) {
|
|
8
|
+
// Default to yarn v1 if version detection fails
|
|
9
|
+
return '1.0.0';
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const isYarnV2OrHigher = () => {
|
|
14
|
+
const version = getYarnVersion();
|
|
15
|
+
const majorVersion = parseInt(version.split('.')[0], 10);
|
|
16
|
+
return majorVersion >= 2;
|
|
17
|
+
};
|
|
18
|
+
|
|
1
19
|
const publish = ({ nextVersion, execCommand }) => {
|
|
2
|
-
|
|
20
|
+
if (isYarnV2OrHigher()) {
|
|
21
|
+
execCommand(`yarn npm publish --tag ${nextVersion}`);
|
|
22
|
+
} else {
|
|
23
|
+
execCommand(`yarn publish --new-version ${nextVersion}`);
|
|
24
|
+
}
|
|
3
25
|
};
|
|
4
26
|
|
|
5
27
|
module.exports = {
|
package/src/client/yarn.spec.js
CHANGED
|
@@ -1,32 +1,106 @@
|
|
|
1
1
|
const { publish } = require('./yarn');
|
|
2
2
|
|
|
3
|
+
// Mock execSync to control yarn version detection
|
|
4
|
+
jest.mock('child_process', () => ({
|
|
5
|
+
execSync: jest.fn()
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
|
|
3
10
|
describe('publish', () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
preid: undefined,
|
|
8
|
-
execCommand: jest.fn()
|
|
9
|
-
};
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
});
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
describe('with yarn v1', () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
execSync.mockReturnValue('1.22.10');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe('without preid', () => {
|
|
21
|
+
const options = {
|
|
22
|
+
nextVersion: 'patch',
|
|
23
|
+
preid: undefined,
|
|
24
|
+
execCommand: jest.fn()
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
it('publishes new version using yarn v1 syntax', () => {
|
|
28
|
+
expect(() => publish(options)).not.toThrow();
|
|
29
|
+
expect(options.execCommand.mock.calls[0][0]).toBe(
|
|
30
|
+
'yarn publish --new-version patch'
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('with preid', () => {
|
|
36
|
+
const options = {
|
|
37
|
+
nextVersion: 'major',
|
|
38
|
+
preid: 'alpha',
|
|
39
|
+
execCommand: jest.fn()
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
it('publishes new version using yarn v1 syntax', () => {
|
|
43
|
+
expect(() => publish(options)).not.toThrow();
|
|
44
|
+
expect(options.execCommand.mock.calls[0][0]).toBe(
|
|
45
|
+
'yarn publish --new-version major'
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('with yarn v2+', () => {
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
execSync.mockReturnValue('4.1.0');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('without preid', () => {
|
|
57
|
+
const options = {
|
|
58
|
+
nextVersion: 'patch',
|
|
59
|
+
preid: undefined,
|
|
60
|
+
execCommand: jest.fn()
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
it('publishes new version using yarn v2+ syntax', () => {
|
|
64
|
+
expect(() => publish(options)).not.toThrow();
|
|
65
|
+
expect(options.execCommand.mock.calls[0][0]).toBe(
|
|
66
|
+
'yarn npm publish --tag patch'
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('with preid', () => {
|
|
72
|
+
const options = {
|
|
73
|
+
nextVersion: 'major',
|
|
74
|
+
preid: 'alpha',
|
|
75
|
+
execCommand: jest.fn()
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
it('publishes new version using yarn v2+ syntax', () => {
|
|
79
|
+
expect(() => publish(options)).not.toThrow();
|
|
80
|
+
expect(options.execCommand.mock.calls[0][0]).toBe(
|
|
81
|
+
'yarn npm publish --tag major'
|
|
82
|
+
);
|
|
83
|
+
});
|
|
16
84
|
});
|
|
17
85
|
});
|
|
18
86
|
|
|
19
|
-
describe('
|
|
87
|
+
describe('when yarn version detection fails', () => {
|
|
88
|
+
beforeEach(() => {
|
|
89
|
+
execSync.mockImplementation(() => {
|
|
90
|
+
throw new Error('Command failed');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
20
94
|
const options = {
|
|
21
|
-
nextVersion: '
|
|
22
|
-
preid:
|
|
95
|
+
nextVersion: 'patch',
|
|
96
|
+
preid: undefined,
|
|
23
97
|
execCommand: jest.fn()
|
|
24
98
|
};
|
|
25
99
|
|
|
26
|
-
it('
|
|
100
|
+
it('defaults to yarn v1 syntax', () => {
|
|
27
101
|
expect(() => publish(options)).not.toThrow();
|
|
28
102
|
expect(options.execCommand.mock.calls[0][0]).toBe(
|
|
29
|
-
'yarn publish --new-version
|
|
103
|
+
'yarn publish --new-version patch'
|
|
30
104
|
);
|
|
31
105
|
});
|
|
32
106
|
});
|
|
@@ -25,10 +25,8 @@ const gitBranches = () => {
|
|
|
25
25
|
const prioritizeDefaultBranch = branches => {
|
|
26
26
|
const index = branches.indexOf(DEFAULT_BRANCH);
|
|
27
27
|
|
|
28
|
-
return index === -1
|
|
29
|
-
|
|
30
|
-
: branches.splice(index, 1).concat(branches);
|
|
31
|
-
}
|
|
28
|
+
return index === -1 ? branches : branches.splice(index, 1).concat(branches);
|
|
29
|
+
};
|
|
32
30
|
|
|
33
31
|
const question = () => ({
|
|
34
32
|
type: 'list',
|
|
@@ -49,7 +47,7 @@ async function releaseBranchStep() {
|
|
|
49
47
|
const releaseCommand =
|
|
50
48
|
releaseBranch === 'master'
|
|
51
49
|
? 'node-publisher release'
|
|
52
|
-
: `node-publisher release --
|
|
50
|
+
: `node-publisher release --branch=${releaseBranch}`;
|
|
53
51
|
|
|
54
52
|
addScript('release', releaseCommand);
|
|
55
53
|
}
|
package/src/utils/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const path = require(
|
|
2
|
-
const fs = require(
|
|
3
|
-
const command = require(
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const command = require("./command");
|
|
4
4
|
const {
|
|
5
5
|
DEFAULT_CONFIG_PATH,
|
|
6
6
|
DEFAULT_BRANCH,
|
|
7
7
|
VALID_TEST_RUNNERS,
|
|
8
8
|
DEFAULT_TEST_RUNNER
|
|
9
|
-
} = require(
|
|
10
|
-
const { npmClient, publishClient } = require(
|
|
11
|
-
const { readReleaseConfig, buildReleaseConfig } = require(
|
|
12
|
-
const { packageJson } = require(
|
|
9
|
+
} = require("./constants");
|
|
10
|
+
const { npmClient, publishClient } = require("./client");
|
|
11
|
+
const { readReleaseConfig, buildReleaseConfig } = require("./config");
|
|
12
|
+
const { packageJson } = require("./package");
|
|
13
13
|
const {
|
|
14
14
|
validateNodeVersion,
|
|
15
15
|
validatePkgRoot,
|
|
16
16
|
validateTestRunner,
|
|
17
17
|
validateLerna,
|
|
18
18
|
hasBuildScript
|
|
19
|
-
} = require(
|
|
19
|
+
} = require("./validations");
|
|
20
20
|
|
|
21
21
|
const buildReleaseEnvironment = ({
|
|
22
22
|
branch = DEFAULT_BRANCH,
|
|
@@ -40,7 +40,7 @@ const buildReleaseEnvironment = ({
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const client = publishClient();
|
|
43
|
-
if (client ===
|
|
43
|
+
if (client === "lerna") {
|
|
44
44
|
validateLerna();
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -60,7 +60,7 @@ const loadReleaseConfig = env => {
|
|
|
60
60
|
: path.resolve(process.env.PWD, env.configPath);
|
|
61
61
|
|
|
62
62
|
if (fs.existsSync(configPath)) {
|
|
63
|
-
return readReleaseConfig(fs.readFileSync(configPath,
|
|
63
|
+
return readReleaseConfig(fs.readFileSync(configPath, "utf8"));
|
|
64
64
|
} else if (env.configPath !== DEFAULT_CONFIG_PATH) {
|
|
65
65
|
throw new Error(
|
|
66
66
|
`The configuration file \`${env.configPath}\` does not exist.`
|
|
@@ -82,14 +82,14 @@ const execCommands = configCommands => {
|
|
|
82
82
|
|
|
83
83
|
const currentCommitId = () =>
|
|
84
84
|
command
|
|
85
|
-
.exec(
|
|
85
|
+
.exec("git rev-parse HEAD", {})
|
|
86
86
|
.toString()
|
|
87
87
|
.trim();
|
|
88
88
|
|
|
89
89
|
const rollbackCommit = commitId => command.exec(`git reset --hard ${commitId}`);
|
|
90
90
|
|
|
91
91
|
const versionTransformer = (version, _answers, flags) =>
|
|
92
|
-
flags.isFinal && version[0] !==
|
|
92
|
+
flags.isFinal && version[0] !== "v" ? `v${version}` : version;
|
|
93
93
|
|
|
94
94
|
module.exports = {
|
|
95
95
|
buildReleaseEnvironment,
|