Skip to content

Commit 08ae7d5

Browse files
author
Eunjae Lee
authored
fix: extract changelog for lerna-changelog (#388)
* fix: extract changelog from lerna-changelog WIP * fix: test cases
1 parent 57dabde commit 08ae7d5

File tree

7 files changed

+468
-9
lines changed

7 files changed

+468
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
"all-contributors-cli": "6.9.3",
3131
"lerna": "3.18.3"
3232
}
33-
}
33+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# [0.8.0](https://github.com/algolia/shipjs/compare/v0.7.1...v0.8.0) (2019-10-25)
2+
3+
### Features
4+
5+
- **setup:** add `npx shipjs setup` ([#361](https://github.com/algolia/shipjs/issues/361)) ([df70f0a](https://github.com/algolia/shipjs/commit/df70f0a))
6+
7+
## [0.7.1](https://github.com/algolia/shipjs/compare/v0.7.0...v0.7.1) (2019-10-21)
8+
9+
### Bug Fixes
10+
11+
- skip creating a release at github when hub cli is not found ([#353](https://github.com/algolia/shipjs/issues/353)) ([c408a00](https://github.com/algolia/shipjs/commit/c408a00))
12+
13+
# [0.7.0](https://github.com/algolia/shipjs/compare/v0.6.0...v0.7.0) (2019-10-21)
14+
15+
### Bug Fixes
16+
17+
- accept an array for pullRequestReviewer ([#314](https://github.com/algolia/shipjs/issues/314)) ([c26a07f](https://github.com/algolia/shipjs/commit/c26a07f))
18+
- add option to run not to print command ([#321](https://github.com/algolia/shipjs/issues/321)) ([bc328e6](https://github.com/algolia/shipjs/commit/bc328e6))
19+
- do not print github token ([#322](https://github.com/algolia/shipjs/issues/322)) ([82527cf](https://github.com/algolia/shipjs/commit/82527cf))
20+
- fix exception on dry mode ([#313](https://github.com/algolia/shipjs/issues/313)) ([2c4a2e4](https://github.com/algolia/shipjs/commit/2c4a2e4))
21+
- get PR number correctly after preparation ([#340](https://github.com/algolia/shipjs/issues/340)) ([4ce3443](https://github.com/algolia/shipjs/commit/4ce3443))
22+
23+
### Features
24+
25+
- create GitHub releases ([#311](https://github.com/algolia/shipjs/issues/311)) ([f1e4e77](https://github.com/algolia/shipjs/commit/f1e4e77))
26+
- This is automatically done and uses the changelog as content of release.
27+
- upload assets to GitHub release ([#334](https://github.com/algolia/shipjs/issues/334)) ([fcf2807](https://github.com/algolia/shipjs/commit/fcf2807))
28+
- At `ship.config.js`, You can configure `releaeses.assetsToUpload`. More details in configuration will come soon.
29+
30+
### BREAKING CHANGES
31+
32+
It's a breaking change but haven't bumped the major version since it's still in beta.
33+
34+
Please bear with any inconvenience.
35+
36+
- replace `monorepo.readVersionFrom` with `monorepo.mainVersionFile` ([#350](https://github.com/algolia/shipjs/issues/350)) ([107255a](https://github.com/algolia/shipjs/commit/107255a)), ([#351](https://github.com/algolia/shipjs/issues/351)) ([98617b4](https://github.com/algolia/shipjs/commit/98617b4))
37+
- Now Ship.js updates the version at `monorepo.mainVersionFile`. With `monorepo.readVersionFrom`, it didn't update the file itself.
38+
39+
# [0.6.0](https://github.com/algolia/shipjs/compare/v0.5.5...v0.6.0) (2019-10-04)
40+
41+
### Bug Fixes
42+
43+
- don't display steps for slack when there's no slack config ([#294](https://github.com/algolia/shipjs/issues/294)) ([eb1ab44](https://github.com/algolia/shipjs/commit/eb1ab44))
44+
- fix pull request url in slack message ([#301](https://github.com/algolia/shipjs/issues/301)) ([f89ba1d](https://github.com/algolia/shipjs/commit/f89ba1d))
45+
46+
### Features
47+
48+
- add beforePublish and afterPublish hook ([#293](https://github.com/algolia/shipjs/issues/293)) ([0de5d68](https://github.com/algolia/shipjs/commit/0de5d68))
49+
50+
## [0.5.5](https://github.com/algolia/shipjs/compare/v0.5.4...v0.5.5) (2019-10-01)
51+
52+
### Bug Fixes
53+
54+
- exit with 0 when there's nothing to release ([#283](https://github.com/algolia/shipjs/issues/283)) ([3ef15fa](https://github.com/algolia/shipjs/commit/3ef15fa))
55+
56+
## [0.5.4](https://github.com/algolia/shipjs/compare/v0.5.3...v0.5.4) (2019-09-25)
57+
58+
## [0.5.3](https://github.com/algolia/shipjs/compare/v0.5.2...v0.5.3) (2019-09-24)
59+
60+
## [0.5.2](https://github.com/algolia/shipjs/compare/v0.5.1...v0.5.2) (2019-09-24)
61+
62+
### Bug Fixes
63+
64+
- change formatCommitMessage and introduce formatPullRequestTitle ([#270](https://github.com/algolia/shipjs/issues/270)) ([f21e167](https://github.com/algolia/shipjs/commit/f21e167))
65+
66+
# [0.5.0](https://github.com/algolia/shipjs/compare/v0.4.0...v0.5.0) (2019-09-08)
67+
68+
### Bug Fixes
69+
70+
- add monorepo config ([#246](https://github.com/algolia/shipjs/issues/246)) ([744cfc4](https://github.com/algolia/shipjs/commit/744cfc4))
71+
- fix a bug where it couldn't check correctly if hub is configured ([#241](https://github.com/algolia/shipjs/issues/241)) ([c228772](https://github.com/algolia/shipjs/commit/c228772))
72+
- git push with upstream specified ([#206](https://github.com/algolia/shipjs/issues/206)) ([ef5eccd](https://github.com/algolia/shipjs/commit/ef5eccd))
73+
- print error message when hub doesn't exist ([#205](https://github.com/algolia/shipjs/issues/205)) ([9ba45ff](https://github.com/algolia/shipjs/commit/9ba45ff))
74+
- push to git with GITHUB_TOKEN ([#234](https://github.com/algolia/shipjs/issues/234)) ([a39e7ee](https://github.com/algolia/shipjs/commit/a39e7ee))
75+
- rename release command to trigger ([#236](https://github.com/algolia/shipjs/issues/236)) ([3cbedb2](https://github.com/algolia/shipjs/commit/3cbedb2))
76+
- throw when hub is installed but not configured ([#208](https://github.com/algolia/shipjs/issues/208)) ([a4c769c](https://github.com/algolia/shipjs/commit/a4c769c))
77+
78+
### Features
79+
80+
- add monorepo support ([#232](https://github.com/algolia/shipjs/issues/232)) ([aa96ca9](https://github.com/algolia/shipjs/commit/aa96ca9))
81+
- add tag at NPM when it's prerelease like beta, rc, ... ([#212](https://github.com/algolia/shipjs/issues/212)) ([91ba961](https://github.com/algolia/shipjs/commit/91ba961))
82+
- rename packageJsons to filesToBump ([#209](https://github.com/algolia/shipjs/issues/209)) ([5753300](https://github.com/algolia/shipjs/commit/5753300))
83+
84+
# [0.4.0](https://github.com/algolia/shipjs/compare/v0.3.4...v0.4.0) (2019-08-20)
85+
86+
### Bug Fixes
87+
88+
- fix --no-browse option ([#195](https://github.com/algolia/shipjs/issues/195)) ([f923e52](https://github.com/algolia/shipjs/commit/f923e52))
89+
- skip notification when args not given ([#199](https://github.com/algolia/shipjs/issues/199)) ([b0be6bf](https://github.com/algolia/shipjs/commit/b0be6bf))
90+
91+
### Features
92+
93+
- accept slack incoming hook from ENV ([#200](https://github.com/algolia/shipjs/issues/200)) ([f941bd7](https://github.com/algolia/shipjs/commit/f941bd7))
94+
- add notification for prepare ([#198](https://github.com/algolia/shipjs/issues/198)) ([c0388cb](https://github.com/algolia/shipjs/commit/c0388cb))
95+
96+
## [0.3.4](https://github.com/algolia/shipjs/compare/v0.3.3...v0.3.4) (2019-08-20)
97+
98+
## [0.3.2](https://github.com/algolia/shipjs/compare/v0.3.1...v0.3.2) (2019-08-18)
99+
100+
### Bug Fixes
101+
102+
- add missing message on dry-mode ([#178](https://github.com/algolia/shipjs/issues/178)) ([3922854](https://github.com/algolia/shipjs/commit/3922854))
103+
- fix wrong command for git push ([#182](https://github.com/algolia/shipjs/issues/182)) ([d2b2e4a](https://github.com/algolia/shipjs/commit/d2b2e4a))
104+
105+
## [0.3.1](https://github.com/algolia/shipjs/compare/v0.3.0...v0.3.1) (2019-08-17)
106+
107+
### Bug Fixes
108+
109+
- ignore commits out of convention instead of throwing ([#176](https://github.com/algolia/shipjs/issues/176)) ([b6fc850](https://github.com/algolia/shipjs/commit/b6fc850))
110+
111+
# [0.3.0](https://github.com/algolia/shipjs/compare/v0.2.0...v0.3.0) (2019-08-17)
112+
113+
### Bug Fixes
114+
115+
- **deps:** update dependency inquirer to v6.5.1 ([#154](https://github.com/algolia/shipjs/issues/154)) ([040d722](https://github.com/algolia/shipjs/commit/040d722))
116+
117+
### Features
118+
119+
- add --no-browse option ([#151](https://github.com/algolia/shipjs/issues/151)) ([609a955](https://github.com/algolia/shipjs/commit/609a955))
120+
121+
# [0.2.0](https://github.com/algolia/shipjs/compare/v0.1.1...v0.2.0) (2019-08-07)
122+
123+
### Bug Fixes
124+
125+
- exit with non-zero if failed ([#138](https://github.com/algolia/shipjs/issues/138)) ([64e9626](https://github.com/algolia/shipjs/commit/64e9626))
126+
127+
### Features
128+
129+
- **reviewer:** add config to assign reviewer when creating PR ([#139](https://github.com/algolia/shipjs/issues/139)) ([4b7b74f](https://github.com/algolia/shipjs/commit/4b7b74f))
130+
131+
# 0.1.0 (2019-08-02)
132+
133+
### Initial Release
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import extractSpecificChangelog from '../extractSpecificChangelog';
2+
import fs from 'fs';
3+
import path from 'path';
4+
5+
const conventionalChangelogExample = fs
6+
.readFileSync(path.resolve(__dirname, 'conventional-changelog.md'))
7+
.toString();
8+
9+
const lernaChangelogExample = fs
10+
.readFileSync(path.resolve(__dirname, 'lerna-changelog.md'))
11+
.toString();
12+
13+
describe('extractSpecificChangelog', () => {
14+
describe('conventional-changelog', () => {
15+
it('works with #', () => {
16+
expect(extractSpecificChangelog(conventionalChangelogExample, '0.8.0'))
17+
.toMatchInlineSnapshot(`
18+
"# [0.8.0](https://github.com/algolia/shipjs/compare/v0.7.1...v0.8.0) (2019-10-25)
19+
20+
### Features
21+
22+
- **setup:** add \`npx shipjs setup\` ([#361](https://github.com/algolia/shipjs/issues/361)) ([df70f0a](https://github.com/algolia/shipjs/commit/df70f0a))
23+
24+
"
25+
`);
26+
});
27+
28+
it('works with ##', () => {
29+
expect(extractSpecificChangelog(conventionalChangelogExample, '0.5.5'))
30+
.toMatchInlineSnapshot(`
31+
"## [0.5.5](https://github.com/algolia/shipjs/compare/v0.5.4...v0.5.5) (2019-10-01)
32+
33+
### Bug Fixes
34+
35+
- exit with 0 when there's nothing to release ([#283](https://github.com/algolia/shipjs/issues/283)) ([3ef15fa](https://github.com/algolia/shipjs/commit/3ef15fa))
36+
37+
"
38+
`);
39+
});
40+
41+
it('works with empty result', () => {
42+
expect(extractSpecificChangelog(conventionalChangelogExample, '0.5.3'))
43+
.toMatchInlineSnapshot(`
44+
"## [0.5.3](https://github.com/algolia/shipjs/compare/v0.5.2...v0.5.3) (2019-09-24)
45+
46+
"
47+
`);
48+
});
49+
});
50+
51+
describe('lerna-changelog', () => {
52+
it('works', () => {
53+
expect(extractSpecificChangelog(lernaChangelogExample, '0.8.2'))
54+
.toMatchInlineSnapshot(`
55+
"## v0.8.2 (2018-10-14)
56+
57+
#### :bug: Bug Fix
58+
59+
- [#125](https://github.com/lerna/lerna-changelog/pull/125) Fix \`nextVersion\` config handling ([@Turbo87](https://github.com/Turbo87))
60+
61+
#### :house: Internal
62+
63+
- [#124](https://github.com/lerna/lerna-changelog/pull/124) yarn: Add \`integrity\` hashes ([@Turbo87](https://github.com/Turbo87))
64+
65+
#### Committers: 1
66+
67+
- Tobias Bieniek ([@Turbo87](https://github.com/Turbo87))
68+
69+
"
70+
`);
71+
});
72+
});
73+
});

0 commit comments

Comments
 (0)