Skip to content

Commit 14e0c78

Browse files
feat: integrate metro package into release pipeline and changesets (#4035)
1 parent d40c64f commit 14e0c78

File tree

29 files changed

+202
-35
lines changed

29 files changed

+202
-35
lines changed

.changeset/config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"@module-federation/runtime-core",
2929
"create-module-federation",
3030
"@module-federation/cli",
31-
"@module-federation/rspress-plugin"
31+
"@module-federation/rspress-plugin",
32+
"@module-federation/metro",
33+
"@module-federation/metro-plugin-rnef",
34+
"@module-federation/metro-plugin-rnc-cli"
3235
]
3336
],
3437
"ignorePatterns": ["^alpha|^beta"],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@module-federation/metro-plugin-rnc-cli': patch
3+
'@module-federation/metro-plugin-rnef': patch
4+
'@module-federation/metro': patch
5+
---
6+
7+
Initial Release of Metro package

.github/workflows/build-and-test.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build Affected Packages
22

3+
permissions:
4+
contents: read
5+
36
on:
47
pull_request:
58
branches: [main, '**']
@@ -72,7 +75,10 @@ jobs:
7275
[ "$pkg" != "packages/core" ] && \
7376
[ "$pkg" != "packages/esbuild" ] && \
7477
[ "$pkg" != "packages/modernjs" ] && \
75-
[ "$pkg" != "packages/utilities" ]; then
78+
[ "$pkg" != "packages/utilities" ] && \
79+
[ "$pkg" != "packages/metro-core" ] && \
80+
[ "$pkg" != "packages/metro-plugin-rnef" ] && \
81+
[ "$pkg" != "packages/metro-plugin-rnc-cli" ]; then
7682
echo "Checking $pkg..."
7783
npx publint "$pkg"
7884
fi
@@ -134,3 +140,8 @@ jobs:
134140
needs: checkout-install
135141
uses: ./.github/workflows/e2e-router.yml
136142
secrets: inherit
143+
144+
build-metro:
145+
needs: checkout-install
146+
uses: ./.github/workflows/build-metro.yml
147+
secrets: inherit

.github/workflows/build-metro.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build Metro Packages
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
build-metro:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install Pnpm
20+
run: |
21+
corepack prepare [email protected] --activate
22+
corepack enable
23+
24+
- name: Setup Node.js 18
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: '18'
28+
cache: 'pnpm'
29+
30+
- name: Set Nx SHA
31+
uses: nrwl/nx-set-shas@v3
32+
33+
- name: Install Dependencies
34+
run: pnpm install
35+
36+
- name: Build All Required Packages
37+
run: |
38+
npx nx run-many --targets=build --projects=tag:type:pkg,tag:type:metro --parallel=4
39+
40+
- name: Test Metro Packages
41+
uses: nick-fields/retry@v3
42+
with:
43+
max_attempts: 2
44+
timeout_minutes: 5
45+
command: npx nx affected -t test --parallel=2 --exclude='*,!tag:type:metro'
46+
47+
- name: Lint Metro Packages
48+
run: npx nx run-many --targets=lint --projects=tag:type:metro --parallel=2
49+
50+
- name: Check Metro Package Publishing Compatibility
51+
run: |
52+
for pkg in packages/metro-*; do
53+
if [ -f "$pkg/package.json" ]; then
54+
echo "Checking $pkg..."
55+
npx publint "$pkg"
56+
fi
57+
done

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
run: |
5050
git fetch origin main
5151
npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
52+
npx nx run-many --targets=build --projects=tag:type:metro
5253
ls -l packages/*/dist packages/*/package.json
5354
5455
- name: Release
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
2+
import { defineConfig } from 'cypress';
3+
4+
export default defineConfig({
5+
e2e: {
6+
...nxE2EPreset(__filename, { cypressDir: 'cypress' }),
7+
baseUrl: 'http://localhost:8080',
8+
injectDocumentDomain: true,
9+
},
10+
defaultCommandTimeout: 20000,
11+
retries: {
12+
runMode: 2,
13+
openMode: 1,
14+
},
15+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
describe('ModernJS SSR Dynamic Nested Remote', () => {
2+
it('should load the app', () => {
3+
cy.visit('http://localhost:8080');
4+
cy.contains('dynamic-nested-remote');
5+
});
6+
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This file is processed and loaded automatically before your test files.
2+
// You can change the location of this file or turn off processing it by setting the
3+
// "supportFile" option to false.
4+
// You can read more here: https://on.cypress.io/configuration

apps/modernjs-ssr/dynamic-nested-remote/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "modernjs-ssr-dynamic-nested-remote",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"sourceRoot": "apps/modernjs-ssr/modernjs-ssr-dynamic-nested-remote/src",
4+
"sourceRoot": "apps/modernjs-ssr/dynamic-nested-remote/src",
55
"projectType": "application",
66
"tags": [],
77
"implicitDependencies": ["typescript"],
@@ -43,7 +43,7 @@
4343
"e2e": {
4444
"executor": "@nx/cypress:cypress",
4545
"options": {
46-
"cypressConfig": "apps/modernjs-ssr/modernjs-ssr-dynamic-nested-remote/cypress.config.ts",
46+
"cypressConfig": "apps/modernjs-ssr/dynamic-nested-remote/cypress.config.ts",
4747
"testingType": "e2e",
4848
"baseUrl": "http://localhost:4001",
4949
"browser": "chrome"

apps/modernjs-ssr/dynamic-remote-new-version/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "modernjs-ssr-dynamic-remote-new-version",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"sourceRoot": "apps/modernjs-ssr/modernjs-ssr-dynamic-remote-new-version/src",
4+
"sourceRoot": "apps/modernjs-ssr/dynamic-remote-new-version/src",
55
"projectType": "application",
66
"tags": [],
77
"implicitDependencies": ["typescript"],
@@ -43,7 +43,7 @@
4343
"e2e": {
4444
"executor": "@nx/cypress:cypress",
4545
"options": {
46-
"cypressConfig": "apps/modernjs-ssr/modernjs-ssr-dynamic-remote-new-version/cypress.config.ts",
46+
"cypressConfig": "apps/modernjs-ssr/dynamic-remote-new-version/cypress.config.ts",
4747
"testingType": "e2e",
4848
"baseUrl": "http://localhost:4001",
4949
"browser": "chrome"

0 commit comments

Comments
 (0)