fix(create): preserve ignored existing add-on targets #554
main fromrefs/pull/554/head·merged by tannerlinsley Adding pnpm build settings could silently replace an existing .npmrc when it was ignored by git. Load existing output targets before merging so registry settings survive and overwrite confirmation also covers ignored or empty files.
AI review notes: Five real filesystem regressions fail on current main and pass with this change. They cover preserving synthetic registry settings, cancellation without writes, an explicit root-check setting, an empty existing file and another ignored output target. The frozen install and affected lint pass. The unchanged normal hook built all 10 projects and passed 550 unit tests. All eight blocking Chrome e2e tests passed and the normal hook exited successfully. An actual compiled CLI blank scaffold outside the monorepo followed by the compiled addToApp flow retained synthetic registry settings and added the standalone pnpm setting. The install command was recorded rather than executed in that fixture. The normal browser gates separately cover installed generated apps and production-valid blank and AI builds without provider calls. No dependencies, public API or workflow changes. The compiled add-to-app module adds 683 raw bytes and 162 gzip bytes, measured against the accepted current-main build. This is a leaf-module measurement, not a whole-package or startup claim. Includes an @tanstack/create patch changeset. Publishing remains dependent on resolving the staged core artifact tracked in #551.
Summary by CodeRabbit#
- Bug Fixes
- Existing ignored files are now considered when adding pnpm workspace settings, helping preserve
.npmrcregistry configuration. - You’re prompted before an ignored file is overwritten, and can cancel the operation to keep its contents.
- Empty ignored files are also recognized as existing, helping prevent unintended overwrites.
- Existing ignored files are now considered when adding pnpm workspace settings, helping preserve
- 1
No actionable comments were generated in the recent review.
Walkthrough
-
writeFilesnow includes existing ignored output targets in merge and overwrite checks. It also treats empty existing files as present. Tests cover.npmrcpreservation and overwrite cancellation.Changes: Ignored file handling
Layer / File(s) Summary Load existing output targets
packages/create/src/add-to-app.ts,.changeset/preserve-ignored-npmrc.mdwriteFilesloads existing generated targets, including.npmrcwhen generatingpnpm-workspace.yaml. It checks file presence even when the contents are empty. The Changeset declares a patch release.Test ignored target behavior
packages/create/tests/ignored-npmrc.test.tsTests cover .npmrcmerging and preservation, prompt behavior, cancellation, empty ignored files, and protection of another ignored target.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- TanStack/cli#485: Defines the
standalonePnpmNpmrcbehavior that this change uses when merging existing.npmrccontents.
- TanStack/cli#485: Defines the
Merge Risk:
Minimal · up tod6bb4-
Ignored target files are included in merge and overwrite checks. No material merge-blocking issue was identified.
Pre-merge checks:
4 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Docstring Coverage Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold. Passed checks: 4 passed-
Check name Status Explanation Description Check Check skipped - CodeRabbit’s high-level summary is enabled. Title check The title clearly and concisely describes the main change: preserving ignored existing add-on targets in the create flow. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint-
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/create/tests/ignored-npmrc.test.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/create/tests/ignored-npmrc.test.ts
-
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
CodeRabbit Verify#
- Run CodeRabbit Verify to test the changes in this pull request.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
92f02b71-3c7b-4a14-ae85-1885b255e5b6
Commits-
Reviewing files that changed from the base of the PR and between 9e615780bca2d3a53c49d7b6828b08a71162ad55 and d6bb4dab8bc1bc7fea727ff2f34fdb6a8ec3dcb6.
Files selected for processing: 3-
.changeset/preserve-ignored-npmrc.mdpackages/create/src/add-to-app.tspackages/create/tests/ignored-npmrc.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
-
-
tannerlinsley merged thisfac419e
tannerlinsley closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: d6bb4dab8bc1bc7fea727ff2f34fdb6a8ec3dcb6
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR