fix(angular): check whether deps have been built when using incremental build
This commit is contained in:
parent
fa67518892
commit
e33f035dc4
@ -4,9 +4,10 @@ import {
|
|||||||
createBuilder,
|
createBuilder,
|
||||||
} from '@angular-devkit/architect';
|
} from '@angular-devkit/architect';
|
||||||
import { JsonObject } from '@angular-devkit/core';
|
import { JsonObject } from '@angular-devkit/core';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable, of } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
calculateProjectDependencies,
|
calculateProjectDependencies,
|
||||||
|
checkDependentProjectsHaveBeenBuilt,
|
||||||
createTmpTsConfig,
|
createTmpTsConfig,
|
||||||
} from '@nrwl/workspace/src/utils/buildable-libs-utils';
|
} from '@nrwl/workspace/src/utils/buildable-libs-utils';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
@ -19,10 +20,12 @@ function run(
|
|||||||
context: BuilderContext
|
context: BuilderContext
|
||||||
): Observable<BuilderOutput> {
|
): Observable<BuilderOutput> {
|
||||||
const projGraph = createProjectGraph();
|
const projGraph = createProjectGraph();
|
||||||
|
|
||||||
const { target, dependencies } = calculateProjectDependencies(
|
const { target, dependencies } = calculateProjectDependencies(
|
||||||
projGraph,
|
projGraph,
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
|
|
||||||
options.tsConfig = createTmpTsConfig(
|
options.tsConfig = createTmpTsConfig(
|
||||||
join(context.workspaceRoot, options.tsConfig),
|
join(context.workspaceRoot, options.tsConfig),
|
||||||
context.workspaceRoot,
|
context.workspaceRoot,
|
||||||
@ -30,12 +33,25 @@ function run(
|
|||||||
dependencies
|
dependencies
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return of(checkDependentProjectsHaveBeenBuilt(context, dependencies)).pipe(
|
||||||
|
switchMap((result) => {
|
||||||
|
if (result) {
|
||||||
return from(
|
return from(
|
||||||
context.scheduleBuilder('@angular-devkit/build-angular:browser', options, {
|
context.scheduleBuilder(
|
||||||
|
'@angular-devkit/build-angular:browser',
|
||||||
|
options,
|
||||||
|
{
|
||||||
target: context.target,
|
target: context.target,
|
||||||
logger: context.logger as any,
|
logger: context.logger as any,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
).pipe(switchMap((x) => x.result));
|
).pipe(switchMap((x) => x.result));
|
||||||
|
} else {
|
||||||
|
// just pass on the result
|
||||||
|
return of({ success: false });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default createBuilder<JsonObject & BrowserBuilderSchema>(run);
|
export default createBuilder<JsonObject & BrowserBuilderSchema>(run);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user