Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: detect legacy 'based on' notices in README.md #2125

Merged
merged 1 commit into from
Apr 3, 2025
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
20 changes: 19 additions & 1 deletion src/options/readReadmeAdditional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,25 @@ After.
expect(result).toBe("After.");
});

it("returns all content after contributors when there is a quote template notice", async () => {
it("returns all content after contributors when there is a legacy quote template notice", async () => {
const getReadme = () =>
Promise.resolve(`# My Package

Usage.

<!-- spellchecker:enable -->

After.

> 💙 This package is based on ...
`);

const result = await readReadmeAdditional(getReadme);

expect(result).toBe("After.");
});

it("returns all content after contributors when there is a current quote template notice", async () => {
const getReadme = () =>
Promise.resolve(`# My Package

Expand Down
2 changes: 1 addition & 1 deletion src/options/readReadmeAdditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const indicatorAfterAllContributorsSpellCheck =
/<!--\s*spellchecker:\s*enable\s*-->/;

const indicatorBeforeTemplatedBy =
/> .* This package was templated with |<!-- You can remove this notice/;
/> .* This package (?:is|was) (?:based|build|templated) (?:on|with) |<!-- You can remove this notice/;

export async function readReadmeAdditional(getReadme: () => Promise<string>) {
const readme = await getReadme();
Expand Down