Skip to content

Add .gitignore for Astro#4829

Open
devsker wants to merge 1 commit intogithub:mainfrom
devsker:main
Open

Add .gitignore for Astro#4829
devsker wants to merge 1 commit intogithub:mainfrom
devsker:main

Conversation

@devsker
Copy link
Copy Markdown

@devsker devsker commented Mar 29, 2026

Reasons for making this change

I wanted to use "npx gitignore" with my new Astro project. I then found out that there is no gitignore for Astro in this repo.

Links to documentation supporting these rule changes

I couldn't find any documentation showing the gitignore file. I used the gitignore file from the astro repo from withastro.

https://github.com/withastro/astro/blob/main/.gitignore
https://github.com/withastro/astro/

If this is a new template

Link to application or project’s homepage: https://astro.build/

Merge and Approval Steps

  • Confirm that you've read the contribution guidelines and ensured your PR aligns
  • Ensure CI is passing
  • Get a review and Approval from one of the maintainers

Copilot AI review requested due to automatic review settings March 29, 2026 21:17
@devsker devsker marked this pull request as draft March 29, 2026 21:17
@devsker devsker marked this pull request as ready for review March 29, 2026 21:18
@devsker devsker requested a review from a team as a code owner March 29, 2026 21:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an Astro .gitignore template to this repository so users/tools (e.g., npx gitignore) can generate ignore rules for Astro projects.

Changes:

  • Introduces a new Astro gitignore template file with ignore rules largely sourced from withastro/astro.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

benchmark/results/
test-results/
*.log
package-lock.json
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring package-lock.json by default is risky for typical Astro apps because lockfiles are commonly committed to ensure reproducible installs in CI and across developers. Unless Astro explicitly recommends ignoring lockfiles for end-user projects, this line should be removed (or at least scoped to the monorepo use case rather than a generic template).

Suggested change
package-lock.json

Copilot uses AI. Check for mistakes.
.eslintcache
.pnpm-store
.vscode-test/
.claude
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.claude isn’t a standard Astro-generated file/directory and doesn’t appear in any other template in this repo. Including tool-specific config like this in a general Astro template will surprise users and can hide intentionally committed configuration; it should be removed from the template.

Suggested change
.claude

Copilot uses AI. Check for mistakes.
.claude

# do not commit .env files or any files that end with `.env`
*.env
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.env will ignore all env files, including commonly-committed examples like .env.example. Other templates in this repo typically add an allowlist exception (e.g., !.env.example) or use more targeted patterns. Consider aligning with that approach so projects can keep sample env files under version control.

Suggested change
*.env
*.env
!.env.example

Copilot uses AI. Check for mistakes.
packages/**/e2e/**/fixtures/**/.astro/
packages/**/e2e/**/fixtures/**/env.d.ts
examples/**/.astro/
examples/**/env.d.ts
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The packages/... and examples/... ignore patterns are tied to Astro’s monorepo layout and are unlikely to apply to typical Astro projects. In a generic Astro template, these broad paths can accidentally match legitimate user directories named packages/examples and hide tracked files. Recommend removing these repo-specific entries and keeping only project-generated artifacts (e.g., .astro/, dist/, logs).

Suggested change
examples/**/env.d.ts

Copilot uses AI. Check for mistakes.
# want to share with others (see
# https://github.com/withastro/astro/pull/11759#discussion_r1721444711)
*.code-workspace
packages/astro/e2e/fixtures/cloudflare/.wrangler/deploy/config.json
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ignore rule targets an extremely specific file path inside Astro’s own e2e fixtures (packages/astro/e2e/fixtures/...) and doesn’t belong in a general-purpose Astro project template. Keeping such a specific path in a public template adds noise and can confuse consumers; please remove it.

Suggested change
packages/astro/e2e/fixtures/cloudflare/.wrangler/deploy/config.json

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,49 @@
node_modules/
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This template file is named Astro without the .gitignore suffix, which is inconsistent with the rest of this repository’s templates (e.g., Nextjs.gitignore, Angular.gitignore). This likely prevents it from being discovered/used by template tooling and by GitHub’s template chooser. Rename the file to Astro.gitignore.

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +3
/triage/
/.compiler/
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ignore rules appear to be specific to the withastro/astro monorepo (e.g., /triage/, /.compiler/) rather than files generated by typical Astro projects. Including repo-internal directories in a general-purpose Astro template can cause unrelated user folders to be ignored unintentionally; consider removing these entries from the template.

Suggested change
/triage/
/.compiler/

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +16
scripts/smoke/*-main/
scripts/memory/project/src/pages/
benchmark/projects/
benchmark/results/
test-results/
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These patterns (scripts/..., benchmark/..., test-results/) look specific to Astro’s own repository/test setup rather than a consumer Astro application. To keep this template broadly applicable (per repo README guidance on scope), drop repo-internal paths and keep only ignores that are commonly produced by Astro projects.

Suggested change
scripts/smoke/*-main/
scripts/memory/project/src/pages/
benchmark/projects/
benchmark/results/
test-results/

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants