forked from nrwl/nx
/
buildable-libs.ts
34 lines (31 loc) · 1005 Bytes
/
buildable-libs.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
import { BuilderContext } from '@angular-devkit/architect';
import {
calculateProjectDependencies,
createTmpTsConfig,
DependentBuildableProjectNode,
} from '@nrwl/workspace/src/utilities/buildable-libs-utils';
import { readCachedProjectGraph } from '@nrwl/devkit';
import { join } from 'path';
export function createTmpTsConfigForBuildableLibs(
tsConfigPath: string,
context: BuilderContext,
target?: string
) {
let dependencies: DependentBuildableProjectNode[];
const result = calculateProjectDependencies(
readCachedProjectGraph(),
context.workspaceRoot,
context.target.project,
target ?? context.target.target,
context.target.configuration
);
dependencies = result.dependencies;
const tmpTsConfigPath = createTmpTsConfig(
join(context.workspaceRoot, tsConfigPath),
context.workspaceRoot,
result.target.data.root,
dependencies
);
process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;
return { tsConfigPath: tmpTsConfigPath, dependencies };
}