@nx/angular 0.0.0-pr-29860-2cec332 → 0.0.0-pr-29464-ce11848
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 +0 -5
- package/migrations.json +46 -1
- package/package.json +8 -9
- package/src/utils/backward-compatible-versions.js +0 -2
- package/src/utils/versions.d.ts +1 -2
- package/src/utils/versions.js +2 -3
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +0 -4
- package/src/generators/convert-to-rspack/convert-to-rspack.js +0 -83
- package/src/generators/convert-to-rspack/lib/create-config.d.ts +0 -18
- package/src/generators/convert-to-rspack/lib/create-config.js +0 -70
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +0 -6
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +0 -75
- package/src/generators/convert-to-rspack/lib/update-tsconfig.d.ts +0 -2
- package/src/generators/convert-to-rspack/lib/update-tsconfig.js +0 -14
- package/src/generators/convert-to-rspack/schema.d.ts +0 -5
- package/src/generators/convert-to-rspack/schema.json +0 -32
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/migrations.json
CHANGED
|
@@ -1547,7 +1547,7 @@
|
|
|
1547
1547
|
"version": "20.5.0-beta.5",
|
|
1548
1548
|
"x-prompt": "Do you want to update the Angular version to v19.2?",
|
|
1549
1549
|
"requires": {
|
|
1550
|
-
"@angular/core": ">=19.
|
|
1550
|
+
"@angular/core": ">=19.1.0 <19.2.0"
|
|
1551
1551
|
},
|
|
1552
1552
|
"packages": {
|
|
1553
1553
|
"@angular-devkit/build-angular": {
|
|
@@ -1603,6 +1603,51 @@
|
|
|
1603
1603
|
"alwaysAddToPackageJson": false
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
+
},
|
|
1607
|
+
"20.5.0-angular-eslint": {
|
|
1608
|
+
"version": "20.5.0-rc.1",
|
|
1609
|
+
"requires": {
|
|
1610
|
+
"eslint": "^8.57.0 || ^9.0.0",
|
|
1611
|
+
"@angular/core": ">= 19.0.0 < 20.0.0"
|
|
1612
|
+
},
|
|
1613
|
+
"packages": {
|
|
1614
|
+
"angular-eslint": {
|
|
1615
|
+
"version": "^19.2.0",
|
|
1616
|
+
"alwaysAddToPackageJson": false
|
|
1617
|
+
},
|
|
1618
|
+
"@angular-eslint/eslint-plugin": {
|
|
1619
|
+
"version": "^19.2.0",
|
|
1620
|
+
"alwaysAddToPackageJson": false
|
|
1621
|
+
},
|
|
1622
|
+
"@angular-eslint/eslint-plugin-template": {
|
|
1623
|
+
"version": "^19.2.0",
|
|
1624
|
+
"alwaysAddToPackageJson": false
|
|
1625
|
+
},
|
|
1626
|
+
"@angular-eslint/template-parser": {
|
|
1627
|
+
"version": "^19.2.0",
|
|
1628
|
+
"alwaysAddToPackageJson": false
|
|
1629
|
+
},
|
|
1630
|
+
"@angular-eslint/utils": {
|
|
1631
|
+
"version": "^19.2.0",
|
|
1632
|
+
"alwaysAddToPackageJson": false
|
|
1633
|
+
},
|
|
1634
|
+
"@angular-eslint/schematics": {
|
|
1635
|
+
"version": "^19.2.0",
|
|
1636
|
+
"alwaysAddToPackageJson": false
|
|
1637
|
+
},
|
|
1638
|
+
"@angular-eslint/test-utils": {
|
|
1639
|
+
"version": "^19.2.0",
|
|
1640
|
+
"alwaysAddToPackageJson": false
|
|
1641
|
+
},
|
|
1642
|
+
"@angular-eslint/builder": {
|
|
1643
|
+
"version": "^19.2.0",
|
|
1644
|
+
"alwaysAddToPackageJson": false
|
|
1645
|
+
},
|
|
1646
|
+
"@angular-eslint/bundled-angular-compiler": {
|
|
1647
|
+
"version": "^19.2.0",
|
|
1648
|
+
"alwaysAddToPackageJson": false
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1606
1651
|
}
|
|
1607
1652
|
}
|
|
1608
1653
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-29464-ce11848",
|
|
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-
|
|
75
|
-
"@nx/js": "0.0.0-pr-
|
|
76
|
-
"@nx/eslint": "0.0.0-pr-
|
|
77
|
-
"@nx/webpack": "0.0.0-pr-
|
|
78
|
-
"@nx/
|
|
79
|
-
"@nx/
|
|
80
|
-
"@nx/
|
|
81
|
-
"@nx/workspace": "0.0.0-pr-29860-2cec332",
|
|
74
|
+
"@nx/devkit": "0.0.0-pr-29464-ce11848",
|
|
75
|
+
"@nx/js": "0.0.0-pr-29464-ce11848",
|
|
76
|
+
"@nx/eslint": "0.0.0-pr-29464-ce11848",
|
|
77
|
+
"@nx/webpack": "0.0.0-pr-29464-ce11848",
|
|
78
|
+
"@nx/module-federation": "0.0.0-pr-29464-ce11848",
|
|
79
|
+
"@nx/web": "0.0.0-pr-29464-ce11848",
|
|
80
|
+
"@nx/workspace": "0.0.0-pr-29464-ce11848",
|
|
82
81
|
"piscina": "^4.4.0"
|
|
83
82
|
},
|
|
84
83
|
"peerDependencies": {
|
|
@@ -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',
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export declare const nxVersion: any;
|
|
|
2
2
|
export declare const angularVersion = "~19.2.0";
|
|
3
3
|
export declare const angularDevkitVersion = "~19.2.0";
|
|
4
4
|
export declare const ngPackagrVersion = "~19.2.0";
|
|
5
|
-
export declare const ngRspackVersion = "~19.0.0-alpha.29";
|
|
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";
|
|
@@ -15,7 +14,7 @@ export declare const typesExpressVersion = "^4.17.21";
|
|
|
15
14
|
export declare const browserSyncVersion = "^3.0.0";
|
|
16
15
|
export declare const moduleFederationNodeVersion = "^2.6.26";
|
|
17
16
|
export declare const moduleFederationEnhancedVersion = "^0.9.0";
|
|
18
|
-
export declare const angularEslintVersion = "^19.0
|
|
17
|
+
export declare const angularEslintVersion = "^19.2.0";
|
|
19
18
|
export declare const typescriptEslintVersion = "^7.16.0";
|
|
20
19
|
export declare const tailwindVersion = "^3.0.2";
|
|
21
20
|
export declare const postcssVersion = "^8.4.5";
|
package/src/utils/versions.js
CHANGED
|
@@ -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.
|
|
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.2.0';
|
|
6
6
|
exports.angularDevkitVersion = '~19.2.0';
|
|
7
7
|
exports.ngPackagrVersion = '~19.2.0';
|
|
8
|
-
exports.ngRspackVersion = '~19.0.0-alpha.29';
|
|
9
8
|
exports.ngrxVersion = '^19.0.0';
|
|
10
9
|
exports.rxjsVersion = '~7.8.0';
|
|
11
10
|
exports.zoneJsVersion = '~0.15.0';
|
|
@@ -18,7 +17,7 @@ exports.typesExpressVersion = '^4.17.21';
|
|
|
18
17
|
exports.browserSyncVersion = '^3.0.0';
|
|
19
18
|
exports.moduleFederationNodeVersion = '^2.6.26';
|
|
20
19
|
exports.moduleFederationEnhancedVersion = '^0.9.0';
|
|
21
|
-
exports.angularEslintVersion = '^19.0
|
|
20
|
+
exports.angularEslintVersion = '^19.2.0';
|
|
22
21
|
exports.typescriptEslintVersion = '^7.16.0';
|
|
23
22
|
exports.tailwindVersion = '^3.0.2';
|
|
24
23
|
exports.postcssVersion = '^8.4.5';
|
|
@@ -1,83 +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
|
-
const update_tsconfig_1 = require("./lib/update-tsconfig");
|
|
9
|
-
async function convertToRspack(tree, schema) {
|
|
10
|
-
const { project: projectName } = schema;
|
|
11
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
12
|
-
const tasks = [];
|
|
13
|
-
const createConfigOptions = {
|
|
14
|
-
root: project.root,
|
|
15
|
-
};
|
|
16
|
-
const buildTargetNames = [];
|
|
17
|
-
let customWebpackConfigPath;
|
|
18
|
-
for (const [targetName, target] of Object.entries(project.targets)) {
|
|
19
|
-
if (target.executor === '@angular-devkit/build-angular:browser' ||
|
|
20
|
-
target.executor === '@nx/angular:webpack-browser') {
|
|
21
|
-
createConfigOptions.browser = target.options.main;
|
|
22
|
-
createConfigOptions.index = target.options.index;
|
|
23
|
-
createConfigOptions.assets = target.options.assets.map((asset) => {
|
|
24
|
-
if (typeof asset === 'string') {
|
|
25
|
-
return asset;
|
|
26
|
-
}
|
|
27
|
-
return asset.input;
|
|
28
|
-
});
|
|
29
|
-
createConfigOptions.styles = target.options.styles;
|
|
30
|
-
createConfigOptions.scripts = target.options.scripts;
|
|
31
|
-
createConfigOptions.polyfills = target.options.polyfills;
|
|
32
|
-
createConfigOptions.tsconfigPath = target.options.tsConfig;
|
|
33
|
-
createConfigOptions.jit =
|
|
34
|
-
target.options.aot === undefined ? false : !target.options.aot;
|
|
35
|
-
createConfigOptions.inlineStylesExtension =
|
|
36
|
-
target.options.inlineStyleLanguage === undefined
|
|
37
|
-
? 'css'
|
|
38
|
-
: target.options.inlineStyleLanguage;
|
|
39
|
-
createConfigOptions.fileReplacements = target.options.fileReplacements;
|
|
40
|
-
createConfigOptions.stylePreprocessorOptions =
|
|
41
|
-
target.options.stylePreprocessorOptions;
|
|
42
|
-
if (target.options.customWebpackConfig) {
|
|
43
|
-
customWebpackConfigPath = target.options.customWebpackConfig.path;
|
|
44
|
-
}
|
|
45
|
-
// TODO: Add more options that can be correctly mapped
|
|
46
|
-
buildTargetNames.push(targetName);
|
|
47
|
-
}
|
|
48
|
-
else if (target.executor === '@angular-devkit/build-angular:dev-server' ||
|
|
49
|
-
target.executor === '@nx/angular:dev-server' ||
|
|
50
|
-
target.executor === '@nx/angular:module-federation-dev-server') {
|
|
51
|
-
const port = target.options.port ?? 4200;
|
|
52
|
-
project[targetName] = {
|
|
53
|
-
options: {
|
|
54
|
-
port,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const customWebpackConfigInfo = customWebpackConfigPath
|
|
60
|
-
? await (0, get_custom_webpack_config_1.getCustomWebpackConfig)(tree, project.root, customWebpackConfigPath)
|
|
61
|
-
: undefined;
|
|
62
|
-
(0, create_config_1.createConfig)(tree, createConfigOptions, customWebpackConfigInfo?.normalizedPathToCustomWebpackConfig, customWebpackConfigInfo?.isWebpackConfigFunction);
|
|
63
|
-
(0, update_tsconfig_1.updateTsconfig)(tree, project.root);
|
|
64
|
-
for (const targetName of buildTargetNames) {
|
|
65
|
-
delete project.targets[targetName];
|
|
66
|
-
}
|
|
67
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
68
|
-
const { rspackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
|
|
69
|
-
await rspackInitGenerator(tree, {
|
|
70
|
-
addPlugin: true,
|
|
71
|
-
});
|
|
72
|
-
if (!schema.skipInstall) {
|
|
73
|
-
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
74
|
-
'@ng-rspack/build': versions_1.ngRspackVersion,
|
|
75
|
-
});
|
|
76
|
-
tasks.push(installTask);
|
|
77
|
-
}
|
|
78
|
-
if (!schema.skipFormat) {
|
|
79
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
80
|
-
}
|
|
81
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
82
|
-
}
|
|
83
|
-
exports.default = convertToRspack;
|
|
@@ -1,18 +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
|
-
stylePreprocessorOptions?: Record<string, unknown>;
|
|
17
|
-
}
|
|
18
|
-
export declare function createConfig(tree: Tree, opts: Partial<CreateConfigOptions>, existingWebpackConfigPath?: string, isExistingWebpackConfigFunction?: boolean): void;
|
|
@@ -1,70 +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 = `import { resolve } from 'path';
|
|
7
|
-
import { createConfig }from '@ng-rspack/build';
|
|
8
|
-
${existingWebpackConfigPath
|
|
9
|
-
? `import baseWebpackConfig from '${existingWebpackConfigPath}';
|
|
10
|
-
${isExistingWebpackConfigFunction
|
|
11
|
-
? ''
|
|
12
|
-
: `import webpackMerge from 'webpack-merge';`}`
|
|
13
|
-
: ''}
|
|
14
|
-
|
|
15
|
-
${existingWebpackConfigPath ? 'const baseConfig = ' : 'export default '}createConfig({
|
|
16
|
-
root: __dirname,
|
|
17
|
-
index: '${normalizeFromProjectRoot(opts.index, opts.root)}',
|
|
18
|
-
browser: '${normalizeFromProjectRoot(opts.browser, opts.root)}',
|
|
19
|
-
${opts.server
|
|
20
|
-
? `server: '${normalizeFromProjectRoot(opts.server, opts.root)}',`
|
|
21
|
-
: ''}
|
|
22
|
-
${opts.ssrEntry
|
|
23
|
-
? `ssrEntry: '${normalizeFromProjectRoot(opts.ssrEntry, opts.root)}',`
|
|
24
|
-
: ''}
|
|
25
|
-
tsconfigPath: resolve(__dirname, '${normalizeFromProjectRoot(opts.tsconfigPath, opts.root)}'),
|
|
26
|
-
polyfills: ${JSON.stringify(opts.polyfills)},
|
|
27
|
-
assets: ${JSON.stringify(opts.assets.map((a) => normalizeFromProjectRoot(a, opts.root)))},
|
|
28
|
-
styles: ${JSON.stringify(opts.styles.map((s) => normalizeFromProjectRoot(s, opts.root)))},
|
|
29
|
-
scripts: ${JSON.stringify(opts.scripts.map((s) => normalizeFromProjectRoot(s, opts.root)))},
|
|
30
|
-
jit: ${opts.jit},
|
|
31
|
-
${opts.inlineStylesExtension
|
|
32
|
-
? `inlineStylesExtension: '${opts.inlineStylesExtension}'`
|
|
33
|
-
: ''},
|
|
34
|
-
fileReplacements: ${JSON.stringify(opts.fileReplacements ?? [])},${opts.stylePreprocessorOptions !== undefined
|
|
35
|
-
? `
|
|
36
|
-
stylePreprocessorOptions: ${JSON.stringify(opts.stylePreprocessorOptions)},`
|
|
37
|
-
: ''}
|
|
38
|
-
hasServer: ${opts.server || opts.ssrEntry ? true : false},
|
|
39
|
-
skipTypeChecking: false,
|
|
40
|
-
});
|
|
41
|
-
${existingWebpackConfigPath
|
|
42
|
-
? `
|
|
43
|
-
export default ${isExistingWebpackConfigFunction
|
|
44
|
-
? `async function (env, argv) {
|
|
45
|
-
const oldConfig = await baseWebpackConfig;
|
|
46
|
-
const browserConfig = baseConfig[0];
|
|
47
|
-
return oldConfig(browserConfig);`
|
|
48
|
-
: 'webpackMerge(baseConfig[0], baseWebpackConfig)'}
|
|
49
|
-
`
|
|
50
|
-
: ''}
|
|
51
|
-
`;
|
|
52
|
-
tree.write((0, devkit_1.joinPathFragments)(opts.root, 'rspack.config.ts'), configContents);
|
|
53
|
-
}
|
|
54
|
-
function normalizeFromProjectRoot(path, projectRoot) {
|
|
55
|
-
if (projectRoot === '.') {
|
|
56
|
-
if (!path.startsWith('./')) {
|
|
57
|
-
return `./${path}`;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
return path;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else if (path.startsWith(projectRoot)) {
|
|
64
|
-
return path.replace(projectRoot, '.');
|
|
65
|
-
}
|
|
66
|
-
else if (!path.startsWith('./')) {
|
|
67
|
-
return `./${path}`;
|
|
68
|
-
}
|
|
69
|
-
return path;
|
|
70
|
-
}
|
|
@@ -1,6 +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
|
-
}>;
|
|
6
|
-
export declare function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents: string): string;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCustomWebpackConfig = getCustomWebpackConfig;
|
|
4
|
-
exports.convertWebpackConfigToUseNxModuleFederationPlugin = convertWebpackConfigToUseNxModuleFederationPlugin;
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
9
|
-
const FILE_EXTENSION_REGEX = /\.[^.]+$/;
|
|
10
|
-
async function getCustomWebpackConfig(tree, projectRoot, pathToCustomWebpackConfig) {
|
|
11
|
-
const webpackConfigContents = tree.read(pathToCustomWebpackConfig, 'utf-8');
|
|
12
|
-
if (webpackConfigContents.includes('@nx/module-federation/angular') &&
|
|
13
|
-
webpackConfigContents.includes('withModuleFederation')) {
|
|
14
|
-
tree.write(pathToCustomWebpackConfig, convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents));
|
|
15
|
-
return {
|
|
16
|
-
isWebpackConfigFunction: false,
|
|
17
|
-
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const configFile = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(tree.root, pathToCustomWebpackConfig));
|
|
21
|
-
const webpackConfig = 'default' in configFile ? configFile.default : configFile;
|
|
22
|
-
return {
|
|
23
|
-
isWebpackConfigFunction: typeof webpackConfig === 'function',
|
|
24
|
-
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents) {
|
|
28
|
-
let newWebpackConfigContents = webpackConfigContents;
|
|
29
|
-
let ast = tsquery_1.tsquery.ast(webpackConfigContents);
|
|
30
|
-
const withModuleFederationImportNodes = (0, tsquery_1.tsquery)(ast, 'ImportDeclaration:has(StringLiteral[value=@nx/module-federation/angular])');
|
|
31
|
-
if (withModuleFederationImportNodes.length > 0) {
|
|
32
|
-
const withModuleFederationImportNode = withModuleFederationImportNodes[0];
|
|
33
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin } from '@nx/module-federation/rspack';${webpackConfigContents.slice(withModuleFederationImportNode.getEnd())}`;
|
|
34
|
-
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
|
35
|
-
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExportAssignment:has(CallExpression > Identifier[name=withModuleFederation])');
|
|
36
|
-
if (exportedWithModuleFederationNodes.length > 0) {
|
|
37
|
-
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
|
38
|
-
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
|
39
|
-
export default {
|
|
40
|
-
plugins: [
|
|
41
|
-
new NxModuleFederationPlugin(config, {
|
|
42
|
-
dts: false,
|
|
43
|
-
}),
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
devkit_1.logger.warn("Could not find 'export default withModuleFederation' in the webpack config file. Skipping conversion.");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const withModuleFederationRequireNodes = (0, tsquery_1.tsquery)(ast, 'VariableStatement:has(CallExpression > Identifier[name=withModuleFederation], StringLiteral[value=@nx/module-federation/angular])');
|
|
53
|
-
if (withModuleFederationRequireNodes.length > 0) {
|
|
54
|
-
const withModuleFederationRequireNode = withModuleFederationRequireNodes[0];
|
|
55
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationRequireNode.getStart())}const { NxModuleFederationPlugin } = require('@nx/module-federation/rspack');${webpackConfigContents.slice(withModuleFederationRequireNode.getEnd())}`;
|
|
56
|
-
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
|
57
|
-
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExpressionStatement:has(BinaryExpression > PropertyAccessExpression:has(Identifier[name=module], Identifier[name=exports]), CallExpression:has(Identifier[name=withModuleFederation]))');
|
|
58
|
-
if (exportedWithModuleFederationNodes.length > 0) {
|
|
59
|
-
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
|
60
|
-
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
|
61
|
-
module.exports = {
|
|
62
|
-
plugins: [
|
|
63
|
-
new NxModuleFederationPlugin({ config }, {
|
|
64
|
-
dts: false,
|
|
65
|
-
}),
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
devkit_1.logger.warn("Could not find 'module.exports = withModuleFederation' in the webpack config file. Skipping conversion.");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return newWebpackConfigContents;
|
|
75
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateTsconfig = updateTsconfig;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function updateTsconfig(tree, projectRoot) {
|
|
6
|
-
const tsconfigPath = (0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.json');
|
|
7
|
-
const tsconfig = (0, devkit_1.readJson)(tree, tsconfigPath);
|
|
8
|
-
tsconfig['ts-node'] = {
|
|
9
|
-
compilerOptions: {
|
|
10
|
-
module: 'CommonJS',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
(0, devkit_1.writeJson)(tree, tsconfigPath, tsconfig);
|
|
14
|
-
}
|
|
@@ -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
|
-
}
|