@nrwl/angular 13.10.0-beta.7 → 13.10.0-beta.8

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.
Files changed (73) hide show
  1. package/esm2020/mfe/index.mjs +2 -2
  2. package/fesm2015/nrwl-angular-mfe.mjs +1 -1
  3. package/fesm2015/nrwl-angular-testing.mjs.map +1 -1
  4. package/fesm2015/nrwl-angular.mjs.map +1 -1
  5. package/fesm2020/nrwl-angular-mfe.mjs +1 -1
  6. package/fesm2020/nrwl-angular-testing.mjs.map +1 -1
  7. package/fesm2020/nrwl-angular.mjs.map +1 -1
  8. package/mfe/index.d.ts +1 -1
  9. package/mfe/index.js +2 -1
  10. package/mfe/index.js.map +1 -1
  11. package/package.json +6 -6
  12. package/src/builders/webpack-browser/schema.json +0 -15
  13. package/src/generators/application/lib/add-mfe.js +1 -0
  14. package/src/generators/application/lib/add-mfe.js.map +1 -1
  15. package/src/generators/application/schema.d.ts +1 -0
  16. package/src/generators/application/schema.json +6 -0
  17. package/src/generators/mfe-host/mfe-host.js +1 -0
  18. package/src/generators/mfe-host/mfe-host.js.map +1 -1
  19. package/src/generators/mfe-host/schema.d.ts +1 -0
  20. package/src/generators/mfe-host/schema.json +5 -0
  21. package/src/generators/ng-add/compat.d.ts +1 -1
  22. package/src/generators/ng-add/files/{root → root-karma}/karma.conf.js__tmpl__ +0 -0
  23. package/src/generators/ng-add/migrate-from-angular-cli.d.ts +2 -2
  24. package/src/generators/ng-add/migrate-from-angular-cli.js +38 -607
  25. package/src/generators/ng-add/migrate-from-angular-cli.js.map +1 -1
  26. package/src/generators/ng-add/ng-add.d.ts +3 -3
  27. package/src/generators/ng-add/ng-add.js +2 -2
  28. package/src/generators/ng-add/ng-add.js.map +1 -1
  29. package/src/generators/ng-add/schema.d.ts +1 -1
  30. package/src/generators/ng-add/utilities/app.migrator.d.ts +18 -0
  31. package/src/generators/ng-add/utilities/app.migrator.js +182 -0
  32. package/src/generators/ng-add/utilities/app.migrator.js.map +1 -0
  33. package/src/generators/ng-add/utilities/e2e-project.migrator.d.ts +19 -0
  34. package/src/generators/ng-add/utilities/e2e-project.migrator.js +186 -0
  35. package/src/generators/ng-add/utilities/e2e-project.migrator.js.map +1 -0
  36. package/src/generators/ng-add/utilities/e2e-utils.d.ts +7 -0
  37. package/src/generators/ng-add/utilities/e2e-utils.js +46 -0
  38. package/src/generators/ng-add/utilities/e2e-utils.js.map +1 -0
  39. package/src/generators/ng-add/utilities/get-all-projects.d.ts +3 -0
  40. package/src/generators/ng-add/utilities/get-all-projects.js +26 -0
  41. package/src/generators/ng-add/utilities/get-all-projects.js.map +1 -0
  42. package/src/generators/ng-add/utilities/normalize-options.d.ts +3 -0
  43. package/src/generators/ng-add/utilities/normalize-options.js +24 -0
  44. package/src/generators/ng-add/utilities/normalize-options.js.map +1 -0
  45. package/src/generators/ng-add/utilities/project.migrator.d.ts +21 -0
  46. package/src/generators/ng-add/utilities/project.migrator.js +53 -0
  47. package/src/generators/ng-add/utilities/project.migrator.js.map +1 -0
  48. package/src/generators/ng-add/utilities/types.d.ts +10 -0
  49. package/src/generators/ng-add/utilities/types.js +3 -0
  50. package/src/generators/ng-add/utilities/types.js.map +1 -0
  51. package/src/generators/ng-add/utilities/workspace.d.ts +12 -0
  52. package/src/generators/ng-add/utilities/workspace.js +258 -0
  53. package/src/generators/ng-add/utilities/workspace.js.map +1 -0
  54. package/src/generators/setup-mfe/lib/add-remote-to-host.d.ts +2 -2
  55. package/src/generators/setup-mfe/lib/add-remote-to-host.js +49 -23
  56. package/src/generators/setup-mfe/lib/add-remote-to-host.js.map +1 -1
  57. package/src/generators/setup-mfe/lib/fix-bootstrap.d.ts +2 -1
  58. package/src/generators/setup-mfe/lib/fix-bootstrap.js +13 -4
  59. package/src/generators/setup-mfe/lib/fix-bootstrap.js.map +1 -1
  60. package/src/generators/setup-mfe/lib/index.d.ts +1 -0
  61. package/src/generators/setup-mfe/lib/index.js +1 -0
  62. package/src/generators/setup-mfe/lib/index.js.map +1 -1
  63. package/src/generators/setup-mfe/lib/setup-host-if-dynamic.d.ts +3 -0
  64. package/src/generators/setup-mfe/lib/setup-host-if-dynamic.js +15 -0
  65. package/src/generators/setup-mfe/lib/setup-host-if-dynamic.js.map +1 -0
  66. package/src/generators/setup-mfe/schema.d.ts +1 -0
  67. package/src/generators/setup-mfe/schema.json +6 -0
  68. package/src/generators/setup-mfe/setup-mfe.d.ts +1 -1
  69. package/src/generators/setup-mfe/setup-mfe.js +16 -13
  70. package/src/generators/setup-mfe/setup-mfe.js.map +1 -1
  71. package/src/utils/versions.js +1 -1
  72. package/src/generators/ng-add/files/decorate-angular-cli/decorate-angular-cli.js__tmpl__ +0 -69
  73. package/src/generators/ng-add/files/root/nx.json__tmpl__ +0 -29
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupHostIfDynamic = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ function setupHostIfDynamic(tree, options) {
6
+ if (options.federationType === 'static' || options.mfeType === 'remote') {
7
+ return;
8
+ }
9
+ const pathToMfeManifest = (0, devkit_1.joinPathFragments)((0, devkit_1.readProjectConfiguration)(tree, options.appName).sourceRoot, 'assets/mfe.manifest.json');
10
+ if (!tree.exists(pathToMfeManifest)) {
11
+ tree.write(pathToMfeManifest, '{}');
12
+ }
13
+ }
14
+ exports.setupHostIfDynamic = setupHostIfDynamic;
15
+ //# sourceMappingURL=setup-host-if-dynamic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-host-if-dynamic.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mfe/lib/setup-host-if-dynamic.ts"],"names":[],"mappings":";;;AAGA,yCAA2E;AAE3E,SAAgB,kBAAkB,CAAC,IAAU,EAAE,OAAe;IAC5D,IAAI,OAAO,CAAC,cAAc,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE;QACvE,OAAO;KACR;IAED,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,EAC1D,0BAA0B,CAC3B,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE;QACnC,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;KACrC;AACH,CAAC;AAbD,gDAaC"}
@@ -4,6 +4,7 @@ export interface Schema {
4
4
  port?: number;
5
5
  remotes?: string[];
6
6
  host?: string;
7
+ federationType?: 'static' | 'dynamic';
7
8
  routing?: boolean;
8
9
  skipFormat?: boolean;
9
10
  skipPackageJson?: boolean;
@@ -21,6 +21,12 @@
21
21
  "description": "Type of application to generate the Module Federation configuration for.",
22
22
  "default": "remote"
23
23
  },
