Skip to content

Commit b27a52e

Browse files
authored
fix: upgrade packages, add workflow for testing (#113)
* fix: improve upgrade script * fix: broken examples * fix: remove qwik and add concurrency * fix: concurrency adjusted * fix adding manual types to overcome pnpm catalog react resolution * feat: proper scripts packages * chore: partial ts migration * chore: tests in ts * fix: adjust optional version parameter to update * fix: adjust test timeouts * fix: test validations * test: unifying tests * test: adjusting last tests * test: adjusting turbo and remaining test cases * fix: build packages inputs and build test workflow * fix: add setup action * fix: linting * fix: angular vite deps * fix: adjusting windows execution and Nx version issues * fix: adjusting dependencies * fix: more dependency issues * fix: deps * fix: moooooar dep issues * fix: final deps fixes * fix: last deps issues * fix: last cross-env missing * fix: allow missing validation to pass by skipping * fix: disable nx license
1 parent edd2ad5 commit b27a52e

File tree

183 files changed

+9762
-38025
lines changed

Some content is hidden

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

183 files changed

+9762
-38025
lines changed

.github/actions/setup/action.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Setup Node and PNPM
2+
description: Sets up Node.js and PNPM with caching
3+
4+
inputs:
5+
os:
6+
required: true
7+
description: 'Operating system'
8+
default: ubuntu-latest
9+
node-version:
10+
required: true
11+
description: 'Node.js version'
12+
default: '24'
13+
14+
runs:
15+
using: 'composite'
16+
steps:
17+
- uses: pnpm/action-setup@v4
18+
with:
19+
version: 10
20+
run_install: false
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ inputs.node-version }}
24+
cache: 'pnpm'
25+
cache-dependency-path: '**/pnpm-lock.yaml'
26+
registry-url: 'https://registry.npmjs.org'
27+
- name: Get pnpm store directory
28+
shell: bash
29+
run: |
30+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
31+
- uses: actions/cache@v4
32+
with:
33+
path: ${{ env.STORE_PATH }}
34+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
35+
restore-keys: |
36+
${{ runner.os }}-pnpm-store-
37+
- run: pnpm install --prefer-offline
38+
shell: bash
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Build, Deploy, and Test All Examples
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
skip_cache:
7+
description: "Skip build cache and force rebuild all packages"
8+
required: false
9+
default: true
10+
type: boolean
11+
plugin_version:
12+
description: "Zephyr plugin version to upgrade to (default: next)"
13+
required: false
14+
default: "next"
15+
type: string
16+
repository_dispatch:
17+
types: [build-deploy-test]
18+
19+
env:
20+
NODE_VERSION: "20"
21+
22+
jobs:
23+
build-deploy-test:
24+
name: Build, Deploy, and Test All Examples
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- uses: ./.github/actions/setup
31+
with:
32+
node-version: ${{ env.NODE_VERSION }}
33+
34+
- name: Upgrade Zephyr plugins
35+
run: |
36+
cd scripts
37+
if [ -n "${{ github.event.inputs.plugin_version }}" ]; then
38+
echo "Upgrading plugins to version: ${{ github.event.inputs.plugin_version }}"
39+
pnpm upgrade-plugins --version=${{ github.event.inputs.plugin_version }}
40+
elif [ -n "${{ github.event.client_payload.plugin_version }}" ]; then
41+
echo "Upgrading plugins to version: ${{ github.event.client_payload.plugin_version }}"
42+
pnpm upgrade-plugins --version=${{ github.event.client_payload.plugin_version }}
43+
else
44+
echo "Upgrading plugins to latest (next)"
45+
pnpm upgrade-plugins
46+
fi
47+
48+
- name: Install dependencies after upgrade
49+
run: pnpm install --prefer-offline
50+
51+
- name: Build all examples
52+
run: |
53+
cd scripts
54+
if [ "${{ github.event.inputs.skip_cache }}" == "true" ] || [ "${{ github.event.client_payload.skip_cache }}" == "true" ]; then
55+
echo "Building with --skip-cache flag"
56+
pnpm build-packages:force
57+
else
58+
echo "Building with cache enabled"
59+
pnpm build-packages
60+
fi
61+
env:
62+
NODE_ENV: production
63+
64+
- name: Wait for deployments to be ready
65+
run: |
66+
echo "Waiting 60 seconds for all deployments to propagate..."
67+
sleep 60
68+
69+
- name: Install Playwright browsers
70+
run: |
71+
cd scripts
72+
npx playwright install chromium
73+
74+
- name: Run deployment validation tests
75+
run: |
76+
cd scripts
77+
pnpm test
78+
env:
79+
CI: true
80+
81+
- name: Upload test results
82+
uses: actions/upload-artifact@v4
83+
if: always()
84+
with:
85+
name: test-results
86+
path: |
87+
scripts/test-results/
88+
scripts/playwright-report/
89+
retention-days: 7
90+
91+
- name: Upload build logs
92+
uses: actions/upload-artifact@v4
93+
if: always()
94+
with:
95+
name: build-logs
96+
path: |
97+
scripts/tmp/build/
98+
retention-days: 3

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ dist
2323
*/**/.__mf__temp
2424

2525
.parcel-cache
26+
*.tsbuildinfo
27+
tmp
28+
29+
# Playwright test results
30+
scripts/test-results/
31+
scripts/playwright-report/
32+
test-results/
33+
playwright-report/

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ Once you've forked this repository, you can clone it and follow the instructions
2222
A monorepo using Nx, Angular v15, and Webpack as the bundler.
2323
* __[`parce-react`](./examples/parcel-react)__
2424
A parcel and react application.
25-
* __[`qwik-1.5`](./examples/qwik-1.5)__
26-
A Qwik v1.5 app using Vite as the bundler.
2725
* __[`react-airbnb-clone`](./examples/react-airbnb-clone)__
2826
An AirBnb clone using React, Module Federation and Rspack as the bundler.
2927
* __[`react-rollup-ts`](./examples/react-rollup-ts)__
@@ -85,7 +83,6 @@ For more information on using Zephyr Cloud, visit the [official documentation][d
8583
:white_check_mark: `create-nx-rspack-workspace-mf`
8684
:white_check_mark: `create-nx-workspace-mf`
8785
:white_check_mark: `nx-ng`
88-
:x: `qwik-1.5` - rework plugin support
8986
:white_check_mark: `react-airbnb-clone`
9087
:white_check_mark: `react-rollup-ts`
9188
:white_check_mark: `react-rspack-tractor-2.0`

examples/angular-vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"@angular/build": "catalog:angular19",
2727
"@angular/compiler-cli": "catalog:angular19",
2828
"typescript": "catalog:typescript",
29-
"vite": "catalog:vite5"
29+
"vite": "catalog:vite6"
3030
}
3131
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "basehref-examples",
3+
"version": "1.0.0",
4+
"description": "Examples demonstrating base href configuration with different bundlers",
5+
"private": true,
6+
"scripts": {
7+
"build": "pnpm --filter basehref-rspack-app build && pnpm --filter basehref-vite-app build && pnpm --filter basehref-webpack-app build",
8+
"build:rspack": "pnpm --filter basehref-rspack-app build",
9+
"build:vite": "pnpm --filter basehref-vite-app build",
10+
"build:webpack": "pnpm --filter basehref-webpack-app build",
11+
"build:base": "pnpm --filter basehref-rspack-app build:base && pnpm --filter basehref-vite-app build:base && pnpm --filter basehref-webpack-app build:base",
12+
"build:base:rspack": "pnpm --filter basehref-rspack-app build:base",
13+
"build:base:vite": "pnpm --filter basehref-vite-app build:base",
14+
"build:base:webpack": "pnpm --filter basehref-webpack-app build:base"
15+
},
16+
"keywords": [
17+
"basehref",
18+
"rspack",
19+
"vite",
20+
"webpack",
21+
"react",
22+
"zephyr"
23+
],
24+
"repository": {
25+
"type": "git",
26+
"url": "https://github.com/zephyrcloud/zephyr-examples",
27+
"directory": "examples/basehref-examples"
28+
}
29+
}

