@nx/angular 19.5.7 → 19.6.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ exports.addE2e = addE2e;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("../../../utils/versions");
6
6
  const version_utils_1 = require("../../utils/version-utils");
7
+ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
7
8
  async function addE2e(tree, options) {
8
9
  // since e2e are separate projects, default to adding plugins
9
10
  const nxJson = (0, devkit_1.readNxJson)(tree);
@@ -32,6 +33,9 @@ async function addE2e(tree, options) {
32
33
  rootProject: options.rootProject,
33
34
  addPlugin,
34
35
  });
36
+ if (addPlugin) {
37
+ await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(tree, '@nx/cypress/plugin', '^build', (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'cypress.config.ts'));
38
+ }
35
39
  }
36
40
  else if (options.e2eTestRunner === 'playwright') {
37
41
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
@@ -55,6 +59,9 @@ async function addE2e(tree, options) {
55
59
  rootProject: options.rootProject,
56
60
  addPlugin,
57
61
  });
62
+ if (addPlugin) {
63
+ await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(tree, '@nx/playwright/plugin', '^build', (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'playwright.config.ts'));
64
+ }
58
65
  }
59
66
  }
60
67
  function addFileServerTarget(tree, options, targetName) {
@@ -8,6 +8,7 @@ const test_runners_1 = require("../../../utils/test-runners");
8
8
  const selector_1 = require("../../utils/selector");
9
9
  const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
10
10
  const version_utils_1 = require("../../utils/version-utils");
11
+ const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
11
12
  async function createFiles(tree, options, rootOffset) {
12
13
  const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
13
14
  const isUsingApplicationBuilder = angularMajorVersion >= 17 && options.bundler === 'esbuild';
@@ -16,6 +17,9 @@ async function createFiles(tree, options, rootOffset) {
16
17
  (0, selector_1.validateHtmlSelector)(rootSelector);
17
18
  const nxWelcomeSelector = `${options.prefix}-nx-welcome`;
18
19
  (0, selector_1.validateHtmlSelector)(nxWelcomeSelector);
20
+ const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
21
+ const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
22
+ (await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
19
23
  const substitutions = {
20
24
  rootSelector,
21
25
  appName: options.name,
@@ -34,8 +38,13 @@ async function createFiles(tree, options, rootOffset) {
34
38
  disableModernClassFieldsBehavior,
35
39
  useEventCoalescing: angularMajorVersion >= 18,
36
40
  useRouterTestingModule: angularMajorVersion < 18,
41
+ connectCloudUrl,
42
+ tutorialUrl: options.standalone
43
+ ? 'https://nx.dev/getting-started/tutorials/angular-standalone-tutorial?utm_source=nx-project'
44
+ : 'https://nx.dev/getting-started/tutorials/angular-monorepo-tutorial?utm_source=nx-project',
37
45
  tpl: '',
38
46
  };
47
+ const angularAppType = options.standalone ? 'standalone' : 'ng-module';
39
48
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base'), options.appProjectRoot, substitutions);
40
49
  if (angularMajorVersion >= 18) {
41
50
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base-18+'), options.appProjectRoot, substitutions);
@@ -49,6 +58,7 @@ async function createFiles(tree, options, rootOffset) {
49
58
  else {
50
59
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/ng-module'), options.appProjectRoot, substitutions);
51
60
  }
61
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/nx-welcome', onBoardingStatus, angularAppType), options.appProjectRoot, substitutions);
52
62
  (0, update_project_root_tsconfig_1.updateProjectRootTsConfig)(tree, options.appProjectRoot, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot), options.rootProject);
53
63
  if (!options.routing) {
54
64
  tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, '/src/app/app.routes.ts'));
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createProject = createProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const version_utils_1 = require("../../utils/version-utils");
6
- const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
6
+ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
7
7
  function createProject(tree, options) {
8
8
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
9
9
  const buildExecutor = options.bundler === 'webpack'
@@ -15,7 +15,7 @@ function createProject(tree, options) {
15
15
  const buildMainOptionName = angularMajorVersion >= 17 && options.bundler === 'esbuild'
16
16
  ? 'browser'
17
17
  : 'main';
18
- (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, buildExecutor);
18
+ (0, target_defaults_utils_1.addBuildTargetDefaults)(tree, buildExecutor);
19
19
  let budgets = undefined;
20
20
  if (options.bundler === 'webpack' || angularMajorVersion >= 17) {
21
21
  if (options.strict) {
@@ -31,4 +31,5 @@ export interface Schema {
31
31
  minimal?: boolean;
32
32
  bundler?: 'webpack' | 'esbuild';
33
33
  ssr?: boolean;
34
+ nxCloudToken?: string;
34
35
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = addProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
5
+ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
6
6
  function addProject(tree, libraryOptions) {
7
7
  const project = {
8
8
  name: libraryOptions.name,
@@ -17,7 +17,7 @@ function addProject(tree, libraryOptions) {
17
17
  const executor = libraryOptions.publishable
18
18
  ? '@nx/angular:package'
19
19
  : '@nx/angular:ng-packagr-lite';
20
- (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, executor);
20
+ (0, target_defaults_utils_1.addBuildTargetDefaults)(tree, executor);
21
21
  project.targets.build = {
22
22
  executor,
23
23
  outputs: ['{workspaceRoot}/dist/{projectRoot}'],