Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(angular): use @nrwl/web:file-server in serve-static targets #16009

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ Object {
"executor": "@angular-devkit/build-angular:dev-server",
},
"serve-static": Object {
"executor": "@nrwl/angular:file-server",
"executor": "@nrwl/web:file-server",
"options": Object {
"buildTarget": "my-dir-my-app:build",
},
Expand Down Expand Up @@ -645,7 +645,7 @@ Object {
"executor": "@angular-devkit/build-angular:dev-server",
},
"serve-static": Object {
"executor": "@nrwl/angular:file-server",
"executor": "@nrwl/web:file-server",
"options": Object {
"buildTarget": "my-app:build",
},
Expand Down
13 changes: 8 additions & 5 deletions packages/angular/src/generators/application/lib/add-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { cypressProjectGenerator } from '@nrwl/cypress';
import type { Tree } from '@nrwl/devkit';
import type { NormalizedSchema } from './normalized-schema';

import {
addDependenciesToPackageJson,
readProjectConfiguration,
updateProjectConfiguration,
} from '@nrwl/devkit';
import { cypressProjectGenerator } from '@nrwl/cypress';
import { nxVersion } from '../../../utils/versions';
import type { NormalizedSchema } from './normalized-schema';
import { removeScaffoldedE2e } from './remove-scaffolded-e2e';

export async function addE2e(tree: Tree, options: NormalizedSchema) {
removeScaffoldedE2e(tree, options, options.ngCliSchematicE2ERoot);

if (options.e2eTestRunner === 'cypress') {
// TODO: This can call `@nrwl/web:static-config` generator once we merge `@nrwl/angular:file-server` into `@nrwl/web:file-server`.
// TODO: This can call `@nrwl/web:static-config` generator when ready
addFileServerTarget(tree, options, 'serve-static');

await cypressProjectGenerator(tree, {
Expand All @@ -32,9 +33,11 @@ function addFileServerTarget(
options: NormalizedSchema,
targetName: string
) {
addDependenciesToPackageJson(tree, {}, { '@nrwl/web': nxVersion });

const projectConfig = readProjectConfiguration(tree, options.name);
projectConfig.targets[targetName] = {
executor: '@nrwl/angular:file-server',
executor: '@nrwl/web:file-server',
options: {
buildTarget: `${options.name}:build`,
port: options.port,
Expand Down