@nx/angular 0.0.0-pr-29860-74361a9 → 0.0.0-pr-29464-c4b160c

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/generators.json CHANGED
@@ -38,11 +38,6 @@
38
38
  "schema": "./src/generators/convert-to-application-executor/schema.json",
39
39
  "description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder."
40
40
  },
41
- "convert-to-rspack": {
42
- "factory": "./src/generators/convert-to-rspack/convert-to-rspack",
43
- "schema": "./src/generators/convert-to-rspack/schema.json",
44
- "description": "Converts Angular Webpack projects to use Rspack."
45
- },
46
41
  "directive": {
47
42
  "factory": "./src/generators/directive/directive",
48
43
  "schema": "./src/generators/directive/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "0.0.0-pr-29860-74361a9",
3
+ "version": "0.0.0-pr-29464-c4b160c",
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, Playwright 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- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -71,14 +71,13 @@
71
71
  "semver": "^7.5.3",
72
72
  "tslib": "^2.3.0",
73
73
  "webpack-merge": "^5.8.0",
74
- "@nx/devkit": "0.0.0-pr-29860-74361a9",
75
- "@nx/js": "0.0.0-pr-29860-74361a9",
76
- "@nx/eslint": "0.0.0-pr-29860-74361a9",
77
- "@nx/webpack": "0.0.0-pr-29860-74361a9",
78
- "@nx/rspack": "0.0.0-pr-29860-74361a9",
79
- "@nx/module-federation": "0.0.0-pr-29860-74361a9",
80
- "@nx/web": "0.0.0-pr-29860-74361a9",
81
- "@nx/workspace": "0.0.0-pr-29860-74361a9",
74
+ "@nx/devkit": "0.0.0-pr-29464-c4b160c",
75
+ "@nx/js": "0.0.0-pr-29464-c4b160c",
76
+ "@nx/eslint": "0.0.0-pr-29464-c4b160c",
77
+ "@nx/webpack": "0.0.0-pr-29464-c4b160c",
78
+ "@nx/module-federation": "0.0.0-pr-29464-c4b160c",
79
+ "@nx/web": "0.0.0-pr-29464-c4b160c",
80
+ "@nx/workspace": "0.0.0-pr-29464-c4b160c",
82
81
  "piscina": "^4.4.0"
83
82
  },
