@nx/angular 16.6.0-beta.1 → 16.6.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "16.6.0-beta.1",
3
+ "version": "16.6.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -66,14 +66,14 @@
66
66
  "migrations": "./migrations.json"
67
67
  },
68
68
  "dependencies": {
69
- "@nrwl/angular": "16.6.0-beta.1",
70
- "@nx/cypress": "16.6.0-beta.1",
71
- "@nx/devkit": "16.6.0-beta.1",
72
- "@nx/jest": "16.6.0-beta.1",
73
- "@nx/js": "16.6.0-beta.1",
74
- "@nx/linter": "16.6.0-beta.1",
75
- "@nx/webpack": "16.6.0-beta.1",
76
- "@nx/workspace": "16.6.0-beta.1",
69
+ "@nrwl/angular": "16.6.0-beta.3",
70
+ "@nx/cypress": "16.6.0-beta.3",
71
+ "@nx/devkit": "16.6.0-beta.3",
72
+ "@nx/jest": "16.6.0-beta.3",
73
+ "@nx/js": "16.6.0-beta.3",
74
+ "@nx/linter": "16.6.0-beta.3",
75
+ "@nx/webpack": "16.6.0-beta.3",
76
+ "@nx/workspace": "16.6.0-beta.3",
77
77
  "@phenomnomnominal/tsquery": "~5.0.1",
78
78
  "@typescript-eslint/type-utils": "^5.36.1",
79
79
  "chalk": "^4.1.0",
@@ -85,8 +85,6 @@
85
85
  "magic-string": "~0.26.2",
86
86
  "minimatch": "3.0.5",
87
87
  "semver": "7.5.3",
88
- "ts-node": "10.9.1",
89
- "tsconfig-paths": "^4.1.2",
90
88
  "tslib": "^2.3.0",
91
89
  "webpack": "^5.80.0",
92
90
  "webpack-merge": "5.7.3"
@@ -110,5 +108,5 @@
110
108
  "module": "fesm2022/nx-angular.mjs",
111
109
  "typings": "index.d.ts",
112
110
  "sideEffects": false,
113
- "gitHead": "cf9f5cbe6a7ce3b916ec6505dc8488f669cbc52b"
111
+ "gitHead": "cd8c61d7a3b8ab9bc7bab068f5ca49bbf14abbf5"
114
112
  }
@@ -6,6 +6,7 @@ const devkit_1 = require("@nx/devkit");
6
6
  const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
7
7
  const webpack_dev_server_impl_1 = require("../webpack-dev-server/webpack-dev-server.impl");
8
8
  const project_graph_1 = require("nx/src/project-graph/project-graph");
9
+ const executor_utils_1 = require("nx/src/command-line/run/executor-utils");
9
10
  const module_federation_1 = require("../utilities/module-federation");
10
11
  const fs_1 = require("fs");
11
12
  const path_1 = require("path");
