Repository navigation
refactor: write YAML config files with JSON.stringify - #85
Conversation
JSON is valid YAML, and JSON.stringify quotes and escapes every value, whereas hand-assembled YAML lines are correct only for values that happen not to need quoting. pnpr's config and registries document, the generated pnpm-workspace.yaml files and .yarnrc.yml are now built as objects and written through a shared `yamlText` helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
PR Summary by QodoSerialize generated YAML configs as JSON to safely escape values
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
#85 switched the generated config files to JSON, which is valid YAML but leaves pnpm-workspace.yaml as a multi-line flow collection. pnpm 12 edits that file in place (`--allow-build` records `allowBuilds` there) and refuses to edit a flow collection, so bootstrapping the installer failed with ERR_PNPM_WORKSPACE_MANIFEST_WRITER_UNSUPPORTED_INLINE_BLOCK. yamlText now serializes with js-yaml's dump, which still quotes and escapes every value but emits block style. `noRefs` keeps shared objects from becoming aliases, which pnpm cannot edit either. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to #84. Config files that are read as YAML were assembled by hand from template strings, which is correct only while no value needs quoting (a path with
:or#in it, a string YAML would read as a number or boolean). JSON is valid YAML andJSON.stringifyescapes everything, so these are now built as objects and written through a sharedyamlTexthelper inbenchmarkFixture.js:pnprServer.js: pnpr'spnpr.yamland theregistries.yamlit importsbenchmarkFixture.js:pnpmWorkspaceYamland the Yarn.yarnrc.ymlbenchmarkLockfileConflicts.js: the scenariopnpm-workspace.yamlindex.js,populatePnprCache.js,setupPackageManagers.js: theminimumReleaseAge: 0workspace manifestsThe comments that explained each setting stay next to the matching object keys. Output is indented, so the generated files remain readable when debugging a run.
.npmrcis INI rather than YAML, so it is unchanged.Testing
pnpm run lintandpnpm testpass.startPnpr,mintToken, the latency proxies,verifyResolverIsUsedon a project that includes a@teambitpackage), on fresh storage and again on a copied, already-populated storage: pnpr accepts the config and the registries import, and pnpm reads the generatedpnpm-workspace.yamland resolves through the server..yarnrc.yml(yarn config get).🤖 Generated with Claude Code
Summary by CodeRabbit