24
+ "federationType": {
25
+ "type": "string",
26
+ "enum": ["static", "dynamic"],
27
+ "description": "Use either Static or Dynamic Module Federation pattern for the application.",
28
+ "default": "static"
29
+ },
24
30
  "port": {
25
31
  "type": "number",
26
32
  "description": "The port at which the remote application should be served."
@@ -1,4 +1,4 @@
1
1
  import type { Tree } from '@nrwl/devkit';
2
2
  import type { Schema } from './schema';
3
- export declare function setupMfe(host: Tree, options: Schema): Promise<void>;
3
+ export declare function setupMfe(tree: Tree, options: Schema): Promise<void>;
4
4
  export default setupMfe;
@@ -4,22 +4,25 @@ exports.setupMfe = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nrwl/devkit");
6
6
  const lib_1 = require("./lib");
7
- function setupMfe(host, options) {
7
+ function setupMfe(tree, options) {
8
+ var _a;
8
9
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
- const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.appName);
10
- const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(host, options);
11
- (0, lib_1.addRemoteToHost)(host, options);
12
- (0, lib_1.generateWebpackConfig)(host, options, projectConfig.root, remotesWithPorts);
13
- (0, lib_1.addEntryModule)(host, options, projectConfig.root);
14
- (0, lib_1.addImplicitDeps)(host, options);
15
- (0, lib_1.changeBuildTarget)(host, options);
16
- (0, lib_1.updateTsConfigTarget)(host, options);
17
- (0, lib_1.setupServeTarget)(host, options);
18
- (0, lib_1.fixBootstrap)(host, projectConfig.root);
19
- (0, lib_1.addCypressOnErrorWorkaround)(host, options);
10
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.appName);
11
+ options.federationType = (_a = options.federationType) !== null && _a !== void 0 ? _a : 'static';
12
+ (0, lib_1.setupHostIfDynamic)(tree, options);
13
+ const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(tree, options);
14
+ (0, lib_1.addRemoteToHost)(tree, options);
15
+ (0, lib_1.generateWebpackConfig)(tree, options, projectConfig.root, remotesWithPorts);
16
+ (0, lib_1.addEntryModule)(tree, options, projectConfig.root);
17
+ (0, lib_1.addImplicitDeps)(tree, options);
18
+ (0, lib_1.changeBuildTarget)(tree, options);
19
+ (0, lib_1.updateTsConfigTarget)(tree, options);
20
+ (0, lib_1.setupServeTarget)(tree, options);
21
+ (0, lib_1.fixBootstrap)(tree, projectConfig.root, options);
22
+ (0, lib_1.addCypressOnErrorWorkaround)(tree, options);
20
23
  // format files
21
24
  if (!options.skipFormat) {
22
- yield (0, devkit_1.formatFiles)(host);
25
+ yield (0, devkit_1.formatFiles)(tree);
23
26
  }
24
27
  });
