diff --git a/.gitignore b/.gitignore index 32ffbca9..cd60c28d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -coverage*/ -lib/ -node_modules/ +/coverage* +/lib +/node_modules diff --git a/.prettierignore b/.prettierignore index 608dd8d9..40d32561 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,5 @@ -.all-contributorsrc -.husky/ -coverage*/ -lib/ -pnpm-lock.yaml +/.all-contributorsrc +/.husky +/coverage* +/lib +/pnpm-lock.yaml diff --git a/script/__snapshots__/migrate-test-e2e.ts.snap b/script/__snapshots__/migrate-test-e2e.ts.snap index af25592f..83eeb3dd 100644 --- a/script/__snapshots__/migrate-test-e2e.ts.snap +++ b/script/__snapshots__/migrate-test-e2e.ts.snap @@ -31,22 +31,22 @@ exports[`expected file changes > .gitignore 1`] = ` "--- a/.gitignore +++ b/.gitignore @@ ... @@ --coverage*/ -+coverage/ - lib/ - node_modules/" +-/coverage* ++/coverage + /lib + /node_modules" `; exports[`expected file changes > .prettierignore 1`] = ` "--- a/.prettierignore +++ b/.prettierignore @@ ... @@ - .all-contributorsrc - .husky/ --coverage*/ -+coverage/ - lib/ - pnpm-lock.yaml" + /.all-contributorsrc + /.husky +-/coverage* ++/coverage + /lib + /pnpm-lock.yaml" `; exports[`expected file changes > README.md 1`] = ` diff --git a/src/steps/writing/creation/createDotGitignore.test.ts b/src/steps/writing/creation/createDotGitignore.test.ts index c887e4b6..1ce565fe 100644 --- a/src/steps/writing/creation/createDotGitignore.test.ts +++ b/src/steps/writing/creation/createDotGitignore.test.ts @@ -7,9 +7,9 @@ describe("createDotGitignore", () => { const actual = createDotGitignore({ excludeTests: false }); expect(actual).toMatchInlineSnapshot(` - "coverage/ - lib/ - node_modules/ + "/coverage + /lib + /node_modules " `); }); @@ -18,8 +18,8 @@ describe("createDotGitignore", () => { const actual = createDotGitignore({ excludeTests: true }); expect(actual).toMatchInlineSnapshot(` - "lib/ - node_modules/ + "/lib + /node_modules " `); }); diff --git a/src/steps/writing/creation/createDotGitignore.ts b/src/steps/writing/creation/createDotGitignore.ts index 3321ba82..e0cd5ed6 100644 --- a/src/steps/writing/creation/createDotGitignore.ts +++ b/src/steps/writing/creation/createDotGitignore.ts @@ -3,8 +3,8 @@ import { formatIgnoreFile } from "./formatters/formatIgnoreFile.js"; export function createDotGitignore(options: Pick) { return formatIgnoreFile([ - ...(options.excludeTests ? [] : ["coverage/"]), - "lib/", - "node_modules/", + ...(options.excludeTests ? [] : ["/coverage"]), + "/lib", + "/node_modules", ]); } diff --git a/src/steps/writing/creation/rootFiles.ts b/src/steps/writing/creation/rootFiles.ts index fd0ab23e..e86b0f38 100644 --- a/src/steps/writing/creation/rootFiles.ts +++ b/src/steps/writing/creation/rootFiles.ts @@ -27,11 +27,11 @@ export async function createRootFiles(options: Options) { }), ".nvmrc": `20.12.2\n`, ".prettierignore": formatIgnoreFile([ - ...(options.excludeAllContributors ? [] : [".all-contributorsrc"]), - ".husky/", - ...(options.excludeTests ? [] : ["coverage/"]), - "lib/", - "pnpm-lock.yaml", + ...(options.excludeAllContributors ? [] : ["/.all-contributorsrc"]), + "/.husky", + ...(options.excludeTests ? [] : ["/coverage"]), + "/lib", + "/pnpm-lock.yaml", ]), ".prettierrc.json": await formatJson({ $schema: "http://json.schemastore.org/prettierrc",