Skip to content

feat: inject .icp/data/.gitkeep in icp new#436

Closed
lwshang wants to merge 2 commits intomainfrom
lwshang/new_with_gitkeep
Closed

feat: inject .icp/data/.gitkeep in icp new#436
lwshang wants to merge 2 commits intomainfrom
lwshang/new_with_gitkeep

Conversation

@lwshang
Copy link
Copy Markdown
Contributor

@lwshang lwshang commented Mar 16, 2026

Summary

  • icp new now always creates .icp/data/.gitkeep in the generated project after template rendering
  • This ensures .icp/data/ (which stores mainnet canister ID mappings) is tracked in version control regardless of whether the template includes the file — covering both official and community templates
  • The file is only written if not already present, so templates that ship it themselves are unaffected

Test plan

  • new_injects_gitkeep_when_template_does_not_have_one — verifies the file is created when the template omits it
  • new_succeeds_when_template_already_has_gitkeep — verifies idempotency when the template already includes the file

🤖 Generated with Claude Code

lwshang and others added 2 commits March 16, 2026 13:49
Ensure `.icp/data/` is tracked in version control for all new projects,
regardless of whether the template (including community templates) includes
the file. The file is only created if not already present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lwshang lwshang marked this pull request as ready for review March 16, 2026 18:09
@lwshang lwshang requested a review from a team as a code owner March 16, 2026 18:09
.expect(".icp/data/.gitkeep always has a parent"),
)
.context("Failed to create .icp/data directory")?;
icp::fs::write(&gitkeep, &[]).context("Failed to create .icp/data/.gitkeep")?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't want to write some text in it that explains what it is ?

@lwshang lwshang marked this pull request as draft March 16, 2026 20:08
@lwshang lwshang closed this Mar 17, 2026
@lwshang lwshang deleted the lwshang/new_with_gitkeep branch March 24, 2026 13:19
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