Skip to content

Commit b652049

Browse files
Merge remote-tracking branch 'origin/main' into share-filter
# Conflicts: # .github/workflows/release.yml
2 parents 1b804df + 3fd26a7 commit b652049

File tree

114 files changed

+3240
-1146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+3240
-1146
lines changed

.changeset/great-pandas-knock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/enhanced': patch
3+
---
4+
5+
fix(enhanced): Populate `buildMeta` and `buildInfo` on `ConsumeSharedPlugin` using fallbacks

.github/workflows/release.yml

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ on:
44
inputs:
55
version:
66
type: choice
7-
description: 'Release Version (next, beta, alpha, latest)'
7+
description: 'Release Version'
88
required: true
99
default: 'next'
1010
options:
11-
- next
12-
- beta
13-
- alpha
1411
- latest
12+
- next
1513
branch:
1614
description: 'Release Branch (confirm release branch)'
1715
required: true
@@ -25,54 +23,54 @@ jobs:
2523
name: Release
2624
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
2725
runs-on: ubuntu-latest
26+
environment: npm
2827
steps:
2928
- name: Checkout
30-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
3130
with:
3231
fetch-depth: 25
32+
ref: ${{ github.event.inputs.branch }}
3333

34-
- name: Install Pnpm
34+
# Use corepack to install pnpm
35+
- name: Setup Pnpm
3536
run: |
37+
npm install -g corepack@latest --force
3638
corepack prepare pnpm@8.11.0 --activate
3739
corepack enable
3840
39-
- name: Setup Node.js 18
40-
uses: actions/setup-node@v3
41+
- name: Setup Node.js
42+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
4143
with:
42-
node-version: '18'
44+
node-version: 22
4345
cache: 'pnpm'
4446

45-
- name: Cache Browsers
46-
uses: actions/cache@v3
47-
id: browsers-cache
48-
with:
49-
path: |
50-
~/.cache/ms-playwright
51-
~/.cache/Cypress
52-
key: ${{ runner.os }}-browsers-${{ hashFiles('**/pnpm-lock.yaml') }}
53-
54-
- name: Set Nx SHA
55-
uses: nrwl/nx-set-shas@v3
47+
# Update npm to the latest version to enable OIDC
48+
- name: Update npm
49+
run: |
50+
npm install -g npm@latest
51+
npm --version
5652
5753
- name: Install deps
5854
run: pnpm install
5955

56+
- name: Generate preview version
57+
if: github.event.inputs.version == 'next'
58+
run: |
59+
npx changeset version --snapshot next
60+
6061
- name: Build and test Packages
6162
run: |
6263
git fetch origin main
6364
npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
6465
npx nx run-many --targets=build --projects=tag:type:metro
6566
ls -l packages/*/dist packages/*/package.json
6667
67-
- name: Release
68-
uses: module-federation/actions@v2
69-
with:
70-
version: ${{ github.event.inputs.version || 'next' }}
71-
branch: ${{ github.event.inputs.branch }}
72-
type: 'release'
73-
tools: 'changeset'
74-
env:
75-
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
76-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
77-
REPOSITORY: ${{ github.repository }}
78-
REF: ${{ github.ref }}
68+
- name: Publish latest version
69+
if: github.event.inputs.version == 'latest'
70+
run: |
71+
pnpm -r publish --tag ${{ github.event.inputs.version }} --publish-branch ${{ github.event.inputs.branch }}
72+
73+
- name: Publish preview version
74+
if: github.event.inputs.version == 'next'
75+
run: |
76+
pnpm -r publish --tag next --no-git-checks

