Skip to content

Commit 8c9201b

Browse files
committed
add migration guide
1 parent b5e4e02 commit 8c9201b

File tree

3 files changed

+25
-32
lines changed

3 files changed

+25
-32
lines changed

libs/native-federation/docs/migrate.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Motivation
44

5-
Since Angular 17, the CLI ships with an esbuild-based builder that is remarkable faster than the original webpack-based solution. This new builder is used for newly generated projects and beginning with Angular 18 ng updates also migrates existing projects.
5+
Since Angular 17, the CLI ships with an esbuild-based builder that is remarkable faster than the original webpack-based solution. This new builder is used for newly generated projects and beginning with Angular 18 ng updates also migrates existing projects.
66

77
Native Federation for Angular is a thin wrapper around the esbuild builder that allows to use the proven mental model of Module Federation.
88

99
## Prerequisites
1010

1111
- Update your solution to the newest Angular and CLI version
12-
- Update your solution to the newest version of ``@angular-architects/module-federation``
12+
- Update your solution to the newest version of `@angular-architects/module-federation`
1313
- Have a look to our [FAQs about sharing packages with Native Federation](share-faq.md)
1414

1515
## Migration for Angular CLI projects
@@ -18,4 +18,4 @@ Native Federation for Angular is a thin wrapper around the esbuild builder that
1818

1919
## Issues
2020

21-
We have tested this guide with several projects. However, e
21+
We have tested this guide with several projects. However, e

libs/native-federation/docs/update18.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Make sure you have the following `postinstall` script in your `package.json`:
2727
},
2828
```
2929

30-
**Remarks:** This script is just a temporary solution. It won't be necessary in future versions.
30+
**Remarks:** This script is just a temporary solution. It won't be necessary in future versions.
3131

3232
Run the `postinstall` script once manually for initialization:
3333

libs/native-federation/src/schematics/init/schematic.ts

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
1414
import { strings } from '@angular-devkit/core';
1515
import { MfSchematicSchema } from './schema';
1616

17-
import { patchAngularBuildPackageJson, privateEntrySrc } from '../../utils/patch-angular-build';
17+
import {
18+
patchAngularBuildPackageJson,
19+
privateEntrySrc,
20+
} from '../../utils/patch-angular-build';
1821

1922
import {
2023
addPackageJsonDependency,
@@ -92,11 +95,11 @@ export default function config(options: MfSchematicSchema): Rule {
9295

9396
const generateRule = !exists
9497
? await generateFederationConfig(
95-
remoteMap,
96-
projectRoot,
97-
projectSourceRoot,
98-
options
99-
)
98+
remoteMap,
99+
projectRoot,
100+
projectSourceRoot,
101+
options
102+
)
100103
: noop;
101104

102105
updateWorkspaceConfig(tree, normalized, workspace, workspaceFileName);
@@ -114,7 +117,10 @@ export default function config(options: MfSchematicSchema): Rule {
114117

115118
context.addTask(new NodePackageInstallTask());
116119

117-
return chain([generateRule, makeMainAsync(main, options, remoteMap, manifestRelPath)]);
120+
return chain([
121+
generateRule,
122+
makeMainAsync(main, options, remoteMap, manifestRelPath),
123+
]);
118124
};
119125
}
120126

@@ -126,28 +132,15 @@ export function patchAngularBuild(tree: Tree) {
126132
return;
127133
}
128134

129-
const packageJson = JSON.parse(
130-
tree.read(packagePath).toString('utf8')
131-
);
135+
const packageJson = JSON.parse(tree.read(packagePath).toString('utf8'));
132136
patchAngularBuildPackageJson(packageJson);
133-
tree.overwrite(
134-
packagePath,
135-
JSON.stringify(packageJson, null, 2)
136-
);
137+
tree.overwrite(packagePath, JSON.stringify(packageJson, null, 2));
137138

138139
if (!tree.exists(privatePath)) {
139-
tree.create(
140-
privatePath,
141-
privateEntrySrc
142-
);
143-
}
144-
else {
145-
tree.overwrite(
146-
privatePath,
147-
privateEntrySrc
148-
);
140+
tree.create(privatePath, privateEntrySrc);
141+
} else {
142+
tree.overwrite(privatePath, privateEntrySrc);
149143
}
150-
151144
}
152145

153146
function updateWorkspaceConfig(
@@ -307,8 +300,8 @@ function normalizeOptions(
307300

308301
if (typeof projectConfig.architect.build.options.polyfills === 'string') {
309302
projectConfig.architect.build.options.polyfills = [
310-
projectConfig.architect.build.options.polyfills
311-
]
303+
projectConfig.architect.build.options.polyfills,
304+
];
312305
}
313306

314307
const polyfills = projectConfig.architect.build.options.polyfills;
@@ -383,7 +376,7 @@ function makeMainAsync(
383376
main: string,
384377
options: MfSchematicSchema,
385378
remoteMap: unknown,
386-
manifestRelPath: string,
379+
manifestRelPath: string
387380
): Rule {
388381
return async function (tree) {
389382
const mainPath = path.dirname(main);

0 commit comments

Comments
 (0)