Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function startDevServer(
devServerTarget: string,
isWatching: boolean,
context: BuilderContext
): Observable {
// Overrides dev server watch setting.
const overrides = {
watch: isWatching
};
return scheduleTargetAndForget(
context,
targetFromTargetString(devServerTarget),
overrides
).pipe(
map(output => {
if (!output.success && !isWatching) {
throw new Error('Could not compile application files');
}
return output.baseUrl as string;
})
);
}
...options.waitUntilTargets.map(b => {
return scheduleTargetAndForget(context, targetFromTargetString(b)).pipe(
// @ts-ignore
filter(e => !!e.success),
first(),
);
}),
).pipe(map(results => ({ success: !results.some(r => !r.success) })));
() =>
// @ts-ignore
scheduleTargetAndForget(context, target, {
watch: true,
}) as Observable,
),
...options.waitUntilTargets.map(b => {
return scheduleTargetAndForget(context, targetFromTargetString(b)).pipe(
filter(e => e.success !== undefined),
first()
);
})
).pipe(
function run(
options: NextBuildBuilderOptions,
context: BuilderContext
): Observable {
const buildTarget = targetFromTargetString(options.buildTarget);
const build$ = scheduleTargetAndForget(context, buildTarget);
return build$.pipe(
concatMap(r => {
if (!r.success) return of(r);
return from(context.getTargetOptions(buildTarget)).pipe(
concatMap((buildOptions: any) => {
const root = path.resolve(context.workspaceRoot, buildOptions.root);
const config = prepareConfig(
context.workspaceRoot,
buildOptions.root,
buildOptions.outputPath,
PHASE_EXPORT
);
return from(
exportApp(
root,
...options.waitUntilTargets.map(b => {
return scheduleTargetAndForget(context, targetFromTargetString(b)).pipe(
filter(e => e.success !== undefined),
first()
);
})
).pipe(
() =>
scheduleTargetAndForget(context, target, {
watch: true
}) as Observable
)
export function startDevServer(
devServerTarget: string,
watch: boolean,
context: BuilderContext
): Observable {
const overrides = {
watch
};
return scheduleTargetAndForget(
context,
targetFromTargetString(devServerTarget),
overrides
).pipe(
map((output: any) => {
if (!output.success && !watch) {
throw new Error("Could not compile application files");
}
return output.baseUrl as string;
})
);
}
function run(
options: NextBuildBuilderOptions,
context: BuilderContext
): Observable {
const buildTarget = targetFromTargetString(options.buildTarget);
const build$ = !options.dev
? scheduleTargetAndForget(context, buildTarget)
: of({ success: true });
return build$.pipe(
concatMap(r => {
if (!r.success) return of(r);
return from(context.getTargetOptions(buildTarget)).pipe(
concatMap((buildOptions: any) => {
const root = path.resolve(context.workspaceRoot, buildOptions.root);
const config = prepareConfig(
context.workspaceRoot,
buildOptions.root,
buildOptions.outputPath,
options.dev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_SERVER
);