25
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setup-mfe.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/setup-mfe/setup-mfe.ts"],"names":[],"mappings":";;;;AAGA,yCAAqE;AAErE,+BAWe;AAEf,SAAsB,QAAQ,CAAC,IAAU,EAAE,OAAe;;QACxD,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEtE,MAAM,gBAAgB,GAAG,IAAA,yBAA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,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAA,qBAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE/B,IAAA,2BAAqB,EAAC,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAE3E,IAAA,oBAAc,EAAC,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAClD,IAAA,qBAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,IAAA,uBAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjC,IAAA,0BAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpC,IAAA,sBAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhC,IAAA,kBAAY,EAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhD,IAAA,iCAA2B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,eAAe;QACf,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;;CACF;AA1BD,4BA0BC;AAED,kBAAe,QAAQ,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.autoprefixerVersion = exports.postcssVersion = exports.tailwindVersion = exports.angularEslintVersion = exports.jestPresetAngularVersion = exports.rxjsVersion = exports.ngrxVersion = exports.angularJsVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
4
- exports.nxVersion = '13.10.0-beta.7';
4
+ exports.nxVersion = '13.10.0-beta.8';
5
5
  exports.angularVersion = '~13.3.0';
6
6
  exports.angularDevkitVersion = '~13.3.0';
7
7
  exports.angularJsVersion = '1.7.9';
@@ -1,69 +0,0 @@
1
- /**
2
- * This file decorates the Angular CLI with the Nx CLI to enable features such as computation caching
3
- * and faster execution of tasks.
4
- *
5
- * It does this by:
6
- *
7
- * - Patching the Angular CLI to warn you in case you accidentally use the undecorated ng command.
8
- * - Symlinking the ng to nx command, so all commands run through the Nx CLI
9
- * - Updating the package.json postinstall script to give you control over this script
10
- *
11
- * The Nx CLI decorates the Angular CLI, so the Nx CLI is fully compatible with it.
12
- * Every command you run should work the same when using the Nx CLI, except faster.
13
- *
14
- * Because of symlinking you can still type `ng build/test/lint` in the terminal. The ng command, in this case,
15
- * will point to nx, which will perform optimizations before invoking ng. So the Angular CLI is always invoked.
16
- * The Nx CLI simply does some optimizations before invoking the Angular CLI.
17
- *
18
- * To opt out of this patch:
19
- * - Replace occurrences of nx with ng in your package.json
20
- * - Remove the script from your postinstall script in your package.json
21
- * - Delete and reinstall your node_modules
22
- */
23
-
24
- const fs = require('fs');
25
- const os = require('os');
26
- const cp = require('child_process');
27
- const isWindows = os.platform() === 'win32';
28
- let output;
29
- try {
30
- output = require('@nrwl/workspace').output;
31
- } catch (e) {
32
- console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.');
33
- process.exit(0);
34
- }
35
-
36
- /**
37
- * Symlink of ng to nx, so you can keep using `ng build/test/lint` and still
38
- * invoke the Nx CLI and get the benefits of computation caching.
39
- */
40
- function symlinkNgCLItoNxCLI() {
41
- try {
42
- const ngPath = './node_modules/.bin/ng';
43
- const nxPath = './node_modules/.bin/nx';
44
- if (isWindows) {
45
- /**
46
- * This is the most reliable way to create symlink-like behavior on Windows.
47
- * Such that it works in all shells and works with npx.
48
- */
49
- ['', '.cmd', '.ps1'].forEach(ext => {
50
- if (fs.existsSync(nxPath + ext)) fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
51
- });
52
- } else {
53
- // If unix-based, symlink
54
- cp.execSync(`ln -sf ./nx ${ngPath}`);
55
- }
56
- }
57
- catch(e) {
58
- output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message });
59
- throw e;
60
- }
61
- }
62
-
63
- try {
64
- symlinkNgCLItoNxCLI();
65
- require('nx/src/adapter/decorate-cli').decorateCli();
66
- output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
67
- } catch(e) {
68
- output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
69
- }
@@ -1,29 +0,0 @@
1
- {
2
- "npmScope": "<%= npmScope %>",
3
- "affected": {
4
- "defaultBase": "<%= defaultBase %>"
5
- },
6
- "implicitDependencies": {
7
- "package.json": {
8
- "dependencies": "*",
9
- "devDependencies": "*"
10
- },
11
- ".eslintrc.json": "*"
12
- },
13
- "tasksRunnerOptions": {
14
- "default": {
15
- "runner": "nx/tasks-runners/default",
16
- "options": {
17
- "cacheableOperations": ["build", "lint", "test", "e2e"]
18
- }
19
- }
20
- },
21
- "targetDependencies": {
22
- "build": [
23
- {
24
- "target": "build",
25
- "projects": "dependencies"
26
- }
27
- ]
28
- }
29
- }