MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / installPeerAndDevDeps

Function installPeerAndDevDeps

modules/material-parser/src/utils.ts:66–91  ·  view source on GitHub ↗
(args: {
  workDir: string;
  moduleDir: string;
  npmClient?: string;
})

Source from the content-addressed store, hash-verified

64}
65
66export async function installPeerAndDevDeps(args: {
67 workDir: string;
68 moduleDir: string;
69 npmClient?: string;
70}) {
71 const { workDir, moduleDir, npmClient = 'tnpm' } = args;
72 const modulePkgJsonPath = path.resolve(moduleDir, 'package.json');
73 if (!(await pathExists(modulePkgJsonPath))) {
74 return;
75 }
76 const pkgJsonPath = path.resolve(workDir, 'package.json');
77 if (!(await pathExists(pkgJsonPath))) {
78 return;
79 }
80 const modulePkgJson = await resolvePkgJson(modulePkgJsonPath);
81 const pkgJson = await resolvePkgJson(pkgJsonPath);
82 const { peerDependencies = {}, devDependencies = {} } = modulePkgJson;
83 pkgJson.dependencies = pkgJson.dependencies || {};
84 pkgJson.dependencies = {
85 ...pkgJson.dependencies,
86 ...peerDependencies,
87 ...devDependencies,
88 };
89 await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
90 await spawn(npmClient, ['i'], { stdio: 'inherit', cwd: workDir } as any);
91}
92
93export async function syncTypeModules(args: {
94 workDir: string;

Callers 1

index.tsFile · 0.90

Calls 2

resolvePkgJsonFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…