examples/basehref-examples/rspack-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"zephyr-rspack-plugin": "catalog:zephyr"
1515
},
1616
"devDependencies": {
17-
"@rspack/cli": "catalog:rspack",
18-
"@rspack/core": "catalog:rspack",
17+
"@rspack/cli": "1.5.5",
18+
"@rspack/core": "1.5.5",
1919
"@rspack/plugin-react-refresh": "catalog:rspack",
2020
"@types/react": "catalog:react19",
2121
"@types/react-dom": "catalog:react19",
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from "@rspack/cli";
1+
import type { Configuration } from "@rspack/cli";
22
import { rspack } from "@rspack/core";
33
import * as RefreshPlugin from "@rspack/plugin-react-refresh";
44
import { withZephyr } from "zephyr-rspack-plugin";
@@ -9,67 +9,67 @@ const publicPath = process.env.PUBLIC_PATH || "/";
99

1010
const targets = ["chrome >= 87", "edge >= 88", "firefox >= 78", "safari >= 14"];
1111

12-
export default withZephyr()(
13-
defineConfig({
14-
output: {
15-
publicPath,
16-
},
17-
context: __dirname,
18-
entry: {
19-
main: "./src/main.tsx",
20-
},
21-
resolve: {
22-
extensions: ["...", ".ts", ".tsx", ".jsx"],
23-
},
24-
module: {
25-
rules: [
26-
{
27-
test: /\.svg$/,
28-
type: "asset",
29-
},
30-
{
31-
test: /\.(jsx?|tsx?)$/,
32-
use: [
33-
{
34-
loader: "builtin:swc-loader",
35-
options: {
36-
jsc: {
37-
parser: {
38-
syntax: "typescript",
39-
tsx: true,
40-
},
41-
transform: {
42-
react: {
43-
runtime: "automatic",
44-
development: isDev,
45-
refresh: isDev,
46-
},
12+
const config: Configuration = {
13+
output: {
14+
publicPath,
15+
},
16+
context: __dirname,
17+
entry: {
18+
main: "./src/main.tsx",
19+
},
20+
resolve: {
21+
extensions: ["...", ".ts", ".tsx", ".jsx"],
22+
},
23+
module: {
24+
rules: [
25+
{
26+
test: /\.svg$/,
27+
type: "asset",
28+
},
29+
{
30+
test: /\.(jsx?|tsx?)$/,
31+
use: [
32+
{
33+
loader: "builtin:swc-loader",
34+
options: {
35+
jsc: {
36+
parser: {
37+
syntax: "typescript",
38+
tsx: true,
39+
},
40+
transform: {
41+
react: {
42+
runtime: "automatic",
43+
development: isDev,
44+
refresh: isDev,
4745
},
4846
},
49-
env: { targets },
5047
},
48+
env: { targets },
5149
},
52-
],
53-
},
54-
],
55-
},
56-
plugins: [
57-
new rspack.HtmlRspackPlugin({
58-
template: "./index.html",
59-
publicPath,
50+
},
51+
],
52+
},
53+
],
54+
},
55+
plugins: [
56+
new rspack.HtmlRspackPlugin({
57+
template: "./index.html",
58+
publicPath,
59+
}),
60+
isDev ? new RefreshPlugin() : null,
61+
].filter(Boolean),
62+
optimization: {
63+
minimizer: [
64+
new rspack.SwcJsMinimizerRspackPlugin(),
65+
new rspack.LightningCssMinimizerRspackPlugin({
66+
minimizerOptions: { targets },
6067
}),
61-
isDev ? new RefreshPlugin() : null,
62-
].filter(Boolean),
63-
optimization: {
64-
minimizer: [
65-
new rspack.SwcJsMinimizerRspackPlugin(),
66-
new rspack.LightningCssMinimizerRspackPlugin({
67-
minimizerOptions: { targets },
68-
}),
69-
],
70-
},
71-
experiments: {
72-
css: true,
73-
},
74-
})
75-
);
68+
],
69+
},
70+
experiments: {
71+
css: true,
72+
},
73+
};
74+
75+
export default withZephyr()(config);

examples/basehref-examples/webpack-app/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require('path');
1+
const path = require('node:path');
22
const HtmlWebpackPlugin = require('html-webpack-plugin');
33
const { withZephyr } = require('zephyr-webpack-plugin');
44

examples/create-nx-rspack-workspace-mf/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ A comprehensive Nx workspace demonstrating Module Federation architecture with R
2222
This Nx workspace consists of three federated applications:
2323

2424
- **`host/`** - Host application that orchestrates the micro-frontends
25-
- **`remote1/`** - Remote application exposing shared components
26-
- **`remote2/`** - Another remote application with independent functionality
25+
- **`rspack_remote1/`** - Remote application exposing shared components
26+
- **`rspack_remote2/`** - Another remote application with independent functionality
2727

2828
## Getting Started
2929

@@ -36,13 +36,13 @@ This Nx workspace consists of three federated applications:
3636

3737
Start all applications concurrently:
3838
```bash
39-
npx nx run-many --target=serve --projects=remote1,remote2,host --parallel
39+
npx nx run-many --target=serve --projects=rspack_remote1,rspack_remote2,host --parallel
4040
```
4141

4242
Or start individually:
4343
```bash
44-
npx nx serve remote1
45-
npx nx serve remote2
44+
npx nx serve rspack_remote1
45+
npx nx serve rspack_remote2
4646
npx nx serve host
4747
```
4848

@@ -51,8 +51,8 @@ This Nx workspace consists of three federated applications:
5151
Because this is a Module Federation setup, remotes must be built before the host:
5252

5353
```bash
54-
npx nx run remote1:build
55-
npx nx run remote2:build
54+
npx nx run rspack_remote1:build
55+
npx nx run rspack_remote2:build
5656
npx nx run host:build
5757
```
5858

0 commit comments

Comments
 (0)