fix(scaffold): resolve the framework peer from this repository, not a registry
Two sites reached a registry for the vendored framework, which the rescope turns from a silent second copy into a hard failure. Live-link mode relinked only the root manifest, so a generated workspace member — `plugins/*/package.json` — resolved its own dependencies from the registry and installed upstream cordis beside this repository's vendored copy. `LinkWorkspace.relinkNestedManifest()` relinks every nested generated manifest; `peerDependencies` keeps its range because package managers reject a link spec there. The sandbox publish-path rehearsal installs this repository's vendored cordis and cosmokit tarballs instead of naming a registry version.
This commit is contained in:
@@ -17,7 +17,7 @@ import type { ProjectResource } from '../features/resources.ts'
|
||||
import { CordisYamlFile, type CordisConfigEntry } from '../documents/cordis-yaml-file.ts'
|
||||
import { EnvFile } from '../documents/env-file.ts'
|
||||
import { PackageJsonFile, type PackageManifest } from '../documents/package-json-file.ts'
|
||||
import { ProjectFile } from '../documents/project-file.ts'
|
||||
import { ProjectFile, TextProjectFile } from '../documents/project-file.ts'
|
||||
import { TsConfigFile } from '../documents/tsconfig-file.ts'
|
||||
import { featureId, type FeatureId, type ResourceKey } from '../ids.ts'
|
||||
import { LinkWorkspace } from '../package-managers/link-workspace.ts'
|
||||
@@ -288,6 +288,18 @@ export class ProjectEditSession implements FeatureProjectView {
|
||||
this.profile.packageManager,
|
||||
[...this.documents.values()],
|
||||
)
|
||||
// Generated workspace members resolve their own dependencies, so the root
|
||||
// manifest's links are not enough: relink every nested manifest as well.
|
||||
for (const [path, document] of this.documents) {
|
||||
if (path === 'package.json' || !path.endsWith('/package.json')) continue
|
||||
const relinked = workspace.relinkNestedManifest(
|
||||
this.source.root,
|
||||
path,
|
||||
document.serialize(),
|
||||
this.profile.packageManager,
|
||||
)
|
||||
this.documents.set(path, new TextProjectFile(path, relinked, document.originalText))
|
||||
}
|
||||
}
|
||||
this.validateFinalState()
|
||||
const changes = this.changes()
|
||||
|
||||
Reference in New Issue
Block a user