(fn: (err: string | null) => void)
| 4 | import {yarn, plugs} from '../config/paths'; |
| 5 | |
| 6 | export const install = (fn: (err: string | null) => void) => { |
| 7 | const spawnQueue = queue({concurrency: 1}); |
| 8 | function yarnFn(args: string[], cb: (err: string | null) => void) { |
| 9 | const env = { |
| 10 | NODE_ENV: 'production', |
| 11 | ELECTRON_RUN_AS_NODE: 'true' |
| 12 | }; |
| 13 | spawnQueue.push((end) => { |
| 14 | const cmd = [process.execPath, yarn].concat(args).join(' '); |
| 15 | console.log('Launching yarn:', cmd); |
| 16 | |
| 17 | cp.execFile( |
| 18 | process.execPath, |
| 19 | [yarn].concat(args), |
| 20 | { |
| 21 | cwd: plugs.base, |
| 22 | env, |
| 23 | timeout: ms('5m'), |
| 24 | maxBuffer: 1024 * 1024 |
| 25 | }, |
| 26 | (err, stdout, stderr) => { |
| 27 | if (err) { |
| 28 | cb(stderr); |
| 29 | } else { |
| 30 | cb(null); |
| 31 | } |
| 32 | end?.(); |
| 33 | spawnQueue.start(); |
| 34 | } |
| 35 | ); |
| 36 | }); |
| 37 | |
| 38 | spawnQueue.start(); |
| 39 | } |
| 40 | |
| 41 | yarnFn(['install', '--no-emoji', '--no-lockfile', '--cache-folder', plugs.cache], (err) => { |
| 42 | if (err) { |
| 43 | return fn(err); |
| 44 | } |
| 45 | fn(null); |
| 46 | }); |
| 47 | }; |
no test coverage detected