-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
application.ts
72 lines (62 loc) · 1.97 KB
/
application.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import {
convertNxGenerator,
formatFiles,
GeneratorCallback,
joinPathFragments,
runTasksInSerial,
Tree,
} from '@nx/devkit';
import { runSymlink } from '../../utils/symlink-task';
import { addLinting } from '../../utils/add-linting';
import { addJest } from '../../utils/add-jest';
import { normalizeOptions } from './lib/normalize-options';
import initGenerator from '../init/init';
import { addProject } from './lib/add-project';
import { createApplicationFiles } from './lib/create-application-files';
import { addEasScripts } from './lib/add-eas-scripts';
import { addDetox } from './lib/add-detox';
import { Schema } from './schema';
export async function expoApplicationGenerator(
host: Tree,
schema: Schema
): Promise<GeneratorCallback> {
return await expoApplicationGeneratorInternal(host, {
projectNameAndRootFormat: 'derived',
...schema,
});
}
export async function expoApplicationGeneratorInternal(
host: Tree,
schema: Schema
): Promise<GeneratorCallback> {
const options = await normalizeOptions(host, schema);
createApplicationFiles(host, options);
addProject(host, options);
const initTask = await initGenerator(host, { ...options, skipFormat: true });
const lintTask = await addLinting(host, {
...options,
projectRoot: options.appProjectRoot,
tsConfigPaths: [
joinPathFragments(options.appProjectRoot, 'tsconfig.app.json'),
],
});
const jestTask = await addJest(
host,
options.unitTestRunner,
options.projectName,
options.appProjectRoot,
options.js,
options.skipPackageJson
);
const detoxTask = await addDetox(host, options);
const symlinkTask = runSymlink(host.root, options.appProjectRoot);
addEasScripts(host);
if (!options.skipFormat) {
await formatFiles(host);
}
return runTasksInSerial(initTask, lintTask, jestTask, detoxTask, symlinkTask);
}
export default expoApplicationGenerator;
export const expoApplicationSchematic = convertNxGenerator(
expoApplicationGenerator
);