techtools
Головна / scripts / setup.ts

setup.ts

TypeScript · 13 рядків

1// Встановлення залежностей усіх проєктів стенда (npm run setup).
2import { spawnSync } from 'node:child_process'
3import { join } from 'node:path'
4import { apps, ROOT } from './stand.ts'
5
6let failed = 0
7for (const a of apps) {
8  console.log(`\n▶ ${a.id}: npm install у ${a.dir}`)
9  const r = spawnSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['install'], { cwd: join(ROOT, a.dir), stdio: 'inherit', shell: process.platform === 'win32' })
10  if (r.status !== 0) { failed++; console.error(`✗ ${a.id}: npm install завершився з кодом ${r.status}`) }
11}
12process.exit(failed ? 1 : 0)
13