Skip to content

Commit

Permalink
make latest the default tag when publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed May 1, 2024
1 parent ec7de5e commit cccb9a4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions libs/native-federation-core/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@softarc/native-federation",
"version": "2.0.8",
"version": "2.0.9",
"type": "commonjs",
"dependencies": {
"json5": "^2.2.0",
"npmlog": "^6.0.2",
"@softarc/native-federation-runtime": "2.0.8"
"@softarc/native-federation-runtime": "2.0.9"
}
}
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.8",
"version": "2.0.9",
"type": "commonjs",
"dependencies": {
"@rollup/plugin-commonjs": "^22.0.2",
Expand Down
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.8",
"version": "2.0.9",
"peerDependencies": {},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
12 changes: 6 additions & 6 deletions libs/native-federation/docs/share-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

When using Nx, it's usual to subdivide an application into several libs. Libs that are only used by one application should not be shared via federation.

As by default, all packages found in your ``package.json`` but also all libs in your workspace are shared, you should add such libraries to your skip list:
As by default, all packages found in your `package.json` but also all libs in your workspace are shared, you should add such libraries to your skip list:

```
skip: [
Expand All @@ -16,15 +16,15 @@ This speeds up your build and the initial page load. Also, it gives you automati

## Using Multiple Framework Versions

After compiling an Angular application, the compilation is accessing Angular's private API. As private APIs do not align with semver, there is no guarantee that your compiled application works with a different version of Angular. Even having a different minor or patch version at runtime can lead to issues.
After compiling an Angular application, the compilation is accessing Angular's private API. As private APIs do not align with semver, there is no guarantee that your compiled application works with a different version of Angular. Even having a different minor or patch version at runtime can lead to issues.

Hence, when using several versions or frameworks, you need to bootstrap each remote separately. Often, the individual Micro Frontends are abstracted, e.g., by using Web Components. Please find [more details about this here](https://www.angulararchitects.io/blog/micro-frontends-with-modern-angular-part-2-multi-version-and-multi-framework-solutions-with-angular-elements-and-web-components/).

## Sharing "Old-Style" Packages

To be useful in the long run, Native Federation fully leverages browser-native technologies like ESM and import maps. For this reason, old-style packages not following these standards can lead to challenges. In these cases, you might need to adjust your imports.

A good example of such a classical package is ``lodash``. When we looked into it the last time, it was still ``commonjs`` and not ESM-based. As ``commonjs`` can not be converted to ESM in all cases, we needed to adjust the imports as follows:
A good example of such a classical package is `lodash`. When we looked into it the last time, it was still `commonjs` and not ESM-based. As `commonjs` can not be converted to ESM in all cases, we needed to adjust the imports as follows:

```typescript
// Works:
Expand All @@ -34,12 +34,12 @@ import _ from 'lodash';
// import * as _ from 'lodash';
```

Another solution is to find an ESM version of ``lodash``.
Another solution is to find an ESM version of `lodash`.

The **good message** is: Angular's Package format implemented by ng build for libraries addresses ESM. Hence, Angular-based libraries really work well with Native Federation.

## ShareAll

The shareAll helper used by default in the federatio.config.js makes your life far easier as it shares all dependencies found in your ``package.json``. To optimize your build times and initial page loads, you can opt-out of sharing specific libraries by adding them to the above-mentioned ``skip`` list.
The shareAll helper used by default in the federatio.config.js makes your life far easier as it shares all dependencies found in your `package.json`. To optimize your build times and initial page loads, you can opt-out of sharing specific libraries by adding them to the above-mentioned `skip` list.

While this is an option in most cases, you **need to** skip Node.js libraries as they cannot be compiled for usage within the browser. Examples of such libraries are ``@angular/ssr`` or ``express``.
While this is an option in most cases, you **need to** skip Node.js libraries as they cannot be compiled for usage within the browser. Examples of such libraries are `@angular/ssr` or `express`.
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": "17.1.7",
"version": "17.1.8",
"main": "src/index.js",
"generators": "./collection.json",
"builders": "./builders.json",
Expand All @@ -17,8 +17,8 @@
},
"dependencies": {
"@babel/core": "^7.19.0",
"@softarc/native-federation": "2.0.8",
"@softarc/native-federation-runtime": "2.0.8",
"@softarc/native-federation": "2.0.9",
"@softarc/native-federation-runtime": "2.0.9",
"@types/browser-sync": "^2.29.0",
"browser-sync": "^3.0.2",
"esbuild": "^0.19.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ module.exports = withNativeFederation({
'rxjs/webSocket',
// Add further packages you don't need at runtime
]

// Please read our FAQ about sharing libs:
// https://shorturl.at/jmzH0

});
2 changes: 1 addition & 1 deletion tools/scripts/publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import chalk from 'chalk';

// Executing publish script: node path/to/publish.mjs {project} {registry} {version} {tag}
// Default "tag" to "next" so we won't publish the "latest" tag by accident.
const [, , nameArgv, targetRegistry, versionArgv, tagArgv = 'next'] =
const [, , nameArgv, targetRegistry, versionArgv, tagArgv = 'latest'] =
process.argv;

const project = getProject(nameArgv);
Expand Down

0 comments on commit cccb9a4

Please sign in to comment.