(projectName: string, cwd: string, args: string[] = [])
| 83 | }); |
| 84 | |
| 85 | async function setupCRA(projectName: string, cwd: string, args: string[] = []): Promise<void> { |
| 86 | console.log('Setting up CRA in ' + cwd); |
| 87 | fs.mkdirSync(cwd, { recursive: true }); |
| 88 | const setupProc = cp.spawn('npx', ['create-react-app', ...args, projectName], { |
| 89 | cwd, |
| 90 | stdio: 'pipe', |
| 91 | env: process.env, |
| 92 | }); |
| 93 | setupProc.stdout.on('data', d => console.log(d.toString().replace(/\r?\n$/, ''))); |
| 94 | setupProc.stderr.on('data', d => console.error(d.toString().replace(/\r?\n$/, ''))); |
| 95 | |
| 96 | const done = getDeferred(); |
| 97 | setupProc.once('exit', () => { |
| 98 | done.resolve(undefined); |
| 99 | }); |
| 100 | await done.promise; |
| 101 | } |
| 102 | |
| 103 | async function startDevServer(projectFolder: string): Promise<cp.ChildProcessWithoutNullStreams> { |
| 104 | const devServerListening = getDeferred(); |
no test coverage detected