Skip to content

Commit b892de4

Browse files
committed
docs: add readme
1 parent 9488fcd commit b892de4

File tree

4 files changed

+36
-16
lines changed

4 files changed

+36
-16
lines changed

libs/native-federation/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ We will at least provide a new version of this package per Angular major. If nec
2323
- Use version 16.1.x for Angular 16.1.x
2424
- Use version 16.2.x for Angular 16.2.x
2525
- Use version 17.x for Angular 17.x
26+
- Use version 17.1.x-rc.x for Angular 17.1
2627

2728
## Credits
2829

libs/native-federation/migrate-appbuilder.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# Migrating to Native Federation 17.1
2+
3+
Beginning with version 17.1, Native Federation uses the CLI's Application Builder and Dev Server to keep track with the innovations and performance improvements the CLI team works on.
4+
5+
This requires some changes in the `angular.json`. If you go with a default configuration for Native Federation, the following command takes care of them:
6+
7+
```
8+
ng g @angular-architects/native-federation:appbuilder
9+
```
10+
11+
For more advanced cases, please find a diff of the changes needed for this version:
12+
113
```diff
214
{
315
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",

libs/native-federation/src/builders/build/builder.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,13 @@ export async function* runBuilder(
6969
logger.info('Application-Builder and its Dev-Server.');
7070
logger.info('Please update your project config, e.g. in angular.json');
7171
logger.info('');
72-
logger.info(
73-
'This command performs the needed update for default configs:'
74-
);
72+
logger.info('This command performs the needed update for default configs:');
7573
logger.info('');
7674
logger.info('\tng g @angular-architects/native-federation:appbuilder');
7775
logger.info('');
7876
logger.info('You need to run it once per application to migrate');
79-
logger.info(
80-
'Please find more information here: https://shorturl.at/gADJW'
81-
);
77+
logger.info('Please find more information here: https://shorturl.at/gADJW');
8278
return;
83-
8479
}
8580

8681
let options = (await context.validateOptions(

libs/native-federation/src/utils/angular-esbuild-adapter.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ async function runEsbuild(
203203

204204
const tailwindConfiguration = tailwindConfigurationPath
205205
? {
206-
file: tailwindConfigurationPath,
207-
package: resolver.resolve('tailwindcss'),
208-
}
206+
file: tailwindConfigurationPath,
207+
package: resolver.resolve('tailwindcss'),
208+
}
209209
: undefined;
210210

211211
const outputNames = {
@@ -222,7 +222,11 @@ async function runEsbuild(
222222
}
223223
}
224224

225-
tsConfigPath = createTsConfigForFederation(workspaceRoot, tsConfigPath, entryPoints);
225+
tsConfigPath = createTsConfigForFederation(
226+
workspaceRoot,
227+
tsConfigPath,
228+
entryPoints
229+
);
226230

227231
const pluginOptions = createCompilerPluginOptions(
228232
{
@@ -335,20 +339,28 @@ function cleanUpTsConfigForFederation(tsConfigPath: string) {
335339
}
336340
}
337341

338-
function createTsConfigForFederation(workspaceRoot: string, tsConfigPath: string, entryPoints: EntryPoint[]) {
342+
function createTsConfigForFederation(
343+
workspaceRoot: string,
344+
tsConfigPath: string,
345+
entryPoints: EntryPoint[]
346+
) {
339347
const fullTsConfigPath = path.join(workspaceRoot, tsConfigPath);
340348
const tsconfigDir = path.dirname(fullTsConfigPath);
341349

342-
const filtered = entryPoints.filter(ep => !ep.fileName.includes('/node_modules/') && !ep.fileName.startsWith('.')).map(ep => path.relative(tsconfigDir, ep.fileName).replace(/\\\\/g, '/'));
350+
const filtered = entryPoints
351+
.filter(
352+
(ep) =>
353+
!ep.fileName.includes('/node_modules/') && !ep.fileName.startsWith('.')
354+
)
355+
.map((ep) => path.relative(tsconfigDir, ep.fileName).replace(/\\\\/g, '/'));
343356

344357
const tsconfigAsString = fs.readFileSync(fullTsConfigPath, 'utf-8');
345358
const tsconfigWithoutComments = tsconfigAsString.replace(
346-
/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g,
347-
''
359+
/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g,
360+
''
348361
);
349362
const tsconfig = JSON.parse(tsconfigWithoutComments);
350363

351-
352364
if (!tsconfig.include) {
353365
tsconfig.include = [];
354366
}

0 commit comments

Comments
 (0)