This repository has been archived by the owner on May 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from inyono/v0.4.0
- Loading branch information
Showing
196 changed files
with
927 additions
and
1,190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+8.6 KB
.yarn/cache/@babel-helper-compilation-targets-npm-7.16.7-8031641957-7238aaee78.zip
Binary file not shown.
Binary file added
BIN
+2.88 KB
.yarn/cache/@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip
Binary file not shown.
Binary file added
BIN
+3.79 KB
.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-fc77cbe7b1.zip
Binary file not shown.
Binary file added
BIN
+2.66 KB
.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip
Binary file not shown.
Binary file added
BIN
+2.98 KB
.yarn/cache/@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip
Binary file not shown.
Binary file added
BIN
+6.12 KB
.yarn/cache/@babel-helper-module-imports-npm-7.16.7-19c74fd92b-ddd2c4a600.zip
Binary file not shown.
Binary file added
BIN
+12.1 KB
.yarn/cache/@babel-helper-module-transforms-npm-7.16.7-4b3d4b8254-6e930ce776.zip
Binary file not shown.
Binary file added
BIN
+3.23 KB
.yarn/cache/@babel-helper-simple-access-npm-7.16.7-c4dfb1f5e7-8d22c46c5e.zip
Binary file not shown.
Binary file added
BIN
+3.15 KB
.yarn/cache/@babel-helper-split-export-declaration-npm-7.16.7-5b9ae90171-e10aaf1354.zip
Binary file not shown.
Binary file added
BIN
+9.07 KB
.yarn/cache/@babel-helper-validator-identifier-npm-7.16.7-8599fb00fc-dbb3db9d18.zip
Binary file not shown.
Binary file added
BIN
+3.82 KB
.yarn/cache/@babel-helper-validator-option-npm-7.16.7-d13e9c1d9e-c5ccc45191.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-13.5 KB
.yarn/cache/@cspotcode-source-map-support-npm-0.6.1-2e72b80534-da9fb4f640.zip
Binary file not shown.
Binary file added
BIN
+16 KB
.yarn/cache/@cspotcode-source-map-support-npm-0.7.0-456c3ea2ce-9faddda775.zip
Binary file not shown.
Binary file renamed
BIN
+9.93 KB
...sole-npm-27.1.0-b0ae895096-e1c7b202d9.zip → ...sole-npm-27.4.6-1ac1542ebc-603408498d.zip
Binary file not shown.
Binary file renamed
BIN
+79.2 KB
...core-npm-27.1.0-7b4405399b-3c047bb183.zip → ...core-npm-27.4.7-f33c1a8486-24ed123ef1.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+9.16 KB
...mers-npm-27.1.0-533e801288-004bd09e7f.zip → ...mers-npm-27.4.6-24482044ef-389f655d39.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+38 KB
...ters-npm-27.1.0-a7e9637b3c-28c3e52b12.zip → ...ters-npm-27.4.6-04be6241c9-4c14b2cf6c.zip
Binary file not shown.
Binary file renamed
BIN
+4.58 KB
...-map-npm-27.0.6-0535fb89a0-b4c09a0392.zip → ...-map-npm-27.4.0-b3ca77811c-cf87ac3dd1.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+5.25 KB
...ncer-npm-27.1.0-d1e4fbafc5-89d56436d0.zip → ...ncer-npm-27.4.6-d715e9b8d0-8d761fd81f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-23.2 KB
.yarn/cache/@sinonjs-fake-timers-npm-7.1.2-2a6b119ac7-c84773d797.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-5.45 KB
.yarn/cache/@szmarczak-http-timer-npm-4.0.6-6ace00d82d-c29df3bcec.zip
Binary file not shown.
Binary file removed
BIN
-3.88 KB
.yarn/cache/@types-cacheable-request-npm-6.0.2-894b6992d5-667d25808d.zip
Binary file not shown.
Binary file removed
BIN
-4.68 KB
.yarn/cache/@types-http-cache-semantics-npm-4.0.1-90863c7a3e-1048aacf62.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+5.95 KB
...jest-npm-27.1.0-0c33777ddf-93915872d9.zip → ...jest-npm-27.4.6-73245addbc-fc839d5e87.zip
Binary file not shown.
Binary file added
BIN
+9.25 KB
.yarn/cache/babel-plugin-istanbul-npm-6.1.1-df824055e4-cb4fd95738.zip
Binary file not shown.
Binary file renamed
BIN
+6.14 KB
...oist-npm-27.0.6-b65506802c-0aa0798a56.zip → ...oist-npm-27.4.0-11378f7245-48f216f286.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-1.63 KB
.yarn/cache/buffer-alloc-unsafe-npm-1.1.0-b5d7ccb44c-c5e18bf51f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-3.46 KB
.yarn/cache/decompress-response-npm-5.0.0-ea4ba8db9c-b46fe6c275.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+23.7 KB
.yarn/cache/electron-to-chromium-npm-1.4.38-fccaeb9031-09e63e4f44.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+11.3 KB
.yarn/cache/istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-a2a545033b.zip
Binary file not shown.
Binary file added
BIN
+18.5 KB
.yarn/cache/istanbul-lib-instrument-npm-5.1.0-f92463b9f0-8b82e733c6.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+8.15 KB
...iles-npm-27.1.0-095f9a5d71-edd6c5cd33.zip → ...iles-npm-27.4.2-5ff52f65a3-4df8dff398.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+4.75 KB
...lock-npm-27.0.6-face832e4f-6d68b9f2be.zip → ...lock-npm-27.4.0-bfb03db47d-4b7639ceb7.zip
Binary file not shown.
Binary file renamed
BIN
+14 KB
...each-npm-27.1.0-fa7dd5a032-54be43982b.zip → ...each-npm-27.4.6-60ddb7c4cc-cce85a14a4.zip
Binary file not shown.
Binary file removed
BIN
-4.08 KB
.yarn/cache/jest-environment-jsdom-npm-27.1.0-2b7d333e92-346888d8a4.zip
Binary file not shown.
Binary file added
BIN
+4.19 KB
.yarn/cache/jest-environment-jsdom-npm-27.4.6-c7886e0a7b-bdf5f349a3.zip
Binary file not shown.
Binary file removed
BIN
-3.61 KB
.yarn/cache/jest-environment-node-npm-27.1.0-dc9c005ad8-f309476d10.zip
Binary file not shown.
Binary file added
BIN
+3.67 KB
.yarn/cache/jest-environment-node-npm-27.4.6-596a121c86-3f146e7819.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+54.7 KB
...ine2-npm-27.1.0-44425ab6de-98ec5fe689.zip → ...ine2-npm-27.4.6-5cf90aaa3a-d9b0540570.zip
Binary file not shown.
Binary file renamed
BIN
+3.84 KB
...ctor-npm-27.1.0-be09fbc697-9401fef19e.zip → ...ctor-npm-27.4.6-647a404fa3-4259400403.zip
Binary file not shown.
Binary file removed
BIN
-10.5 KB
.yarn/cache/jest-matcher-utils-npm-27.1.0-13535251fb-bbaeb10ef2.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+3.49 KB
...jest-npm-27.1.0-13979fdf01-e9cc602bb8.zip → ...jest-npm-27.4.7-cdda9da561-28ce948b30.zip
Binary file not shown.
Binary file renamed
BIN
+2.69 KB
...util-npm-27.0.6-02fca95995-4d613b00f2.zip → ...util-npm-27.4.0-fc7fcc1558-222e4aacec.zip
Binary file not shown.
Binary file renamed
BIN
+4.24 KB
...cies-npm-27.1.0-9e7f367d27-99abfd167f.zip → ...cies-npm-27.4.6-7ae0396f74-c644adb74a.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+4.5 KB
...izer-npm-27.0.6-c9c9a90be0-b0b8d97cb1.zip → ...izer-npm-27.4.0-1305d8e2a7-1ed5f38e88.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+17.5 KB
...date-npm-27.1.0-b9b193afa4-c6ef47abcf.zip → ...date-npm-27.4.6-c31c8a6014-d3578030ea.zip
Binary file not shown.
Binary file renamed
BIN
+15.3 KB
...cher-npm-27.1.0-2caacbd187-3dc1397a40.zip → ...cher-npm-27.4.6-24920c4ac7-bb9c0a34dc.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-32.5 KB
.yarn/cache/npm-normalize-package-bin-npm-1.0.1-2cf38a5d95-ae7f15155a.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-2.25 KB
.yarn/cache/prettier-plugin-packagejson-npm-2.2.11-a601895cfd-e30cdd34c5.zip
Binary file not shown.
Binary file added
BIN
+3.21 KB
.yarn/cache/prettier-plugin-packagejson-npm-2.2.15-203c937e75-2cd79e9fba.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { Changelog, generateChangelog } from '../src/generate-changelog' | ||
import { matchRemoteUrl } from '../src' | ||
import { Changelog } from '../src/generate-changelog' | ||
import { generateChangelog as generate } from '../src' | ||
|
||
const firstCommit = 'bc6106e006b1633f5e6c15f6af2eef0443d8e81f' | ||
|
||
|
@@ -10,11 +10,11 @@ describe('generate changelog', () => { | |
'', | ||
'All notable changes to this project will be documented in this file.', | ||
]) | ||
expect(generateChangelog(createChangelog([]))).toEqual(expected) | ||
expect(generateChangelog([])).toEqual(expected) | ||
}) | ||
|
||
test('unreleased changes w/ sections', () => { | ||
const changelog = createChangelog([ | ||
const changelog = generateChangelog([ | ||
{ | ||
description: 'You can read more about this release at our blog.', | ||
breakingChanges: [ | ||
|
@@ -68,11 +68,11 @@ describe('generate changelog', () => { | |
'', | ||
'- Generate changelog with @splish-me/changelog', | ||
]) | ||
expect(generateChangelog(changelog)).toEqual(expected) | ||
expect(changelog).toEqual(expected) | ||
}) | ||
|
||
test('scoped unreleased changes w/ sections', () => { | ||
const changelog = createChangelog<'main' | 'foo'>([ | ||
const changelog = generateChangelog<'main' | 'foo'>([ | ||
{ | ||
breakingChanges: [ | ||
['main', 'Drop support for Internet Explorer 9'], | ||
|
@@ -96,11 +96,11 @@ describe('generate changelog', () => { | |
'', | ||
'- **main**. Another main', | ||
]) | ||
expect(generateChangelog(changelog)).toEqual(expected) | ||
expect(changelog).toEqual(expected) | ||
}) | ||
|
||
test('released changes', () => { | ||
const changelog = createChangelog([ | ||
const changelog = generateChangelog([ | ||
{ | ||
name: 'Initial release', | ||
tagName: '0.0.0', | ||
|
@@ -124,50 +124,21 @@ describe('generate changelog', () => { | |
'', | ||
`## [Initial release](https://github.com/foo/bar/compare/${firstCommit}..0.0.0) - January 1, 2019 \\[YANKED]`, | ||
]) | ||
expect(generateChangelog(changelog)).toEqual(expected) | ||
expect(changelog).toEqual(expected) | ||
}) | ||
}) | ||
|
||
describe('match remote url', () => { | ||
test('SSH', () => { | ||
expect(matchRemoteUrl('[email protected]:splish/changelog.git')).toEqual({ | ||
owner: 'splish', | ||
repo: 'changelog', | ||
}) | ||
}) | ||
|
||
test('SSH (without git)', () => { | ||
expect(matchRemoteUrl('[email protected]:splish/changelog')).toEqual({ | ||
owner: 'splish', | ||
repo: 'changelog', | ||
}) | ||
}) | ||
|
||
test('HTTPS', () => { | ||
expect(matchRemoteUrl('https://github.com/splish/changelog.git')).toEqual({ | ||
owner: 'splish', | ||
repo: 'changelog', | ||
}) | ||
}) | ||
|
||
test('HTTP (without git)', () => { | ||
expect(matchRemoteUrl('https://github.com/splish/changelog')).toEqual({ | ||
owner: 'splish', | ||
repo: 'changelog', | ||
}) | ||
}) | ||
}) | ||
function createChangelog<Scope = undefined>( | ||
function generateChangelog<Scope = undefined>( | ||
releases: Changelog<Scope>['releases'] | ||
): Changelog<Scope> { | ||
return { | ||
) { | ||
return generate({ | ||
repository: { | ||
firstCommit: 'bc6106e006b1633f5e6c15f6af2eef0443d8e81f', | ||
owner: 'foo', | ||
repo: 'bar', | ||
}, | ||
releases, | ||
} | ||
}) | ||
} | ||
|
||
function join(lines: string[]): string { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,3 @@ | ||
import git from 'nodegit' | ||
import { generateChangelog } from './generate-changelog' | ||
|
||
import { | ||
generateChangelog as generate, | ||
SerializedRelease, | ||
} from './generate-changelog' | ||
|
||
export async function generateChangelog<Scope>({ | ||
releases, | ||
branch = 'main', | ||
remote = 'origin', | ||
}: { | ||
releases: SerializedRelease<Scope>[] | ||
branch?: string | ||
remote?: string | ||
}) { | ||
try { | ||
const repository = await git.Repository.open(process.cwd()) | ||
const origin = await repository.getRemote(remote) | ||
const master = await repository.getBranchCommit(branch) | ||
const match = matchRemoteUrl(origin.url()) | ||
|
||
let commit = master | ||
|
||
while (commit.parentcount() > 0) { | ||
commit = await commit.parent(0) | ||
} | ||
|
||
if (!match) { | ||
return '' | ||
} | ||
|
||
return generate<Scope>({ | ||
releases, | ||
repository: { | ||
firstCommit: commit.sha(), | ||
...match, | ||
}, | ||
}) | ||
} catch (e) { | ||
console.log(e) | ||
return '' | ||
} | ||
} | ||
|
||
export function matchRemoteUrl(url: string) { | ||
/** | ||
* Matches an string that consists of | ||
* - An arbitrary prefix (that ends with : (for SSH) or / (for HTTPS)) | ||
* - [1] Repository owner (next part without : or /) | ||
* - [2] A forward slash / | ||
* - [3] Repository name (next part without : or / and without trailing .git) | ||
* - [4] Optionally .git | ||
* --[1]--|[2]|------[3]--------|---[4]---| | ||
*/ | ||
const match = url.match(/([^\/:]+)\/([^\/:]+(?<!\.git))(\.git)?$/) | ||
if (!match) return null | ||
return { | ||
owner: match[1], | ||
repo: match[2], | ||
} | ||
} | ||
export { generateChangelog } |
Oops, something went wrong.