Skip to content

Commit

Permalink
docs(nf): mention demo repo
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Jan 12, 2025
1 parent 6e9e33a commit 18c2874
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 18 deletions.
4 changes: 3 additions & 1 deletion libs/mf/src/utils/share-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ function _findSecondaries(

const dirs = files
.map((f) => path.join(libPath, f))
.filter((f) => fs.lstatSync(f).isDirectory() && !f.endsWith('node_modules'));
.filter(
(f) => fs.lstatSync(f).isDirectory() && !f.endsWith('node_modules')
);

const secondaries = dirs.filter((d) =>
fs.existsSync(path.join(d, 'package.json'))
Expand Down
4 changes: 2 additions & 2 deletions libs/native-federation-core/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@softarc/native-federation",
"version": "2.0.16",
"version": "2.0.17",
"type": "commonjs",
"license": "MIT",
"dependencies": {
"json5": "^2.2.0",
"npmlog": "^6.0.2",
"@softarc/native-federation-runtime": "2.0.16"
"@softarc/native-federation-runtime": "2.0.17"
}
}
4 changes: 3 additions & 1 deletion libs/native-federation-core/src/lib/config/share-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ function _findSecondaries(

const secondaries = files
.map((f) => path.join(libPath, f))
.filter((f) => fs.lstatSync(f).isDirectory() && !f.endsWith('node_modules'));
.filter(
(f) => fs.lstatSync(f).isDirectory() && !f.endsWith('node_modules')
);

for (const s of secondaries) {
if (fs.existsSync(path.join(s, 'package.json'))) {
Expand Down
2 changes: 1 addition & 1 deletion libs/native-federation-esbuild/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@softarc/native-federation-esbuild",
"version": "2.0.16",
"version": "2.0.17",
"type": "commonjs",
"dependencies": {
"@rollup/plugin-commonjs": "^22.0.2",
Expand Down
2 changes: 1 addition & 1 deletion libs/native-federation-node/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "@softarc/native-federation-node",
"version": "2.0.16"
"version": "2.0.17"
}
2 changes: 1 addition & 1 deletion libs/native-federation-runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@softarc/native-federation-runtime",
"version": "2.0.16",
"version": "2.0.17",
"dependencies": {
"tslib": "^2.3.0"
},
Expand Down
22 changes: 16 additions & 6 deletions libs/native-federation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ We will at least provide a new version of this package per Angular major. If nec
- Use version 18.2.x for Angular 18.2.x
- Use version 19.x for Angular 19.x

## Demo Repo

In this [demo repo](https://github.com/manfredsteyer/nf-test.git), we test Native Federation together with several known UI libraries for Angular. For this, we compile demo apps build with them with Native Federation.

<a href="https://github.com/manfredsteyer/nf-test.git" target="_blank">
<img width="500" src="https://github.com/angular-architects/module-federation-plugin/blob/main/libs/native-federation/demo-repo.png">
</a>

This is primarily for testing purposes. For an **initial example and/or an tutorial please look below.**

## Migration from Module Federation

If you currently use Angular with Module Federation, you can follow our [Migration Guide](https://github.com/angular-architects/module-federation-plugin/blob/main/libs/native-federation/docs/migrate.md) to migrate to Native Federation and Angular's new fast esbuild-based build system.
Expand Down Expand Up @@ -350,18 +360,18 @@ The good message is, that the official Angular Package Format defines the usage

### How to Deal with Transitive Dependencies?

Since version >=18.2.7, transitive dependencies can also be shared. For instance, `primeng` uses a lib `@primeuix/styled` for theming. The latter one is now shared too if `primeng` is. This prevents possible challenges but also results in more bundles.
Since version >=18.2.7, transitive dependencies can also be shared. For instance, `primeng` uses a lib `@primeuix/styled` for theming. The latter one is now shared too if `primeng` is. This prevents possible challenges but also results in more bundles.

To activate sharing transient dependencies, set the new `transient` flag provided by `share` and `shareAll` to `true`:

```js
module.exports = withNativeFederation({
shared: {
...shareAll({
singleton: true,
strictVersion: true,
requiredVersion: 'auto',
transient: true
...shareAll({
singleton: true,
strictVersion: true,
requiredVersion: 'auto',
transient: true
}),
},
[...]
Expand Down
Binary file added libs/native-federation/demo-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions libs/native-federation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@angular-architects/native-federation",
"version": "19.0.3",
"version": "19.0.4",
"main": "src/index.js",
"generators": "./collection.json",
"builders": "./builders.json",
Expand All @@ -20,8 +20,8 @@
},
"dependencies": {
"@babel/core": "^7.19.0",
"@softarc/native-federation": "2.0.16",
"@softarc/native-federation-runtime": "2.0.16",
"@softarc/native-federation": "2.0.17",
"@softarc/native-federation-runtime": "2.0.17",
"@types/browser-sync": "^2.29.0",
"@chialab/esbuild-plugin-commonjs": "^0.18.0",
"browser-sync": "^3.0.2",
Expand Down
4 changes: 2 additions & 2 deletions libs/native-federation/src/utils/angular-esbuild-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function createAngularBuildAdapter(
watch,
dev,
hash,
platform
platform,
} = options;

const files = await runEsbuild(
Expand Down Expand Up @@ -281,7 +281,7 @@ async function runEsbuild(
format: 'esm',
target: ['esnext'],
logLimit: kind === 'shared-package' ? 1 : 0,
plugins: plugins as any || [
plugins: (plugins as any) || [
createCompilerPlugin(
pluginOptions.pluginOptions,
pluginOptions.styleOptions
Expand Down

0 comments on commit 18c2874

Please sign in to comment.