forked from ionic-team/ionic-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnpm.ts
More file actions
55 lines (48 loc) · 1.41 KB
/
Copy pathnpm.ts
File metadata and controls
55 lines (48 loc) · 1.41 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { readFileSync } from 'fs';
import { join } from 'path';
import { CLI_DIR, FRAMEWORK_DIR } from './config';
import { execp, vlog } from './utils';
// Generic helpers
export async function install(dir?) {
await execp('npm i', dir ? { cwd: dir } : null);
}
export async function build(dir?) {
await execp('npm run build', dir ? { cwd: dir } : null);
}
export async function run(command: string, dir?) {
await execp(`npm run ${command}`, dir ? { cwd: dir } : null);
}
// Section specific npm related commands
export async function installFramework() {
vlog('npm installing monorepo');
await install(FRAMEWORK_DIR);
vlog('npm installing core');
const coreDir = join(FRAMEWORK_DIR, 'core');
await install(coreDir);
return execp(`npm rebuild node-sass`, { cwd: coreDir });
}
export async function getCLIDocs() {
vlog('npm installing');
await install(CLI_DIR);
vlog('running bootstrap');
await run('bootstrap', CLI_DIR);
vlog('building CLI docs');
await execp(`npm run docs`, {
cwd: CLI_DIR,
env: {
...process.env,
FORCE_COLOR: '1'
}
});
return {
// 'ionic1': JSON.parse(
// readFileSync(`${config.CLI_DIR}/docs/ionic1.json`, `utf8`)
// ),
// 'ionic-angular': JSON.parse(
// readFileSync(`${config.CLI_DIR}/docs/ionic-angular.json`, `utf8`)
// ),
'angular': JSON.parse(
readFileSync(`${CLI_DIR}/docs/angular.json`, `utf8`)
)
};
}