-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
installDeps.ts
41 lines (33 loc) · 904 Bytes
/
installDeps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { spawn } from 'child_process';
import { spinner } from '@clack/prompts';
import picocolors from 'picocolors';
import { t } from 'i18next';
/** Generate sample data and upgrade */
const installDeps = async (
vsfDirName: string,
writeLog: (message: string) => void
) => {
const options = {
cwd: vsfDirName
};
const sp = spinner();
return new Promise((resolve) => {
const install = spawn('yarn', options);
sp.start(
picocolors.cyan(t('command.generate_store.progress.install_deps_start'))
);
install.stdout.on('data', (data) => {
writeLog(data.toString());
});
install.stderr.on('data', (data) => {
writeLog(data.toString());
});
install.on('close', () => {
sp.stop(
picocolors.green(t('command.generate_store.progress.install_deps_end'))
);
resolve(1);
});
});
};
export default installDeps;