MCPcopy Create free account
hub / github.com/stackblitz-labs/pkg.pr.new / writeDeps

Function writeDeps

packages/cli/index.ts:882–902  ·  view source on GitHub ↗
(
  p: string,
  pJsonContents: string,
  pJson: PackageJson,
  deps: Map<string, string>,
  realDeps: Map<string, string> | null,
)

Source from the content-addressed store, hash-verified

880}
881
882async function writeDeps(
883 p: string,
884 pJsonContents: string,
885 pJson: PackageJson,
886 deps: Map<string, string>,
887 realDeps: Map<string, string> | null,
888) {
889 const pJsonPath = path.resolve(p, "package.json");
890
891 hijackDeps(deps, pJson.dependencies);
892 hijackDeps(deps, pJson.devDependencies);
893 hijackDeps(deps, pJson.optionalDependencies);
894
895 if (realDeps) {
896 hijackDeps(realDeps, pJson.peerDependencies);
897 }
898
899 await writePackageJSON(pJsonPath, pJson);
900
901 return () => fs.writeFile(pJsonPath, pJsonContents);
902}
903
904function hijackDeps(
905 newDeps: Map<string, string>,

Callers 1

index.tsFile · 0.85

Calls 1

hijackDepsFunction · 0.85

Tested by

no test coverage detected