-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathbasic.ts
More file actions
37 lines (32 loc) · 1.05 KB
/
basic.ts
File metadata and controls
37 lines (32 loc) · 1.05 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
import { join } from 'node:path';
import { getGlobalVariable } from '../../utils/env';
import { exec, execAndWaitForOutputToMatch, silentNpm } from '../../utils/process';
import { rimraf } from '../../utils/fs';
export default async function () {
// setup
const argv = getGlobalVariable('argv');
if (argv.noglobal) {
return;
}
await silentNpm('install', '-g', '@angular-devkit/schematics-cli');
await exec(process.platform.startsWith('win') ? 'where' : 'which', 'schematics');
const startCwd = process.cwd();
const schematicPath = join(startCwd, 'test-schematic');
try {
// create blank schematic
await exec('schematics', 'schematic', '--name', 'test-schematic');
process.chdir(join(startCwd, 'test-schematic'));
await execAndWaitForOutputToMatch(
'schematics',
['.:', '--list-schematics'],
/my-full-schematic/,
);
} finally {
// restore path
process.chdir(startCwd);
await Promise.all([
rimraf(schematicPath),
silentNpm('uninstall', '-g', '@angular-devkit/schematics-cli'),
]);
}
}