@@ -15,7 +16,6 @@ function executeModuleFederationDevServerBuilder(schema, context) {
15
16
  const options = tslib_1.__rest(schema, []);
16
17
  const projectGraph = (0, devkit_1.readCachedProjectGraph)();
17
18
  const { projects: workspaceProjects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
18
- const ws = new devkit_1.Workspaces(devkit_1.workspaceRoot);
19
19
  const project = workspaceProjects[context.target.project];
20
20
  let pathToManifestFile = (0, path_1.join)(context.workspaceRoot, project.sourceRoot, 'assets/module-federation.manifest.json');
21
21
  if (options.pathToManifestFile) {
@@ -53,7 +53,7 @@ function executeModuleFederationDevServerBuilder(schema, context) {
53
53
  const runOptions = {};
54
54
  if (options.verbose) {
55
55
  const [collection, executor] = workspaceProjects[remote].targets[target].executor.split(':');
56
- const { schema } = ws.readExecutor(collection, executor);
56
+ const { schema } = (0, executor_utils_1.getExecutorInformation)(collection, executor, devkit_1.workspaceRoot);
57
57
  if (schema.additionalProperties || 'verbose' in schema.properties) {
58
58
  runOptions.verbose = options.verbose;
59
59
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeModuleFederationDevSSRBuilder = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const project_graph_1 = require("nx/src/project-graph/project-graph");
6
+ const executor_utils_1 = require("nx/src/command-line/run/executor-utils");
6
7
  const devkit_1 = require("@nx/devkit");
7
8
  const module_federation_1 = require("../utilities/module-federation");
8
9
  const operators_1 = require("rxjs/operators");
@@ -16,7 +17,6 @@ function executeModuleFederationDevSSRBuilder(schema, context) {
16
17
  const options = tslib_1.__rest(schema, []);
17
18
  const projectGraph = (0, devkit_1.readCachedProjectGraph)();
18
19
  const { projects: workspaceProjects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
19
- const ws = new devkit_1.Workspaces(devkit_1.workspaceRoot);
20
20
  const project = workspaceProjects[context.target.project];
21
21
  let pathToManifestFile = (0, path_1.join)(context.workspaceRoot, project.sourceRoot, 'assets/module-federation.manifest.json');
22
22
  if (options.pathToManifestFile) {
@@ -52,7 +52,7 @@ function executeModuleFederationDevSSRBuilder(schema, context) {
52
52
  const runOptions = {};
53
53
  if (options.verbose) {
54
54
  const [collection, executor] = workspaceProjects[remote].targets[target].executor.split(':');
55
- const { schema } = ws.readExecutor(collection, executor);
55
+ const { schema } = (0, executor_utils_1.getExecutorInformation)(collection, executor, devkit_1.workspaceRoot);
56
56
  if (schema.additionalProperties || 'verbose' in schema.properties) {
57
57
  runOptions.verbose = options.verbose;
58
58
  }
@@ -4,6 +4,7 @@ exports.validateDevRemotes = exports.getStaticRemotes = exports.getDynamicRemote
4
4
  const path_1 = require("path");
5
5
  const fs_1 = require("fs");
6
6
  const devkit_1 = require("@nx/devkit");
7
+ const tsnode_register_1 = require("@nx/js/src/utils/typescript/tsnode-register");
7
8
  function getDynamicRemotes(project, context, workspaceProjects, remotesToSkip, pathToManifestFile = (0, path_1.join)(context.workspaceRoot, project.sourceRoot, 'assets/module-federation.manifest.json')) {
8
9
  // check for dynamic remotes
9
10
  // we should only check for dynamic based on what we generate
@@ -40,15 +41,27 @@ function getDynamicRemotes(project, context, workspaceProjects, remotesToSkip, p
40
41
  return dynamicRemotes;
41
42
  }
42
43
  exports.getDynamicRemotes = getDynamicRemotes;
43
- function getStaticRemotes(project, context, workspaceProjects, remotesToSkip) {
44
- const mfConfigPath = (0, path_1.join)(context.workspaceRoot, project.root, 'module-federation.config.js');
45
- let mfeConfig;
44
+ function getModuleFederationConfig(tsconfigPath, workspaceRoot, projectRoot) {
45
+ const moduleFederationConfigPathJS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.js');
46
+ const moduleFederationConfigPathTS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.ts');
47
+ let moduleFederationConfigPath = moduleFederationConfigPathJS;
48
+ if ((0, fs_1.existsSync)(moduleFederationConfigPathTS)) {
49
+ (0, tsnode_register_1.tsNodeRegister)(moduleFederationConfigPathTS, tsconfigPath);
50
+ moduleFederationConfigPath = moduleFederationConfigPathTS;
51
+ }
46
52
  try {
47
- mfeConfig = require(mfConfigPath);
53
+ const config = require(moduleFederationConfigPath);
54
+ return {
55
+ mfeConfig: config.default || config,
56
+ mfConfigPath: moduleFederationConfigPath,
57
+ };
48
58
  }
49
59
  catch (_a) {
50
- throw new Error(`Could not load ${mfConfigPath}. Was this project generated with "@nx/angular:host"?`);
60
+ throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/angular:host"?`);
51
61
  }
62
+ }
63
+ function getStaticRemotes(project, context, workspaceProjects, remotesToSkip) {
64
+ const { mfeConfig, mfConfigPath } = getModuleFederationConfig(project.targets.build.options.tsConfig, context.workspaceRoot, project.root);
52
65
  const remotesConfig = Array.isArray(mfeConfig.remotes) && mfeConfig.remotes.length > 0
53
66
  ? mfeConfig.remotes
54
67
  : [];
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveIndexHtmlTransformer = exports.resolveCustomWebpackConfig = exports.mergeCustomWebpackConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const webpack_merge_1 = require("webpack-merge");
6
+ const tsnode_register_1 = require("@nx/js/src/utils/typescript/tsnode-register");
6
7
  function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, options, target) {
7
8
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
9
  const customWebpackConfiguration = resolveCustomWebpackConfig(pathToWebpackConfig, options.tsConfig);
@@ -23,7 +24,7 @@ function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, option
23
24
  exports.mergeCustomWebpackConfig = mergeCustomWebpackConfig;
24
25
  function resolveCustomWebpackConfig(path, tsConfig) {
25
26
  var _a;
26
- tsNodeRegister(path, tsConfig);
27
+ (0, tsnode_register_1.tsNodeRegister)(path, tsConfig);
27
28
  const customWebpackConfig = require(path);
28
29
  // If the user provides a configuration in TS file
29
30
  // then there are 2 cases for exporting an object. The first one is:
@@ -35,29 +36,9 @@ function resolveCustomWebpackConfig(path, tsConfig) {
35
36
  exports.resolveCustomWebpackConfig = resolveCustomWebpackConfig;
36
37
  function resolveIndexHtmlTransformer(path, tsConfig, target) {
37
38
  var _a;
38
- tsNodeRegister(path, tsConfig);
39
+ (0, tsnode_register_1.tsNodeRegister)(path, tsConfig);
39
40
  const indexTransformer = require(path);
40
41
  const transform = (_a = indexTransformer.default) !== null && _a !== void 0 ? _a : indexTransformer;
41
42
  return (indexHtml) => transform(target, indexHtml);
42
43
  }
43
44
  exports.resolveIndexHtmlTransformer = resolveIndexHtmlTransformer;
44
- function tsNodeRegister(file, tsConfig) {
45
- if (!(file === null || file === void 0 ? void 0 : file.endsWith('.ts')))
46
- return;
47
- // Register TS compiler lazily
48
- require('ts-node').register({
49
- project: tsConfig,
50
- compilerOptions: {
51
- module: 'CommonJS',
52
- types: ['node'],
53
- },
54
- });
55
- if (!tsConfig)
56
- return;
57
- // Register paths in tsConfig
58
- const tsconfigPaths = require('tsconfig-paths');
59
- const { absoluteBaseUrl: baseUrl, paths } = tsconfigPaths.loadConfig(tsConfig);
60
- if (baseUrl && paths) {
61
- tsconfigPaths.register({ baseUrl, paths });
62
- }
63
- }
@@ -14,7 +14,7 @@ function generateStorybookConfiguration(tree, options) {
14
14
  linter: options.linter,
15
15
  cypressDirectory: options.cypressDirectory,
16
16
  tsConfiguration: options.tsConfiguration,
17
- configureTestRunner: options.configureTestRunner,
17
+ interactionTests: options.interactionTests,
18
18
  configureStaticServe: options.configureStaticServe,
19
19
  skipFormat: true,
20
20
  });
@@ -11,5 +11,5 @@ export interface StorybookConfigurationOptions {
11
11
  tsConfiguration?: boolean;
12
12
  skipFormat?: boolean;
13
13
  ignorePaths?: string[];
14
- configureTestRunner?: boolean;
14
+ interactionTests?: boolean;
15
15
  }
@@ -18,12 +18,18 @@
18
18
  "x-dropdown": "projects",
19
19
  "x-priority": "important"
20
20
  },
21
+ "interactionTests": {
22
+ "type": "boolean",
23
+ "description": "Set up Storybook interaction tests.",
24
+ "x-prompt": "Do you want to set up Storybook interaction tests?",
25
+ "alias": ["configureTestRunner"],
26
+ "x-priority": "important",
27
+ "default": true
28
+ },
21
29
  "configureCypress": {
22
30
  "type": "boolean",
23
31
  "description": "Specifies whether to configure Cypress or not.",
24
- "x-prompt": "Configure a Cypress e2e app to run against the storybook instance?",
25
- "default": true,
26
- "x-priority": "important"
32
+ "x-deprecated": "Please use Storybook interaction tests instead."
27
33
  },
28
34
  "generateStories": {
29
35
  "type": "boolean",
@@ -35,9 +41,7 @@
35
41
  "generateCypressSpecs": {
36
42
  "type": "boolean",
37
43
  "description": "Specifies whether to automatically generate test files in the generated Cypress e2e app.",
38
- "x-prompt": "Automatically generate test files in the generated Cypress e2e app?",
39
- "default": true,
40
- "x-priority": "important"
44
+ "x-deprecated": "Please use Storybook interaction tests instead."
41
45
  },
42
46
  "configureStaticServe": {
43
47
  "type": "boolean",
@@ -48,7 +52,8 @@
48
52
  },
49
53
  "cypressDirectory": {
50
54
  "type": "string",
51
- "description": "A directory where the Cypress project will be placed. Placed at the root by default."
55
+ "description": "A directory where the Cypress project will be placed. Placed at the root by default.",
56
+ "x-deprecated": "Please use Storybook interaction tests instead."
52
57
  },
53
58
  "linter": {
54
59
  "description": "The tool to use for running lint checks.",
@@ -59,7 +64,7 @@
59
64
  "tsConfiguration": {
60
65
  "type": "boolean",
61
66
  "description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
62
- "default": false,
67
+ "default": true,
63
68
  "x-priority": "important"
64
69
  },
65
70
  "skipFormat": {
@@ -82,10 +87,6 @@
82
87
  "**/**/src/**/*.other.*",
83
88
  "libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
84
89
  ]
85
- },
86
- "configureTestRunner": {
87
- "type": "boolean",
88
- "description": "Add a Storybook Test-Runner target."
89
90
  }
90
91
  },
91
92
  "additionalProperties": false,