(args: {
workDir: string;
moduleDir: string;
npmClient?: string;
})
| 64 | } |
| 65 | |
| 66 | export 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 | |
| 93 | export async function syncTypeModules(args: { |
| 94 | workDir: string; |
no test coverage detected
searching dependent graphs…