84
83
  "peerDependencies": {
@@ -1,4 +1,4 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  import type { AngularProjectConfiguration } from '../../../utils/types';
3
3
  import type { NormalizedSchema } from './normalized-schema';
4
- export declare function addProject(tree: Tree, libraryOptions: NormalizedSchema['libraryOptions']): AngularProjectConfiguration;
4
+ export declare function addProject(tree: Tree, libraryOptions: NormalizedSchema['libraryOptions']): Promise<AngularProjectConfiguration>;
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = addProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
6
- function addProject(tree, libraryOptions) {
6
+ const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
7
+ async function addProject(tree, libraryOptions) {
7
8
  const project = {
8
9
  name: libraryOptions.name,
9
10
  root: libraryOptions.projectRoot,
@@ -34,6 +35,9 @@ function addProject(tree, libraryOptions) {
34
35
  },
35
36
  defaultConfiguration: 'production',
36
37
  };
38
+ if (libraryOptions.publishable) {
39
+ await (0, add_release_config_1.addReleaseConfigForNonTsSolution)(tree, libraryOptions.name, project);
40
+ }
37
41
  }
38
42
  (0, devkit_1.addProjectConfiguration)(tree, libraryOptions.name, project);
39
43
  return project;
@@ -25,6 +25,7 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
25
25
  const test_runners_1 = require("../../utils/test-runners");
26
26
  const add_vitest_1 = require("../utils/add-vitest");
27
27
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
28
+ const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
28
29
  async function libraryGenerator(tree, schema) {
29
30
  (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'library');
30
31
  // Do some validation checks
@@ -49,7 +50,7 @@ async function libraryGenerator(tree, schema) {
49
50
  if (!libraryOptions.skipPackageJson) {
50
51
  (0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
51
52
  }
52
- const project = (0, add_project_1.addProject)(tree, libraryOptions);
53
+ const project = await (0, add_project_1.addProject)(tree, libraryOptions);
53
54
  (0, create_files_1.createFiles)(tree, options, project);
54
55
  (0, update_tsconfig_1.updateTsConfig)(tree, libraryOptions);
55
56
  await addUnitTestRunner(tree, libraryOptions);
@@ -76,6 +77,9 @@ async function libraryGenerator(tree, schema) {
76
77
  'ng-packagr': pkgVersions.ngPackagrVersion,
77
78
  }, undefined, true);
78
79
  (0, dependencies_1.addBuildableLibrariesPostCssDependencies)(tree);
80
+ if (libraryOptions.publishable) {
81
+ await (0, add_release_config_1.releaseTasks)(tree);
82
+ }
79
83
  }
80
84
  (0, js_1.addTsConfigPath)(tree, libraryOptions.importPath, [
81
85
  (0, devkit_1.joinPathFragments)(libraryOptions.projectRoot, './src', 'index.ts'),
@@ -6,7 +6,6 @@ exports.backwardCompatibleVersions = {
6
6
  angularVersion: '~17.3.0',
7
7
  angularDevkitVersion: '~17.3.0',
8
8
  ngPackagrVersion: '~17.3.0',
9
- ngRspackVersion: '~19.0.0-alpha.26',
10
9
  ngrxVersion: '~17.0.0',
11
10
  rxjsVersion: '~7.8.0',
12
11
  zoneJsVersion: '~0.14.3',
@@ -34,7 +33,6 @@ exports.backwardCompatibleVersions = {
34
33
  angularVersion: '~18.2.0',
35
34
  angularDevkitVersion: '~18.2.0',
36
35
  ngPackagrVersion: '~18.2.0',
37
- ngRspackVersion: '~19.0.0-alpha.26',
38
36
  ngrxVersion: '~18.0.2',
39
37
  rxjsVersion: '~7.8.0',
40
38
  zoneJsVersion: '~0.14.3',
@@ -2,7 +2,6 @@ export declare const nxVersion: any;
2
2
  export declare const angularVersion = "~19.1.0";
3
3
  export declare const angularDevkitVersion = "~19.1.0";
4
4
  export declare const ngPackagrVersion = "~19.1.0";
5
- export declare const ngRspackVersion = "~19.0.0-alpha.26";
6
5
  export declare const ngrxVersion = "^19.0.0";
7
6
  export declare const rxjsVersion = "~7.8.0";
8
7
  export declare const zoneJsVersion = "~0.15.0";
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngRspackVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
3
+ exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
5
  exports.angularVersion = '~19.1.0';
6
6
  exports.angularDevkitVersion = '~19.1.0';
7
7
  exports.ngPackagrVersion = '~19.1.0';
8
- exports.ngRspackVersion = '~19.0.0-alpha.26';
9
8
  exports.ngrxVersion = '^19.0.0';
10
9
  exports.rxjsVersion = '~7.8.0';
11
10
  exports.zoneJsVersion = '~0.15.0';
@@ -1,4 +0,0 @@
1
- import { type Tree, GeneratorCallback } from '@nx/devkit';
2
- import type { ConvertToRspackSchema } from './schema';
3
- export declare function convertToRspack(tree: Tree, schema: ConvertToRspackSchema): Promise<GeneratorCallback>;
4
- export default convertToRspack;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToRspack = convertToRspack;
4
- const devkit_1 = require("@nx/devkit");
5
- const versions_1 = require("../../utils/versions");
6
- const create_config_1 = require("./lib/create-config");
7
- const get_custom_webpack_config_1 = require("./lib/get-custom-webpack-config");
8
- async function convertToRspack(tree, schema) {
9
- const { project: projectName } = schema;
10
- const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
11
- const tasks = [];
12
- const createConfigOptions = {
13
- root: project.root,
14
- };
15
- const buildAndServeTargetNames = [];
16
- let customWebpackConfigPath;
17
- for (const [targetName, target] of Object.entries(project.targets)) {
18
- if (target.executor === '@angular-devkit/build-angular:browser' ||
19
- target.executor === '@nx/angular:webpack-browser') {
20
- createConfigOptions.browser = target.options.main;
21
- createConfigOptions.index = target.options.index;
22
- createConfigOptions.assets = target.options.assets.map((asset) => {
23
- if (typeof asset === 'string') {
24
- return asset;
25
- }
26
- return asset.input;
27
- });
28
- createConfigOptions.styles = target.options.styles;
29
- createConfigOptions.scripts = target.options.scripts;
30
- createConfigOptions.polyfills = target.options.polyfills;
31
- createConfigOptions.tsconfigPath = target.options.tsConfig;
32
- createConfigOptions.jit =
33
- target.options.aot === undefined ? false : !target.options.aot;
34
- createConfigOptions.inlineStylesExtension =
35
- target.options.inlineStyleLanguage === undefined
36
- ? 'css'
37
- : target.options.inlineStyleLanguage;
38
- if (target.options.customWebpackConfig) {
39
- customWebpackConfigPath = target.options.customWebpackConfig.path;
40
- }
41
- // TODO: Add more options that can be correctly mapped
42
- buildAndServeTargetNames.push(targetName);
43
- }
44
- else if (target.executor === '@angular-devkit/build-angular:dev-server' ||
45
- target.executor === '@nx/angular:dev-server') {
46
- buildAndServeTargetNames.push(targetName);
47
- }
48
- }
49
- const customWebpackConfigInfo = customWebpackConfigPath
50
- ? await (0, get_custom_webpack_config_1.getCustomWebpackConfig)(tree, project.root, customWebpackConfigPath)
51
- : undefined;
52
- (0, create_config_1.createConfig)(tree, createConfigOptions, customWebpackConfigInfo?.normalizedPathToCustomWebpackConfig, customWebpackConfigInfo?.isWebpackConfigFunction);
53
- for (const targetName of buildAndServeTargetNames) {
54
- delete project.targets[targetName];
55
- }
56
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
57
- const { rspackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
58
- await rspackInitGenerator(tree, {
59
- addPlugin: true,
60
- });
61
- if (!schema.skipInstall) {
62
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
63
- '@ng-rspack/build': versions_1.ngRspackVersion,
64
- });
65
- tasks.push(installTask);
66
- }
67
- if (!schema.skipFormat) {
68
- await (0, devkit_1.formatFiles)(tree);
69
- }
70
- return (0, devkit_1.runTasksInSerial)(...tasks);
71
- }
72
- exports.default = convertToRspack;
@@ -1,17 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export interface CreateConfigOptions {
3
- root: string;
4
- index: string;
5
- browser: string;
6
- server?: string;
7
- ssrEntry?: string;
8
- polyfills: string[];
9
- tsconfigPath: string;
10
- assets: string[];
11
- styles: string[];
12
- scripts: string[];
13
- jit?: boolean;
14
- inlineStylesExtension?: string;
15
- fileReplacements?: string[];
16
- }
17
- export declare function createConfig(tree: Tree, opts: Partial<CreateConfigOptions>, existingWebpackConfigPath?: string, isExistingWebpackConfigFunction?: boolean): void;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createConfig = createConfig;
4
- const devkit_1 = require("@nx/devkit");
5
- function createConfig(tree, opts, existingWebpackConfigPath, isExistingWebpackConfigFunction) {
6
- const configContents = `const { createConfig } = require('@ng-rspack/build');
7
- ${existingWebpackConfigPath
8
- ? `const baseWebpackConfig = require('${existingWebpackConfigPath}');
9
- ${isExistingWebpackConfigFunction
10
- ? ''
11
- : `const webpackMerge = require('webpack-merge');`}`
12
- : ''}
13
-
14
- ${existingWebpackConfigPath ? 'const baseConfig' : 'module.exports'} = createConfig({
15
- root: __dirname,
16
- index: '${normalizeFromProjectRoot(opts.index, opts.root)}',
17
- browser: '${normalizeFromProjectRoot(opts.browser, opts.root)}',
18
- ${opts.server
19
- ? `server: '${normalizeFromProjectRoot(opts.server, opts.root)}',`
20
- : ''}
21
- ${opts.ssrEntry
22
- ? `ssrEntry: '${normalizeFromProjectRoot(opts.ssrEntry, opts.root)}',`
23
- : ''}
24
- tsconfigPath: '${normalizeFromProjectRoot(opts.tsconfigPath, opts.root)}',
25
- polyfills: ${JSON.stringify(opts.polyfills)},
26
- assets: ${JSON.stringify(opts.assets.map((a) => normalizeFromProjectRoot(a, opts.root)))},
27
- styles: ${JSON.stringify(opts.styles.map((s) => normalizeFromProjectRoot(s, opts.root)))},
28
- scripts: ${JSON.stringify(opts.scripts.map((s) => normalizeFromProjectRoot(s, opts.root)))},
29
- jit: ${opts.jit},
30
- ${opts.inlineStylesExtension
31
- ? `inlineStylesExtension: '${opts.inlineStylesExtension}'`
32
- : ''},
33
- fileReplacements: ${JSON.stringify(opts.fileReplacements ?? [])},
34
- hasServer: ${opts.server || opts.ssrEntry ? true : false},
35
- skipTypeChecking: false,
36
- });
37
- ${existingWebpackConfigPath
38
- ? `
39
- module.exports = ${isExistingWebpackConfigFunction
40
- ? 'baseWebpackConfig(baseConfig)'
41
- : 'webpackMerge(baseConfig, baseWebpackConfig)'}
42
- `
43
- : ''}
44
- `;
45
- tree.write((0, devkit_1.joinPathFragments)(opts.root, 'rspack.config.ts'), configContents);
46
- }
47
- function normalizeFromProjectRoot(path, projectRoot) {
48
- if (projectRoot === '.') {
49
- if (!path.startsWith('./')) {
50
- return `./${path}`;
51
- }
52
- else {
53
- return path;
54
- }
55
- }
56
- else if (path.startsWith(projectRoot)) {
57
- return path.replace(projectRoot, '.');
58
- }
59
- else if (!path.startsWith('./')) {
60
- return `./${path}`;
61
- }
62
- return path;
63
- }
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function getCustomWebpackConfig(tree: Tree, projectRoot: string, pathToCustomWebpackConfig: string): Promise<{
3
- isWebpackConfigFunction: boolean;
4
- normalizedPathToCustomWebpackConfig: string;
5
- }>;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCustomWebpackConfig = getCustomWebpackConfig;
4
- const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
5
- const path_1 = require("path");
6
- const FILE_EXTENSION_REGEX = /\.[^.]+$/;
7
- async function getCustomWebpackConfig(tree, projectRoot, pathToCustomWebpackConfig) {
8
- const configFile = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(tree.root, pathToCustomWebpackConfig));
9
- const webpackConfig = 'default' in configFile ? configFile.default : configFile;
10
- return {
11
- isWebpackConfigFunction: typeof webpackConfig === 'function',
12
- normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
13
- };
14
- }
@@ -1,5 +0,0 @@
1
- export interface ConvertToRspackSchema {
2
- project: string;
3
- skipFormat?: boolean;
4
- skipInstall?: boolean;
5
- }
@@ -1,32 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "GeneratorNxApp",
4
- "title": "Creates an Angular application.",
5
- "description": "Creates an Angular application.",
6
- "type": "object",
7
- "cli": "nx",
8
- "properties": {
9
- "project": {
10
- "type": "string",
11
- "aliases": ["name", "projectName"],
12
- "description": "Project for which to convert to rspack.",
13
- "$default": {
14
- "$source": "argv",
15
- "index": 0
16
- },
17
- "x-prompt": "Which project do you want to convert to rspack?",
18
- "x-dropdown": "projects",
19
- "x-priority": "important"
20
- },
21
- "skipFormat": {
22
- "description": "Skip formatting files.",
23
- "type": "boolean",
24
- "default": false
25
- },
26
- "skipInstall": {
27
- "description": "Skip installing dependencies.",
28
- "type": "boolean",
29
- "default": false
30
- }
31
- }
32
- }