.vscode/launch.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
"type": "node",
9191
"request": "launch",
9292
"preLaunchTask": "pnpm-build-enhanced",
93-
"runtimeExecutable": "/Users/bytedance/.nvm/versions/node/v18.20.8/bin/node",
9493
"runtimeArgs": [
9594
"${workspaceFolder}/node_modules/jest/bin/jest.js",
9695
"test/ConfigTestCases.basictest.js",

CONTRIBUTING.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,25 @@ feat(plugin-swc): Add `xxx` config
128128
```
129129

130130

131-
## Release
131+
## Releasing
132132

133-
Module Federation uses GitHub Actions for automated versioning and publishing:
133+
Repository maintainers can publish a new version of changed packages to npm.
134134

135-
## Release test version
135+
1. Checkout a new release branch, for example `release-v0.19.0`.
136+
2. Run `pnpm changeset version` in the package directory to update the version of each package.
137+
3. Create a pull request, the title should be `release v0.19.1`.
138+
4. Run the [release action](https://github.com/module-federation/core/actions/workflows/release.yml) to publish packages to npm.
139+
5. Select `latest` as the release version.
140+
6. Wait reviewers to approve.
141+
7. Merge the release pull request to `main`.
142+
7. Generate the [release notes](https://github.com/module-federation/core/releases) via GitHub, see [Automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes)
136143

137-
1. Make sure your branch has added changeset files before releasing the test version
138-
2. Make sure that both "use workflow from" and "release branch" are split for the test version you want to release
139-
3. Use the "next" TAB to release the test version
140-
141-
![image](https://github.com/module-federation/core/assets/27547179/f84fd796-d1d9-42f6-8bb2-95b07c6d7749)
144+
## Release preview version
142145

146+
1. Make sure your branch has added changeset files before releasing the preview version.
147+
2. Run the [release action](https://github.com/module-federation/core/actions/workflows/release.yml) to publish packages to npm.
148+
3. Select `next` as the release version.
149+
4. Wait reviewers to approve.
143150

144151

145152
## Release the official version

apps/modernjs/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @module-federation/modernjsapp
22

3+
## 0.1.109
4+
5+
### Patch Changes
6+
7+
- @module-federation/enhanced@0.19.1
8+
9+
## 0.1.108
10+
11+
### Patch Changes
12+
13+
- @module-federation/enhanced@0.19.0
14+
315
## 0.1.107
416

517
### Patch Changes

apps/modernjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@module-federation/modernjsapp",
33
"private": true,
4-
"version": "0.1.107",
4+
"version": "0.1.109",
55
"scripts": {
66
"reset": "npx rimraf ./**/node_modules",
77
"dev": "modern dev",

apps/router-demo/router-host-2000/src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import React, {
55
Suspense,
66
} from 'react';
77
import { Route, Routes, useLocation } from 'react-router-dom';
8-
import { init, loadRemote } from '@module-federation/enhanced/runtime';
8+
import {
9+
loadRemote,
10+
createInstance,
11+
} from '@module-federation/enhanced/runtime';
912
import { RetryPlugin } from '@module-federation/retry-plugin';
1013
import { createRemoteAppComponent } from '@module-federation/bridge-react';
1114
import Navigation from './navigation';
@@ -17,7 +20,6 @@ import { ErrorBoundary } from 'react-error-boundary';
1720
import Remote1AppNew from 'remote1/app';
1821
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1922
import { Spin } from 'antd';
20-
import { createInstance } from '@module-federation/enhanced/runtime';
2123

2224
const fallbackPlugin: () => ModuleFederationRuntimePlugin = function () {
2325
return {

apps/router-demo/router-host-2000/src/runtime-plugin/retry.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,32 @@ import { RetryPlugin } from '@module-federation/retry-plugin';
22

33
const retryPlugin = () =>
44
RetryPlugin({
5-
fetch: {
6-
// fallback: () => 'http://localhost:2001/mf-manifest.json',
7-
// getRetryPath: (url) => {
8-
// return 'http://localhost:2001/mf-manifest.json?test=1';
9-
// },
5+
retryTimes: 3,
6+
retryDelay: 1000,
7+
onRetry: (params) => {
8+
console.log('onRetry', params);
109
},
11-
script: {
12-
retryTimes: 3,
13-
retryDelay: 1000,
14-
// moduleName: ['remote1'],
15-
cb: (resolve, error) => {
16-
if (error) {
17-
throw new Error(
18-
'The request failed three times and has now been abandoned',
19-
);
20-
}
21-
return setTimeout(() => {
22-
resolve(error);
23-
}, 1000);
24-
},
25-
getRetryPath: (url) => {
26-
return 'http://localhost:2001/remote1.js?test=2';
27-
},
10+
onSuccess: (params) => {
11+
console.log('onSuccess', params);
12+
},
13+
onError: (params) => {
14+
console.log('onError', params);
15+
},
16+
manifestDomains: [
17+
'https://m1.example.com',
18+
'https://m2.example.com',
19+
'https://m3.example.com',
20+
],
21+
domains: [
22+
'http://localhost:2011',
23+
'http://localhost:2021',
24+
'http://localhost:2031',
25+
],
26+
addQuery: ({ times, originalQuery }) => {
27+
return `${originalQuery}&retry=${times}&retryTimeStamp=${new Date().valueOf()}`;
28+
},
29+
fetchOptions: {
30+
method: 'GET',
2831
},
2932
});
3033
export default retryPlugin;

apps/router-demo/router-remote5-2005/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# remote5
22

3+
## 1.1.16
4+
5+
### Patch Changes
6+
7+
- @module-federation/bridge-react@0.19.1
8+
- @module-federation/rsbuild-plugin@0.19.1
9+
10+
## 1.1.15
11+
12+
### Patch Changes
13+
14+
- @module-federation/bridge-react@0.19.0
15+
- @module-federation/rsbuild-plugin@0.19.0
16+
317
## 1.1.14
418

519
### Patch Changes

apps/router-demo/router-remote5-2005/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "remote5",
33
"private": true,
4-
"version": "1.1.14",
4+
"version": "1.1.16",
55
"scripts": {
66
"dev": "rsbuild dev",
77
"build": "rsbuild build",

0 commit comments

Comments
 (0)