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: use root-level slashes in .gitignore and .prettierignore #1696

Merged
merged 3 commits into from
Nov 26, 2024
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
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
coverage*/
lib/
node_modules/
/coverage*
/lib
/node_modules
10 changes: 5 additions & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.all-contributorsrc
.husky/
coverage*/
lib/
pnpm-lock.yaml
/.all-contributorsrc
/.husky
/coverage*
/lib
/pnpm-lock.yaml
20 changes: 10 additions & 10 deletions script/__snapshots__/migrate-test-e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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`] = `
Expand Down
10 changes: 5 additions & 5 deletions src/steps/writing/creation/createDotGitignore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ describe("createDotGitignore", () => {
const actual = createDotGitignore({ excludeTests: false });

expect(actual).toMatchInlineSnapshot(`
"coverage/
lib/
node_modules/
"/coverage
/lib
/node_modules
"
`);
});
Expand All @@ -18,8 +18,8 @@ describe("createDotGitignore", () => {
const actual = createDotGitignore({ excludeTests: true });

expect(actual).toMatchInlineSnapshot(`
"lib/
node_modules/
"/lib
/node_modules
"
`);
});
Expand Down
6 changes: 3 additions & 3 deletions src/steps/writing/creation/createDotGitignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { formatIgnoreFile } from "./formatters/formatIgnoreFile.js";

export function createDotGitignore(options: Pick<Options, "excludeTests">) {
return formatIgnoreFile([
...(options.excludeTests ? [] : ["coverage/"]),
"lib/",
"node_modules/",
...(options.excludeTests ? [] : ["/coverage"]),
"/lib",
"/node_modules",
]);
}
10 changes: 5 additions & 5 deletions src/steps/writing/creation/rootFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down