MCPcopy
hub / github.com/vercel/hyper / install

Function install

app/plugins/install.ts:6–47  ·  view source on GitHub ↗
(fn: (err: string | null) => void)

Source from the content-addressed store, hash-verified

4import {yarn, plugs} from '../config/paths';
5
6export 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};

Callers 1

updatePluginsFunction · 0.90

Calls 3

queueFunction · 0.85
yarnFnFunction · 0.85
fnFunction · 0.85

Tested by

no test coverage detected