Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ or

`yarn run auto-changelog update --autoCategorize`

#### Read the "CHANGELOG entry:" on the PR

`yarn run auto-changelog update --useChangelogEntry`

#### Use Short PR links

- Like `(#247)` instead of `([#247](https://github.com/MetaMask/auto-changelog/pull/247))`

`yarn run auto-changelog update --useShortPrLink`

#### Update the current release section of the changelog

`yarn run auto-changelog update --rc`
Expand All @@ -36,6 +46,10 @@ or

`npm run auto-changelog update --rc`

### Deluxe, as used in metamask-extension

`yarn run auto-changelog update --autoCategorize --useChangelogEntry --useShortPrLink --rc`

#### Update the changelog for a renamed package

This option is designed to be used for packages that live in a monorepo.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --clean",
"changelog": "node dist/cli.js",
"changelog": "node dist/cli.mjs",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
Expand Down
15 changes: 15 additions & 0 deletions src/update-changelog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ describe('updateChangelog', () => {
expect(result).toContain('### Added\n- New cool feature (#124)');
expect(result).toContain('### Fixed\n- Fixed a critical bug (#123)');
});

it('should have default values for useChangelogEntry and useShortPrLink', async () => {
jest
.spyOn(ChangeLogUtils, 'getNewChangeEntries')
.mockResolvedValue(getNewChangeEntriesMockData);

const result = await ChangeLogManager.updateChangelog({
...changelogData,
useChangelogEntry: undefined,
useShortPrLink: undefined,
});

expect(result).toContain('### Added\n- New cool feature (#124)');
expect(result).toContain('### Fixed\n- Fixed a critical bug (#123)');
});
});

describe('getCategory', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/update-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ export type UpdateChangelogOptions = {
/**
* Whether to use `CHANGELOG entry:` from the commit body and the no-changelog label
*/
useChangelogEntry: boolean;
useChangelogEntry?: boolean;
/**
* Whether to use short PR links in the changelog entries.
*/
useShortPrLink: boolean;
useShortPrLink?: boolean;
};

/**
Expand Down Expand Up @@ -141,8 +141,8 @@ export async function updateChangelog({
formatter = undefined,
packageRename,
autoCategorize,
useChangelogEntry,
useShortPrLink,
useChangelogEntry = false,
useShortPrLink = false,
}: UpdateChangelogOptions): Promise<string | undefined> {
const changelog = parseChangelog({
changelogContent,
Expand Down
Loading