diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index ab229901..7f5d4c8c 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -4,15 +4,15 @@ description: Sets up Node.js and PNPM with caching inputs: os: required: true - description: 'Operating system' + description: "Operating system" default: ubuntu-latest node-version: required: true - description: 'Node.js version' - default: '24' + description: "Node.js version" + default: "24" runs: - using: 'composite' + using: "composite" steps: - uses: pnpm/action-setup@v4 with: @@ -21,9 +21,9 @@ runs: - uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} - cache: 'pnpm' - cache-dependency-path: '**/pnpm-lock.yaml' - registry-url: 'https://registry.npmjs.org' + cache: "pnpm" + cache-dependency-path: "**/pnpm-lock.yaml" + registry-url: "https://registry.npmjs.org" - name: Get pnpm store directory shell: bash run: | @@ -34,5 +34,15 @@ runs: key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - - run: pnpm install --prefer-offline + - name: Install dependencies in all workspaces shell: bash + run: | + echo "Installing dependencies in nx workspace..." + cd nx && pnpm install --prefer-offline + echo "Installing dependencies in vanilla workspace..." + cd ../vanilla && pnpm install --prefer-offline + echo "Installing dependencies in turborepo workspace..." + cd ../turborepo && pnpm install --prefer-offline + echo "Installing dependencies in scripts..." + cd ../scripts && pnpm install --prefer-offline + echo "✓ All dependencies installed" diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index a16fc5b9..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,14 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - -version: 2 -updates: - - package-ecosystem: "npm" - directory: "/examples" # Location of package manifests - schedule: - interval: "monthly" # so we don't get buried in dependabot PR - - - diff --git a/.github/workflows/build-deploy-test.yml b/.github/workflows/build-deploy-test.yml index ffc5ca93..8f175c39 100644 --- a/.github/workflows/build-deploy-test.yml +++ b/.github/workflows/build-deploy-test.yml @@ -24,6 +24,26 @@ on: type: string repository_dispatch: types: [build-deploy-test] + pull_request: + branches: + - main + paths: + - "nx/**" + - "vanilla/**" + - "turborepo/**" + - "scripts/**" + - ".github/workflows/**" + - ".github/actions/**" + push: + branches: + - main + paths: + - "nx/**" + - "vanilla/**" + - "turborepo/**" + - "scripts/**" + - ".github/workflows/**" + - ".github/actions/**" env: NODE_VERSION: "24" @@ -54,11 +74,36 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: ./.github/actions/setup + - uses: pnpm/action-setup@v4 + with: + version: 10.6.3 + run_install: false + + - uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} + registry-url: "https://registry.npmjs.org" + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ env.STORE_PATH }} + key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + pnpm-store-${{ runner.os }}- + + - name: Install scripts dependencies + run: | + cd scripts + pnpm install --prefer-offline - name: Upgrade Zephyr plugins + if: github.event_name != 'pull_request' && github.event_name != 'push' run: | cd scripts if [ -n "${{ github.event.inputs.plugin_version }}" ]; then @@ -72,21 +117,98 @@ jobs: pnpm upgrade-plugins fi - - name: Install dependencies after upgrade - run: pnpm install --prefer-offline + - name: Install vanilla dependencies + run: | + cd vanilla + pnpm install --prefer-offline + + - name: Install nx example dependencies + run: | + cd nx/examples + for example in */; do + if [ -f "${example}package.json" ]; then + echo "Installing dependencies for nx/${example}" + cd "$example" + pnpm install --prefer-offline + cd .. + fi + done + + - name: Install turborepo example dependencies + run: | + cd turborepo/examples + for example in */; do + if [ -f "${example}package.json" ]; then + echo "Installing dependencies for turborepo/${example}" + cd "$example" + pnpm install --prefer-offline + cd .. + fi + done + + - name: Clean zephyr cache before build + run: | + echo "Cleaning $HOME/.zephyr directory..." + if [ -d "$HOME/.zephyr" ]; then + echo "Found existing .zephyr directory, checking contents:" + ls -lah "$HOME/.zephyr/" || true + echo "Removing .zephyr directory..." + rm -rf "$HOME/.zephyr" + fi + echo "Creating fresh .zephyr directory..." + mkdir -p "$HOME/.zephyr" - name: Build all examples run: | cd scripts if [ "${{ github.event.inputs.skip_cache }}" == "true" ] || [ "${{ github.event.client_payload.skip_cache }}" == "true" ]; then - echo "Building with --skip-cache flag" - pnpm build-packages:force + echo "Building all examples with --skip-cache flag" + pnpm build-packages --skip-cache else - echo "Building with cache enabled" + echo "Building all examples with cache enabled" pnpm build-packages fi env: NODE_ENV: production + ZE_SECRET_TOKEN: ${{ env.ZE_SECRET_TOKEN }} + ZE_API_GATE: ${{ env.ZE_API_GATE }} + ZE_API: ${{ env.ZE_API }} + + - name: Check zephyr cache after build + if: always() + run: | + echo "Checking $HOME/.zephyr after build..." + if [ -d "$HOME/.zephyr" ]; then + echo "Total files: $(ls -1 "$HOME/.zephyr" 2>/dev/null | wc -l)" + echo "Checking for subdirectories that might cause EISDIR error:" + find "$HOME/.zephyr" -type d 2>/dev/null || echo "No subdirectories found" + echo "" + echo "Files and directories in .zephyr:" + ls -lah "$HOME/.zephyr/" 2>/dev/null | head -30 || echo "Cannot list directory" + else + echo "$HOME/.zephyr does not exist" + fi + + - name: Upload build logs + uses: actions/upload-artifact@v4 + if: always() + with: + name: build-logs + path: scripts/tmp/build/ + retention-days: 3 + + - name: Check zephyr cache contents + run: | + echo "Checking $HOME/.zephyr directory..." + if [ -d "$HOME/.zephyr" ]; then + echo "Files and directories in .zephyr:" + ls -lah "$HOME/.zephyr/" | head -30 + echo "" + echo "Checking for subdirectories:" + find "$HOME/.zephyr" -type d | head -10 + else + echo "$HOME/.zephyr does not exist" + fi - name: Wait for deployments to be ready run: | @@ -104,6 +226,9 @@ jobs: pnpm test env: CI: true + ZE_SECRET_TOKEN: ${{ env.ZE_SECRET_TOKEN }} + ZE_API_GATE: ${{ env.ZE_API_GATE }} + ZE_API: ${{ env.ZE_API }} - name: Upload test results uses: actions/upload-artifact@v4 @@ -114,12 +239,3 @@ jobs: scripts/test-results/ scripts/playwright-report/ retention-days: 7 - - - name: Upload build logs - uses: actions/upload-artifact@v4 - if: always() - with: - name: build-logs - path: | - scripts/tmp/build/ - retention-days: 3 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..a45fd52c --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +24 diff --git a/EXAMPLES_INVENTORY.md b/EXAMPLES_INVENTORY.md new file mode 100644 index 00000000..9721771f --- /dev/null +++ b/EXAMPLES_INVENTORY.md @@ -0,0 +1,295 @@ +# Examples Inventory & Standardization Plan + +This document catalogs all examples across the three directories (vanilla, nx, turborepo) and identifies standardization opportunities. + +## Current Inventory + +### Vanilla (23 examples) +1. angular-vite +2. basehref-examples +3. create-default-webpack-mf +4. create-mf-app-rspack +5. ember-vite +6. modernjs-app +7. ng-mf +8. parcel-react +9. plugin-testing +10. qwik-1.5 +11. react-airbnb-clone +12. react-rollup-ts +13. react-rspack-tractor-2.0 +14. react-tractor-sample +15. react-vite-mf +16. react-vite-ts +17. rolldown-react +18. rspack-project +19. rspress-ssg +20. solid +21. svelte +22. tsdown +23. vitepress + +### NX (4 examples) +1. create-nx-rspack-workspace-mf +2. create-nx-workspace-mf +3. nx-ng +4. react-vite-nx + +### Turborepo (1 example) +1. mf-turbo-rspack + +--- + +## Categorization by Technology + +### React Examples + +#### Vanilla +- `create-default-webpack-mf` - React + Webpack + Module Federation +- `create-mf-app-rspack` - React + Rspack + (likely MF) +- `react-airbnb-clone` - React + Rspack + Module Federation +- `react-rollup-ts` - React + Rollup + TypeScript +- `react-rspack-tractor-2.0` - React + Rspack (monorepo) +- `react-tractor-sample` - React + Webpack (monorepo) +- `react-vite-mf` - React + Vite + Module Federation +- `react-vite-ts` - React + Vite + TypeScript +- `rolldown-react` - React + Rolldown +- `rspack-project` - React + Rspack + +#### NX +- `create-nx-rspack-workspace-mf` - React + Rspack + Module Federation + NX +- `create-nx-workspace-mf` - React + Webpack + Module Federation + NX +- `react-vite-nx` - React + Vite + NX + +#### Turborepo +- `mf-turbo-rspack` - React + Rspack + Module Federation + Turborepo + +### Angular Examples + +#### Vanilla +- `angular-vite` - Angular + Vite +- `ng-mf` - Angular + Module Federation + +#### NX +- `nx-ng` - Angular v15 + Webpack + NX + +### Other Frameworks + +#### Vanilla +- `solid` - SolidJS +- `svelte` - Svelte +- `qwik-1.5` - Qwik +- `ember-vite` - Ember + Vite + +### Bundler/Build Tool Examples + +#### Vanilla +- `parcel-react` - Parcel bundler +- `modernjs-app` - ModernJS framework +- `rspress-ssg` - Rspress SSG +- `vitepress` - VitePress documentation +- `rolldown-react` - Rolldown bundler +- `tsdown` - TypeScript bundler + +### Utility/Testing Examples + +#### Vanilla +- `basehref-examples` - Base href examples +- `plugin-testing` - Plugin testing utilities + +--- + +## Standardization Opportunities + +### ✅ Already Standardized Across All Three + +**React + Rspack + Module Federation** +- ✅ Vanilla: `mf-turbo-rspack` equivalent exists as multiple examples +- ✅ NX: `create-nx-rspack-workspace-mf` +- ✅ Turborepo: `mf-turbo-rspack` + +### 🎯 Should Be Standardized (High Priority) + +#### 1. React + Vite + TypeScript (Simple) +- ✅ Vanilla: `react-vite-ts` +- ✅ NX: `react-vite-nx` +- ❌ Turborepo: **MISSING** - Should add `turbo-react-vite` + +#### 2. React + Webpack + Module Federation +- ✅ Vanilla: `create-default-webpack-mf` +- ✅ NX: `create-nx-workspace-mf` +- ❌ Turborepo: **MISSING** - Should add `turbo-webpack-mf` + +#### 3. Angular + Vite +- ✅ Vanilla: `angular-vite` +- ✅ NX: `nx-ng` (uses Webpack, should add Vite version) +- ❌ Turborepo: **MISSING** - Should add `turbo-angular-vite` + +#### 4. React + Rspack (Simple, no MF) +- ✅ Vanilla: `rspack-project` +- ❌ NX: **MISSING** - Should add `nx-rspack-simple` +- ❌ Turborepo: **MISSING** - Should add `turbo-rspack-simple` + +### 🔄 Framework Diversity (Medium Priority) + +#### 5. SolidJS +- ✅ Vanilla: `solid` +- ❌ NX: **MISSING** - Should add `nx-solid` +- ❌ Turborepo: **MISSING** - Should add `turbo-solid` + +#### 6. Svelte +- ✅ Vanilla: `svelte` +- ❌ NX: **MISSING** - Should add `nx-svelte` +- ❌ Turborepo: **MISSING** - Should add `turbo-svelte` + +### 📚 Advanced Patterns (Lower Priority) + +#### 7. React + Rollup +- ✅ Vanilla: `react-rollup-ts` +- ❌ NX: **MISSING** +- ❌ Turborepo: **MISSING** + +#### 8. React + Rolldown (Experimental) +- ✅ Vanilla: `rolldown-react` +- ❌ NX: **MISSING** +- ❌ Turborepo: **MISSING** + +--- + +## Proposed Standard Example Set + +Each directory should have these core examples: + +### Core Set (All Three Directories) + +#### React Examples +1. **react-vite-simple** - React + Vite + TypeScript (simple app) +2. **react-vite-mf** - React + Vite + Module Federation +3. **react-webpack-mf** - React + Webpack + Module Federation +4. **react-rspack-simple** - React + Rspack (simple app) +5. **react-rspack-mf** - React + Rspack + Module Federation + +#### Angular Examples +6. **angular-vite** - Angular + Vite +7. **angular-webpack-mf** - Angular + Webpack + Module Federation + +#### Other Frameworks +8. **solid-vite** - SolidJS + Vite +9. **svelte-vite** - Svelte + Vite + +### Extended Set (Vanilla Only) + +Keep these specialized examples in vanilla only: +- `qwik-1.5` - Qwik framework +- `ember-vite` - Ember framework +- `parcel-react` - Parcel bundler showcase +- `modernjs-app` - ModernJS framework +- `rolldown-react` - Rolldown bundler (experimental) +- `rspress-ssg` - Rspress SSG +- `vitepress` - VitePress documentation +- `basehref-examples` - Utility examples +- `plugin-testing` - Testing utilities + +--- + +## Migration Action Items + +### For NX Directory + +**Add:** +1. `nx-rspack-simple` - Simple React + Rspack without MF +2. `nx-solid-vite` - SolidJS example +3. `nx-svelte-vite` - Svelte example + +**Rename/Refactor:** +1. `create-nx-workspace-mf` → `nx-react-webpack-mf` (more consistent naming) +2. `create-nx-rspack-workspace-mf` → `nx-react-rspack-mf` (more consistent naming) +3. `react-vite-nx` → `nx-react-vite-simple` (more consistent naming) +4. `nx-ng` → `nx-angular-webpack` (more descriptive) + +### For Turborepo Directory + +**Add:** +1. `turbo-react-vite-simple` - React + Vite + TypeScript +2. `turbo-react-webpack-mf` - React + Webpack + Module Federation +3. `turbo-react-rspack-simple` - React + Rspack without MF +4. `turbo-angular-vite` - Angular + Vite +5. `turbo-solid-vite` - SolidJS example +6. `turbo-svelte-vite` - Svelte example + +**Rename/Refactor:** +1. `mf-turbo-rspack` → `turbo-react-rspack-mf` (more explicit about React) + +### For Vanilla Directory + +**Rename/Refactor for Consistency:** +1. `react-vite-ts` → `react-vite-simple` (align with other directories) +2. `create-default-webpack-mf` → `react-webpack-mf` (simpler naming) +3. `create-mf-app-rspack` → `react-rspack-mf` (simpler naming) +4. `rspack-project` → `react-rspack-simple` (more descriptive) +5. `react-vite-mf` → Keep as is (already well-named) +6. `angular-vite` → Keep as is (already well-named) +7. `ng-mf` → `angular-webpack-mf` (more descriptive) +8. `solid` → `solid-vite` (include bundler) +9. `svelte` → `svelte-vite` (include bundler) + +**Consider Removing/Archiving:** +- `react-tractor-sample` (redundant with other examples) +- `react-rspack-tractor-2.0` (redundant with other examples) +- `react-airbnb-clone` (nice demo but not core) + +--- + +## Naming Convention + +Going forward, use this naming pattern: + +### For Vanilla: +`{framework}-{bundler}-{feature}` + +Examples: +- `react-vite-simple` +- `react-webpack-mf` +- `angular-vite` + +### For NX: +`nx-{framework}-{bundler}-{feature}` + +Examples: +- `nx-react-vite-simple` +- `nx-react-webpack-mf` +- `nx-angular-vite` + +### For Turborepo: +`turbo-{framework}-{bundler}-{feature}` + +Examples: +- `turbo-react-vite-simple` +- `turbo-react-webpack-mf` +- `turbo-angular-vite` + +**Where:** +- `{framework}` = react, angular, solid, svelte, etc. +- `{bundler}` = vite, webpack, rspack, rollup, etc. +- `{feature}` = simple, mf (module federation), or specific feature + +--- + +## Summary + +**Current State:** +- Vanilla: 23 examples (comprehensive but inconsistent naming) +- NX: 4 examples (minimal coverage) +- Turborepo: 1 example (very minimal) + +**Standardized State Goal:** +- Vanilla: 9 core + specialized examples (~15-20 total) +- NX: 9 core examples (matching vanilla core set) +- Turborepo: 9 core examples (matching vanilla core set) + +**Benefits:** +- ✅ Consistent naming across all three directories +- ✅ Easy to compare same example across different monorepo tools +- ✅ Clear demonstration of each monorepo tool's strengths +- ✅ Reduced confusion for users +- ✅ Easier maintenance and testing diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..095ead12 --- /dev/null +++ b/Justfile @@ -0,0 +1,182 @@ +# List all available commands +default: + @just --list + +# Install dependencies in all directories +install-all: + @echo "Installing vanilla dependencies..." + cd vanilla && pnpm install + @echo "Installing nx examples..." + cd nx/examples/mf-nx-rspack && pnpm install + @echo "Installing turborepo examples..." + cd turborepo/examples/mf-turbo-rspack && pnpm install + @echo "Installing scripts dependencies..." + cd scripts && pnpm install + @echo "✓ All dependencies installed" + +# Install dependencies in vanilla directory +install-vanilla: + cd vanilla && pnpm install + +# Install dependencies in nx examples +install-nx: + cd nx/examples/mf-nx-rspack && pnpm install + +# Install dependencies in turborepo examples +install-turborepo: + cd turborepo/examples/mf-turbo-rspack && pnpm install + +# Clean all node_modules in all directories +clean: + @echo "Cleaning vanilla..." + cd vanilla && pnpm remove-all-node-modules + @echo "Cleaning nx..." + cd nx && find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + + @echo "Cleaning turborepo..." + cd turborepo && find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + + @echo "✓ All node_modules removed" + +# Clean node_modules in vanilla directory +clean-vanilla: + cd vanilla && pnpm remove-all-node-modules + +# Clean node_modules in nx directory +clean-nx: + cd nx && find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + + +# Clean node_modules in turborepo directory +clean-turborepo: + cd turborepo && find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + + +# Clean all dist folders in all directories +clean-dist-all: + @echo "Cleaning vanilla dist..." + cd vanilla && pnpm remove-all-dist + @echo "Cleaning nx dist..." + cd nx && find . -name 'dist' -type d -prune -exec rm -rf '{}' + + @echo "Cleaning turborepo dist..." + cd turborepo && find . -name 'dist' -type d -prune -exec rm -rf '{}' + + @echo "✓ All dist folders removed" + +# Clean dist folders in vanilla directory +clean-dist-vanilla: + cd vanilla && pnpm remove-all-dist + +# Clean dist folders in nx directory +clean-dist-nx: + cd nx && find . -name 'dist' -type d -prune -exec rm -rf '{}' + + +# Clean dist folders in turborepo directory +clean-dist-turborepo: + cd turborepo && find . -name 'dist' -type d -prune -exec rm -rf '{}' + + +# Build a specific example in vanilla directory +build-vanilla example: + cd vanilla/examples/{{ example }} && pnpm build + +# Build a specific example in nx directory +build-nx example: + cd nx/examples/{{ example }} && pnpm build + +# Build a specific example in turborepo directory +build-turborepo example: + cd turborepo/examples/{{ example }} && pnpm build + +# Full reset - clean everything and reinstall +reset-all: clean clean-dist-all install-all + @echo "✓ Full reset complete" + +# Reset vanilla directory +reset-vanilla: clean-vanilla clean-dist-vanilla install-vanilla + @echo "✓ Vanilla reset complete" + +# Reset nx directory +reset-nx: clean-nx clean-dist-nx install-nx + @echo "✓ NX reset complete" + +# Reset turborepo directory +reset-turborepo: clean-turborepo clean-dist-turborepo install-turborepo + @echo "✓ Turborepo reset complete" + +# Build all vanilla examples in every environment +build-all-vanilla: + #!/usr/bin/env bash + set -euo pipefail + + echo "Building all vanilla examples..." + cd vanilla/examples + for d in */; do + [ -d "$d" ] || continue + echo "→ Building $d" + (cd "$d" && pnpm build) + done + cd ../.. + + echo "✓ All vanilla examples built successfully" + +# Build all nx examples in every environment +build-all-nx: + #!/usr/bin/env bash + set -euo pipefail + + echo "Building all nx examples..." + cd nx/examples + for d in */; do + [ -d "$d" ] || continue + echo "→ Building $d" + (cd "$d" && pnpm build) + done + cd ../.. + + echo "✓ All nx examples built successfully" + +# Build all turborepo examples in every environment +build-all-turborepo: + #!/usr/bin/env bash + set -euo pipefail + + echo "Building all turborepo examples..." + cd turborepo/examples + for d in */; do + [ -d "$d" ] || continue + echo "→ Building $d" + (cd "$d" && pnpm build) + done + cd ../.. + + echo "✓ All turborepo examples built successfully" + +# Build all examples in every environment +build-all: + #!/usr/bin/env bash + set -euo pipefail + + echo "Building all vanilla examples..." + cd vanilla/examples + for d in */; do + [ -d "$d" ] || continue + echo "→ Building $d" + (cd "$d" && pnpm build) + done + cd ../.. + + echo "Building all nx examples..." + cd nx/examples + for d in */; do + [ -d "$d" ] || continue + echo "→ Building $d" + (cd "$d" && pnpm build) + done + cd ../.. + + echo "Building all turborepo examples..." + cd turborepo/examples + for d in */; do + [ -d "$d" ] || continue + echo "→ Building $d" + (cd "$d" && pnpm build) + done + cd ../.. + + echo "✓ All examples built successfully" + diff --git a/README.md b/README.md index a7a89d7f..776620e9 100644 --- a/README.md +++ b/README.md @@ -6,91 +6,131 @@ A selection of bundlers, frameworks, and patterns are used. Each example project comes with Zephyr Cloud enabled. Once you've forked this repository, you can clone it and follow the instructions to [build and deploy](#deploying-an-example-project) to your Zephyr Cloud account. -* __[`angular-vite`](./examples/angular-vite)__ - A React application with Module Federation, using Rspack as the bundler. -* __[`create-default-webpack-mf`](./examples/create-default-webpack-mf)__ - A React application with Module Federation, using Rspack as the bundler. -* __[`create-mf-app-rspack`](./examples/create-mf-app-rspack)__ - A React application using Rspack as the bundler. -* __[`create-nx-rspack-workpace-mf`](./examples/create-nx-rspack-workpace-mf)__ - A monorepo using Nx, React, Module Federation, and Rspack as the bundler. -* __[`create-nx-workspace-mf`](./examples/create-nx-workspace-mf)__ - A monorepo using Nx, React, Module Federation, and Webpack as the bundler. -* __[`modernjs-app`](./examples/modernjs-app)__ - A ModernJS app with React and Rspack as the bundler. -* __[`ng-nx`](./examples/ng-nx)__ - A monorepo using Nx, Angular v15, and Webpack as the bundler. -* __[`parce-react`](./examples/parcel-react)__ - A parcel and react application. -* __[`react-airbnb-clone`](./examples/react-airbnb-clone)__ - An AirBnb clone using React, Module Federation and Rspack as the bundler. -* __[`react-rollup-ts`](./examples/react-rollup-ts)__ - A React and rollup application. -* __[`react-rspack-tractor-2.0`](./examples/react-rspack-tractor-2.0)__ - A monorepo using pnpm workspace, React, and Rspack as the bundler. -* __[`react-tractor-sample`](./examples/react-tractor-sample)__ - A monorepo using Nx, React, and Webpack as the bundler. -* __[`react-vite-mf`](./examples/react-vite-mf)__ - A monorepo using pnpm workspace, Module Federation, React, and Vite as the bundler. -* __[`react-vite-nx`](./examples/react-vite-nx)__ - A monorepo using Nx, React, and Vite as the bundler. -* __[`react-vite-ts`](./examples/react-vite-ts)__ - A React application built in TypeScript, using Vite as the bundler. -* __[`rolldown-react`](./examples/rolldown-react)__ - A React app with Rolldown as the bundler. -* __[`rspack-project`](./examples/rspack-project)__ - A simple Rspack application using React. -* __[`solid`](./examples/solid)__ - An application using SolidJS. -* __[`turbo-rspack-mf`](./examples/turbo-rspack-mf/)__ - A monorepo using Turborepo, React, and Rspack as the bundler. - -## Deploying an example project -After cloning your fork of this repository locally, follow these steps: - -1. __Install dependencies__ - ```shell - pnpm i - ``` -2. __Change directory to the example codebase__ - For example, if you want to run the `create-default-webpack-mf` example: - - ```shell - cd ./examples/create-default-webpack-mf - ``` -3. __Build the project__ - ```shell - pnpm build - ``` +## Repository Structure + +This repository is organized into three independent directories, each with its own build system: + +### 📁 `/vanilla` - pnpm Workspaces +Simple examples without any monorepo build system. Uses pnpm workspaces for dependency management. + +**Examples:** +- `angular-vite` - Angular application with Vite +- `basehref-examples` - Base href examples +- `create-default-webpack-mf` - React with Module Federation and Webpack +- `create-mf-app-rspack` - React with Rspack +- `ember-vite` - Ember with Vite +- `modernjs-app` - ModernJS app with React and Rspack +- `ng-mf` - Angular with Module Federation +- `parcel-react` - Parcel and React application +- `plugin-testing` - Plugin testing examples +- `qwik-1.5` - Qwik application +- `react-airbnb-clone` - AirBnb clone with React, Module Federation and Rspack +- `react-rollup-ts` - React with Rollup +- `react-rspack-tractor-2.0` - React with Rspack +- `react-tractor-sample` - React with Webpack +- `react-vite-mf` - React with Vite and Module Federation +- `react-vite-ts` - React with TypeScript and Vite +- `rolldown-react` - React with Rolldown +- `rspack-project` - Simple Rspack with React +- `rspress-ssg` - Rspress SSG +- `solid` - SolidJS application +- `svelte` - Svelte application +- `tsdown` - TypeScript bundler example +- `vitepress` - VitePress documentation + +### 📁 `/nx` - NX Monorepo +Examples built with NX monorepo system. + +**Examples:** +- `create-nx-workspace-mf` - NX with React, Module Federation, and Webpack +- `create-nx-rspack-workspace-mf` - NX with React, Module Federation, and Rspack +- `react-vite-nx` - NX with React and Vite +- `nx-ng` - NX with Angular v15 and Webpack + +### 📁 `/turborepo` - Turborepo +Examples built with Turborepo monorepo system. + +**Examples:** +- `mf-turbo-rspack` - Turborepo with React and Rspack + +## Working with Examples + +Each directory (`vanilla`, `nx`, `turborepo`) is **completely independent** and has its own: +- `package.json` - Dependency management +- `pnpm-workspace.yaml` - Workspace configuration with shared catalogs +- `examples/` - Example projects + +### Using Just (Recommended) + +This repository includes a `Justfile` for convenient management. Install [just](https://github.com/casey/just) and run: + +```shell +# See all available commands +just + +# Install dependencies in all directories +just install-all + +# Install in a specific directory +just install-vanilla +just install-nx +just install-turborepo + +# Build a specific example +just build-vanilla react-vite-ts +just build-nx create-nx-workspace-mf +just build-turborepo mf-turbo-rspack + +# List all examples +just list-all + +# Clean everything +just clean-all + +# Full reset (clean + reinstall) +just reset-all +``` + +### Getting Started with a Specific Directory + +1. **Navigate to the directory you want to work with:** + ```shell + cd vanilla # or cd nx, or cd turborepo + ``` + +2. **Install dependencies:** + ```shell + pnpm install + ``` + +3. **Navigate to an example:** + ```shell + cd examples/react-vite-ts # or any other example + ``` + +4. **Build the project:** + ```shell + pnpm build + ``` After you build the project, it will be deployed to your Zephyr Cloud account. -For more information on using Zephyr Cloud, visit the [official documentation][documentation]. -[documentation]: https://docs.zephyr-cloud.io +## Important Notes + +- **No root-level dependencies**: The root of this repository has no `package.json`, `pnpm-workspace.yaml`, or build system. Each directory is completely self-contained. +- **Independent workspaces**: Each directory (`vanilla`, `nx`, `turborepo`) can be worked on independently without affecting the others. +- **Shared catalogs**: Each directory maintains its own pnpm catalog for consistent dependency versions across its examples. + +## Documentation + +For more information on using Zephyr Cloud, visit the [official documentation](https://docs.zephyr-cloud.io). ## Contributors + ![Alt](https://repobeats.axiom.co/api/embed/9d3af925eba49c0dd8ddd8ee144443242fba9b6a.svg "Repobeats analytics image") -## TODO: +## TODO + - [ ] Remove `@rspack/plugin-minify` in favor of `terser-webpack-plugin` - [x] Move to consistent build command - [ ] Create testing matrix that can run with every canary of plugins - -## Status -:white_check_mark: `angular-vite` -:white_check_mark: `create-default-webpack-mf` -:white_check_mark: `create-mf-app-rspack` -:white_check_mark: `create-nx-rspack-workspace-mf` -:white_check_mark: `create-nx-workspace-mf` -:white_check_mark: `nx-ng` -:white_check_mark: `react-airbnb-clone` -:white_check_mark: `react-rollup-ts` -:white_check_mark: `react-rspack-tractor-2.0` -:white_check_mark: `react-tractor-sample` -:white_check_mark: `react-vite-mf` -:x: `react-vite-nx` - @nx/vite plugin dependency issue -:white_check_mark: `react-vite-ts` -:white_check_mark: `rspack-project` -:white_check_mark: `solid` -:white_check_mark: `svelte` -:white_check_mark: `turbo-rspack-mf` diff --git a/examples/angular-vite/package.json b/examples/angular-vite/package.json deleted file mode 100644 index b4ac867d..00000000 --- a/examples/angular-vite/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "angular-vite-zephyr-template", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - }, - "dependencies": { - "@angular/animations": "catalog:angular19", - "@angular/common": "catalog:angular19", - "@angular/compiler": "catalog:angular19", - "@angular/core": "catalog:angular19", - "@angular/platform-browser": "catalog:angular19", - "@angular/platform-browser-dynamic": "catalog:angular19", - "@angular/router": "catalog:angular19", - "rxjs": "catalog:angular19", - "tslib": "catalog:typescript", - "vite-plugin-zephyr": "catalog:zephyr", - "zone.js": "catalog:angular19" - }, - "devDependencies": { - "@analogjs/vite-plugin-angular": "catalog:angular19", - "@angular/build": "catalog:angular19", - "@angular/compiler-cli": "catalog:angular19", - "typescript": "catalog:typescript", - "vite": "catalog:vite6" - } -} diff --git a/examples/basehref-examples/README.md b/examples/basehref-examples/README.md deleted file mode 100644 index 531b9266..00000000 --- a/examples/basehref-examples/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# BaseHref Examples - -This directory contains example applications demonstrating the BaseHref functionality implemented in the Zephyr packages project. These examples show how to properly handle base paths for different deployment scenarios across various bundlers. - -## Examples - -### Vite Example - -A React application built with Vite, demonstrating: - -- Base path detection and configuration -- HTML base tag injection -- URL construction with proper base path handling -- Runtime base path usage via virtual module -- Support for deploying to non-root paths - -[View Vite Example](./vite-app) - -### Webpack Example - -A React application built with Webpack, demonstrating: - -- Public path detection and configuration -- HTML base tag injection -- URL construction with proper base path handling -- Runtime base path usage via global variable -- Manifest file generation with path information -- Support for deploying to non-root paths - -[View Webpack Example](./webpack-app) - -## Functionality Overview - -The BaseHref implementation provides a consistent way to handle application paths across different bundlers and deployment scenarios. It ensures proper path resolution for applications deployed to non-root paths or using CDNs. - -### Key Features - -1. **Path Normalization**: Consistent handling of paths across different formats (relative, absolute, URLs) -2. **Bundler Integration**: Support for Vite, Webpack, and Rspack configurations -3. **URL Construction**: Intelligent URL building with base path consideration -4. **Runtime Detection**: Client-side detection of base paths -5. **HTML Generation**: Proper HTML base tag handling - -## Usage - -Each example includes detailed instructions on how to: - -1. Install dependencies -2. Run the application with different base paths -3. Build the application for production -4. Test the built application - -## Deployment Considerations - -When deploying applications to non-root paths (e.g., `/app/` instead of `/`), proper base path handling is critical for: - -- Loading JavaScript and CSS files -- Resolving image and asset URLs -- Making API requests -- Client-side navigation -- Deep linking to routes - -These examples demonstrate best practices for handling these scenarios across different bundlers. diff --git a/examples/basehref-examples/package.json b/examples/basehref-examples/package.json deleted file mode 100644 index 0bcbcf17..00000000 --- a/examples/basehref-examples/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "basehref-examples", - "version": "1.0.0", - "description": "Examples demonstrating base href configuration with different bundlers", - "private": true, - "scripts": { - "build": "pnpm --filter basehref-rspack-app build && pnpm --filter basehref-vite-app build && pnpm --filter basehref-webpack-app build", - "build:rspack": "pnpm --filter basehref-rspack-app build", - "build:vite": "pnpm --filter basehref-vite-app build", - "build:webpack": "pnpm --filter basehref-webpack-app build", - "build:base": "pnpm --filter basehref-rspack-app build:base && pnpm --filter basehref-vite-app build:base && pnpm --filter basehref-webpack-app build:base", - "build:base:rspack": "pnpm --filter basehref-rspack-app build:base", - "build:base:vite": "pnpm --filter basehref-vite-app build:base", - "build:base:webpack": "pnpm --filter basehref-webpack-app build:base" - }, - "keywords": [ - "basehref", - "rspack", - "vite", - "webpack", - "react", - "zephyr" - ], - "repository": { - "type": "git", - "url": "https://github.com/zephyrcloud/zephyr-examples", - "directory": "examples/basehref-examples" - } -} \ No newline at end of file diff --git a/examples/basehref-examples/rspack-app/README.md b/examples/basehref-examples/rspack-app/README.md deleted file mode 100644 index 992a24e9..00000000 --- a/examples/basehref-examples/rspack-app/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Rspack project - -## Setup - -Install the dependencies: - -```bash -npm install -``` - -## Get started - -Start the dev server: - -```bash -npm run dev -``` - -Build the app for production: - -```bash -npm run build -``` diff --git a/examples/basehref-examples/rspack-app/index.html b/examples/basehref-examples/rspack-app/index.html deleted file mode 100644 index db87cea9..00000000 --- a/examples/basehref-examples/rspack-app/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - Rspack + React + TS - - -
- - diff --git a/examples/basehref-examples/rspack-app/package.json b/examples/basehref-examples/rspack-app/package.json deleted file mode 100644 index 50fab1d3..00000000 --- a/examples/basehref-examples/rspack-app/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "basehref-rspack-app", - "private": true, - "version": "1.0.0", - "scripts": { - "dev": "rspack dev", - "build": "rspack build", - "build:base": "PUBLIC_PATH=/app/ rspack build", - "preview": "rspack preview" - }, - "dependencies": { - "react": "catalog:react19", - "react-dom": "catalog:react19", - "zephyr-rspack-plugin": "catalog:zephyr" - }, - "devDependencies": { - "@rspack/cli": "1.5.5", - "@rspack/core": "1.5.5", - "@rspack/plugin-react-refresh": "catalog:rspack", - "@types/react": "catalog:react19", - "@types/react-dom": "catalog:react19", - "react-refresh": "catalog:react19", - "ts-node": "catalog:typescript", - "typescript": "catalog:typescript" - } -} diff --git a/examples/basehref-examples/rspack-app/rspack.config.ts b/examples/basehref-examples/rspack-app/rspack.config.ts deleted file mode 100644 index 654493bb..00000000 --- a/examples/basehref-examples/rspack-app/rspack.config.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type { Configuration } from "@rspack/cli"; -import { rspack } from "@rspack/core"; -import * as RefreshPlugin from "@rspack/plugin-react-refresh"; -import { withZephyr } from "zephyr-rspack-plugin"; - -const isDev = process.env.NODE_ENV === "development"; - -const publicPath = process.env.PUBLIC_PATH || "/"; - -const targets = ["chrome >= 87", "edge >= 88", "firefox >= 78", "safari >= 14"]; - -const config: Configuration = { - output: { - publicPath, - }, - context: __dirname, - entry: { - main: "./src/main.tsx", - }, - resolve: { - extensions: ["...", ".ts", ".tsx", ".jsx"], - }, - module: { - rules: [ - { - test: /\.svg$/, - type: "asset", - }, - { - test: /\.(jsx?|tsx?)$/, - use: [ - { - loader: "builtin:swc-loader", - options: { - jsc: { - parser: { - syntax: "typescript", - tsx: true, - }, - transform: { - react: { - runtime: "automatic", - development: isDev, - refresh: isDev, - }, - }, - }, - env: { targets }, - }, - }, - ], - }, - ], - }, - plugins: [ - new rspack.HtmlRspackPlugin({ - template: "./index.html", - publicPath, - }), - isDev ? new RefreshPlugin() : null, - ].filter(Boolean), - optimization: { - minimizer: [ - new rspack.SwcJsMinimizerRspackPlugin(), - new rspack.LightningCssMinimizerRspackPlugin({ - minimizerOptions: { targets }, - }), - ], - }, - experiments: { - css: true, - }, -}; - -export default withZephyr()(config); diff --git a/examples/basehref-examples/rspack-app/src/App.tsx b/examples/basehref-examples/rspack-app/src/App.tsx deleted file mode 100644 index d471b9d3..00000000 --- a/examples/basehref-examples/rspack-app/src/App.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { useState } from 'react'; -import reactLogo from './assets/react.svg'; -import './App.css'; - -function App() { - const [count, setCount] = useState(0); - - return ( -
-
- - React logo - -
-

Rspack + React + TypeScript

-
- -

- Edit src/App.tsx and save to test HMR -

-
-

- Click on the Rspack and React logos to learn more -

-
- ); -} - -export default App; diff --git a/examples/basehref-examples/rspack-app/src/main.tsx b/examples/basehref-examples/rspack-app/src/main.tsx deleted file mode 100644 index 4df10b3d..00000000 --- a/examples/basehref-examples/rspack-app/src/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import App from './App.tsx'; -import './index.css'; - -ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - - - -); diff --git a/examples/basehref-examples/rspack-app/src/react-env.d.ts b/examples/basehref-examples/rspack-app/src/react-env.d.ts deleted file mode 100644 index 5aecf253..00000000 --- a/examples/basehref-examples/rspack-app/src/react-env.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -// CSS modules -type CSSModuleClasses = { readonly [key: string]: string }; - -declare module '*.module.css' { - const classes: CSSModuleClasses; - export default classes; -} -declare module '*.module.scss' { - const classes: CSSModuleClasses; - export default classes; -} -declare module '*.module.sass' { - const classes: CSSModuleClasses; - export default classes; -} -declare module '*.module.less' { - const classes: CSSModuleClasses; - export default classes; -} -declare module '*.module.styl' { - const classes: CSSModuleClasses; - export default classes; -} -declare module '*.module.stylus' { - const classes: CSSModuleClasses; - export default classes; -} -declare module '*.module.pcss' { - const classes: CSSModuleClasses; - export default classes; -} -declare module '*.module.sss' { - const classes: CSSModuleClasses; - export default classes; -} - -// CSS -declare module '*.css' { - /** @deprecated Use `import style from './style.css?inline'` instead. */ - const css: string; - export default css; -} -declare module '*.scss' { - /** @deprecated Use `import style from './style.scss?inline'` instead. */ - const css: string; - export default css; -} -declare module '*.sass' { - /** @deprecated Use `import style from './style.sass?inline'` instead. */ - const css: string; - export default css; -} -declare module '*.less' { - /** @deprecated Use `import style from './style.less?inline'` instead. */ - const css: string; - export default css; -} -declare module '*.styl' { - /** @deprecated Use `import style from './style.styl?inline'` instead. */ - const css: string; - export default css; -} -declare module '*.stylus' { - /** @deprecated Use `import style from './style.stylus?inline'` instead. */ - const css: string; - export default css; -} -declare module '*.pcss' { - /** @deprecated Use `import style from './style.pcss?inline'` instead. */ - const css: string; - export default css; -} -declare module '*.sss' { - /** @deprecated Use `import style from './style.sss?inline'` instead. */ - const css: string; - export default css; -} - -// images -declare module '*.png' { - const src: string; - export default src; -} -declare module '*.jpg' { - const src: string; - export default src; -} -declare module '*.jpeg' { - const src: string; - export default src; -} -declare module '*.jfif' { - const src: string; - export default src; -} -declare module '*.pjpeg' { - const src: string; - export default src; -} -declare module '*.pjp' { - const src: string; - export default src; -} -declare module '*.gif' { - const src: string; - export default src; -} -declare module '*.svg' { - const ReactComponent: React.FC>; - const content: string; - - export { ReactComponent }; - export default content; -} -declare module '*.ico' { - const src: string; - export default src; -} -declare module '*.webp' { - const src: string; - export default src; -} -declare module '*.avif' { - const src: string; - export default src; -} - -// media -declare module '*.mp4' { - const src: string; - export default src; -} -declare module '*.webm' { - const src: string; - export default src; -} -declare module '*.ogg' { - const src: string; - export default src; -} -declare module '*.mp3' { - const src: string; - export default src; -} -declare module '*.wav' { - const src: string; - export default src; -} -declare module '*.flac' { - const src: string; - export default src; -} -declare module '*.aac' { - const src: string; - export default src; -} - -declare module '*.opus' { - const src: string; - export default src; -} - -// fonts -declare module '*.woff' { - const src: string; - export default src; -} -declare module '*.woff2' { - const src: string; - export default src; -} -declare module '*.eot' { - const src: string; - export default src; -} -declare module '*.ttf' { - const src: string; - export default src; -} -declare module '*.otf' { - const src: string; - export default src; -} - -// other -declare module '*.webmanifest' { - const src: string; - export default src; -} -declare module '*.pdf' { - const src: string; - export default src; -} -declare module '*.txt' { - const src: string; - export default src; -} diff --git a/examples/basehref-examples/vite-app/README.md b/examples/basehref-examples/vite-app/README.md deleted file mode 100644 index bc27ddba..00000000 --- a/examples/basehref-examples/vite-app/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# BaseHref Vite Example - -This example demonstrates the BaseHref functionality in a Vite application, showing how to properly handle base paths for different deployment scenarios. - -## Features - -- Base path detection and configuration -- HTML base tag injection -- URL construction with proper base path handling -- Runtime base path usage via virtual module -- Support for deploying to non-root paths - -## Getting Started - -```bash -# Install dependencies -npm install - -# Run in development mode with default base -npm run dev - -# Run in development mode with /app/ base -npm run dev:base - -# Build with default base -npm run build - -# Build with /app/ base -npm run build:base - -# Preview with default base -npm run preview - -# Preview with /app/ base -npm run preview:base -``` - -## Implementation Details - -This example uses the `viteBaseHrefPlugin` to handle base paths in a Vite application: - -```typescript -// vite.config.ts -import { defineConfig } from 'vite'; -import react from '@vitejs/plugin-react'; -import { viteBaseHrefPlugin } from '../../../basehref-vite-plugin'; - -export default defineConfig({ - plugins: [ - react(), - viteBaseHrefPlugin({ - enabled: true, - transformHtml: true, - baseTagOptions: { - target: '_blank', - }, - }), - ], -}); -``` - -## Using BaseHref in Your Code - -The plugin provides a virtual module for accessing the base path in your code: - -```typescript -import baseHref from 'virtual:base-href'; - -// Use the base path for constructing URLs -const imageUrl = new URL('assets/logo.png', baseHref.baseHref).href; -``` - -## Deployment Considerations - -- When deploying to a non-root path, make sure to set the base path in your Vite configuration -- Use the BaseHref plugin to ensure proper path handling -- Use the `virtual:base-href` module for dynamic path resolution at runtime -- Always construct URLs using the base path to ensure proper resolution diff --git a/examples/basehref-examples/vite-app/index.html b/examples/basehref-examples/vite-app/index.html deleted file mode 100644 index e9f0fe76..00000000 --- a/examples/basehref-examples/vite-app/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - BaseHref Vite Example - - -
- - - diff --git a/examples/basehref-examples/vite-app/package.json b/examples/basehref-examples/vite-app/package.json deleted file mode 100644 index 1160e755..00000000 --- a/examples/basehref-examples/vite-app/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "basehref-vite-app", - "version": "0.0.1", - "private": true, - "type": "module", - "scripts": { - "dev": "vite", - "dev:base": "vite --base=/app/", - "build": "tsc && vite build", - "build:base": "tsc && vite build --base=/app/", - "preview": "vite preview", - "preview:base": "vite preview --base=/app/" - }, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18" - }, - "devDependencies": { - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "@vitejs/plugin-react": "catalog:vite5", - "typescript": "catalog:typescript", - "vite": "catalog:vite5", - "vite-plugin-zephyr": "catalog:zephyr" - } -} diff --git a/examples/basehref-examples/vite-app/src/App.tsx b/examples/basehref-examples/vite-app/src/App.tsx deleted file mode 100644 index 3cd725b8..00000000 --- a/examples/basehref-examples/vite-app/src/App.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { useEffect, useState } from 'react'; -// import baseHref from 'virtual:base-href'; - -function App() { - const [detectedBase, setDetectedBase] = useState(''); - const [currentUrl, setCurrentUrl] = useState(''); - - // Create image paths with different types - const imagePaths = { - relative: './assets/logo.png', - absolute: '/assets/logo.png', - // baseHref: new URL('assets/logo.png', baseHref.baseHref).href - }; - - useEffect(() => { - // Detect base path at runtime - setDetectedBase(document.baseURI || window.location.pathname); - setCurrentUrl(window.location.href); - }, []); - - return ( -
-

BaseHref Vite Example

- -
-

Configuration Info

- {/*

Configured Base: {baseHref.baseHref}

*/} -

- Detected Base:{' '} - {detectedBase} -

-

- Current URL:{' '} - {currentUrl} -

-
- -
-

Path Resolution Examples

- -
-

Relative Path

-

{imagePaths.relative}

-

- Resolves to:{' '} - - {new URL(imagePaths.relative, window.location.href).href} - -

-
- -
-

Absolute Path

-

{imagePaths.absolute}

-

- Resolves to:{' '} - - {new URL(imagePaths.absolute, window.location.origin).href} - -

-
- -
-

BaseHref Path

-

- new URL('assets/logo.png', baseHref.baseHref) -

- {/*

Resolves to: {imagePaths.baseHref}

*/} -
-
- -
-

Navigation

-
- Home - About - Products -
-
- -
-

- This example demonstrates the BaseHref functionality in a Vite - application. -

-

Try running with different base paths using:

-

npm run dev:base

-
-
- ); -} - -export default App; diff --git a/examples/basehref-examples/vite-app/src/index.css b/examples/basehref-examples/vite-app/src/index.css deleted file mode 100644 index 5a907bed..00000000 --- a/examples/basehref-examples/vite-app/src/index.css +++ /dev/null @@ -1,109 +0,0 @@ -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} - -.container { - max-width: 800px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} - -.card { - padding: 2em; - background-color: #1a1a1a; - border-radius: 8px; - margin: 1em 0; -} - -.row { - display: flex; - justify-content: center; - gap: 1em; - margin: 1em 0; -} - -.resource-path { - font-family: monospace; - background-color: #333; - padding: 0.5em; - border-radius: 4px; - overflow-x: auto; - max-width: 100%; - display: inline-block; -} diff --git a/examples/basehref-examples/vite-app/src/main.tsx b/examples/basehref-examples/vite-app/src/main.tsx deleted file mode 100644 index 2339d59c..00000000 --- a/examples/basehref-examples/vite-app/src/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import App from './App'; -import './index.css'; - -ReactDOM.createRoot(document.getElementById('root')!).render( - - - -); diff --git a/examples/basehref-examples/vite-app/tsconfig.node.json b/examples/basehref-examples/vite-app/tsconfig.node.json deleted file mode 100644 index 42872c59..00000000 --- a/examples/basehref-examples/vite-app/tsconfig.node.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "composite": true, - "skipLibCheck": true, - "module": "ESNext", - "moduleResolution": "bundler", - "allowSyntheticDefaultImports": true - }, - "include": ["vite.config.ts"] -} diff --git a/examples/basehref-examples/vite-app/vite.config.ts b/examples/basehref-examples/vite-app/vite.config.ts deleted file mode 100644 index e7c8f23b..00000000 --- a/examples/basehref-examples/vite-app/vite.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { defineConfig } from 'vite'; -import react from '@vitejs/plugin-react'; -import { withZephyr } from 'vite-plugin-zephyr'; - -// https://vitejs.dev/config/ -export default defineConfig({ - base: '/', - plugins: [react(), withZephyr() as any], - resolve: { - alias: { - '@': '/src', - }, - }, -}); diff --git a/examples/basehref-examples/webpack-app/README.md b/examples/basehref-examples/webpack-app/README.md deleted file mode 100644 index 3075254f..00000000 --- a/examples/basehref-examples/webpack-app/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# BaseHref Webpack Example - -This example demonstrates the BaseHref functionality in a Webpack application, showing how to properly handle base paths for different deployment scenarios. - -## Features - -- Public path detection and configuration -- HTML base tag injection -- URL construction with proper base path handling -- Runtime base path usage via global variable -- Manifest file generation with path information -- Support for deploying to non-root paths - -## Getting Started - -```bash -# Install dependencies -npm install - -# Run in development mode with default public path -npm run start - -# Run in development mode with /app/ public path -npm run start:base - -# Build with default public path -npm run build - -# Build with /app/ public path -npm run build:base -``` - -## Implementation Details - -This example uses the `webpackBaseHrefPlugin` to handle base paths in a Webpack application: - -```javascript -// webpack.config.js -const { webpackBaseHrefPlugin } = require('../../../basehref-webpack-plugin'); - -module.exports = (env = {}) => { - // Extract publicPath from environment - const publicPath = env.publicPath || 'auto'; - - return { - // Webpack configuration... - plugins: [ - // Other plugins... - webpackBaseHrefPlugin({ - publicPath: publicPath, - injectIntoHtml: true, - generateManifestFile: true, - }), - ], - }; -}; -``` - -## Using BaseHref in Your Code - -The plugin exposes the base path as a global variable in the browser: - -```typescript -// Access the base path in your code -const basePath = window.__BASEHREF__; - -// Use it for constructing URLs -const imageUrl = new URL('assets/image.jpg', basePath).href; -``` - -## Deployment Considerations - -- When deploying to a non-root path, make sure to set the publicPath in your Webpack configuration -- Use the BaseHref plugin to ensure proper path handling -- Use the window.**BASEHREF** global variable for dynamic path resolution at runtime -- Always construct URLs using the base path to ensure proper resolution -- Check the generated basehref-manifest.json file for path configuration details diff --git a/examples/basehref-examples/webpack-app/package.json b/examples/basehref-examples/webpack-app/package.json deleted file mode 100644 index b914fb87..00000000 --- a/examples/basehref-examples/webpack-app/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "basehref-webpack-app", - "version": "0.0.1", - "private": true, - "scripts": { - "start": "webpack serve", - "start:base": "webpack serve --env publicPath=/app/", - "build": "webpack --mode=production", - "build:base": "webpack --mode=production --env publicPath=/app/" - }, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18" - }, - "devDependencies": { - "@babel/core": "catalog:babel", - "@babel/preset-env": "catalog:babel", - "@babel/preset-react": "catalog:babel", - "@babel/preset-typescript": "catalog:babel", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "babel-loader": "catalog:babel", - "css-loader": "catalog:webpack5", - "html-webpack-plugin": "catalog:webpack5", - "style-loader": "^3.3.3", - "typescript": "catalog:typescript", - "webpack": "catalog:webpack5", - "webpack-cli": "catalog:webpack5", - "webpack-dev-server": "catalog:webpack5", - "zephyr-webpack-plugin": "catalog:zephyr" - } -} diff --git a/examples/basehref-examples/webpack-app/src/App.tsx b/examples/basehref-examples/webpack-app/src/App.tsx deleted file mode 100644 index 859022e9..00000000 --- a/examples/basehref-examples/webpack-app/src/App.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { useEffect, useState } from 'react'; - -// Import the baseHref functionality -declare global { - interface Window { - __BASEHREF__: string; - } -} - -const App: React.FC = () => { - const [detectedBase, setDetectedBase] = useState(''); - const [manifestContent, setManifestContent] = - useState('Loading 9...'); - - return ( -
-

BaseHref Webpack Example

- -
-

Navigation

-
- Home - About - Products -
-
- -
-

- This example demonstrates the BaseHref functionality in a Webpack - application. -

-

Try running with different public paths using:

-

npm run start:base

-
-
- ); -}; - -export default App; diff --git a/examples/basehref-examples/webpack-app/src/index.html b/examples/basehref-examples/webpack-app/src/index.html deleted file mode 100644 index 061326b7..00000000 --- a/examples/basehref-examples/webpack-app/src/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - BaseHref Webpack Example - - -
- - diff --git a/examples/basehref-examples/webpack-app/src/index.tsx b/examples/basehref-examples/webpack-app/src/index.tsx deleted file mode 100644 index ff6aa192..00000000 --- a/examples/basehref-examples/webpack-app/src/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import App from './App'; -import './styles.css'; - -const rootElement = document.getElementById('root'); -if (rootElement) { - const root = ReactDOM.createRoot(rootElement); - root.render( - - - - ); -} diff --git a/examples/basehref-examples/webpack-app/src/styles.css b/examples/basehref-examples/webpack-app/src/styles.css deleted file mode 100644 index 8ccae0cb..00000000 --- a/examples/basehref-examples/webpack-app/src/styles.css +++ /dev/null @@ -1,93 +0,0 @@ -* { - box-sizing: border-box; - margin: 0; - padding: 0; -} - -body { - font-family: Arial, sans-serif; - line-height: 1.6; - color: #333; - background-color: #f5f5f5; - padding: 20px; -} - -.container { - max-width: 800px; - margin: 0 auto; - padding: 20px; - background-color: white; - border-radius: 8px; - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); -} - -h1 { - color: #2c3e50; - margin-bottom: 20px; - text-align: center; -} - -h2 { - color: #3498db; - margin-top: 20px; - margin-bottom: 10px; -} - -.card { - background-color: #f9f9f9; - border: 1px solid #ddd; - border-radius: 8px; - padding: 15px; - margin-bottom: 20px; -} - -.resource-path { - background-color: #eee; - font-family: monospace; - padding: 5px 10px; - border-radius: 4px; - display: inline-block; - margin: 5px 0; - word-break: break-all; -} - -.row { - display: flex; - flex-wrap: wrap; - gap: 10px; - margin: 10px 0; -} - -button, -a { - background-color: #3498db; - color: white; - padding: 8px 15px; - border: none; - border-radius: 4px; - cursor: pointer; - text-decoration: none; - display: inline-block; -} - -button:hover, -a:hover { - background-color: #2980b9; -} - -footer { - margin-top: 30px; - text-align: center; - font-size: 0.9em; - color: #7f8c8d; -} - -@media (max-width: 600px) { - .container { - padding: 10px; - } - - .row { - flex-direction: column; - } -} diff --git a/examples/basehref-examples/webpack-app/tsconfig.json b/examples/basehref-examples/webpack-app/tsconfig.json deleted file mode 100644 index a88d0469..00000000 --- a/examples/basehref-examples/webpack-app/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "react-jsx" - }, - "include": ["src/**/*"] -} diff --git a/examples/basehref-examples/webpack-app/webpack.config.js b/examples/basehref-examples/webpack-app/webpack.config.js deleted file mode 100644 index 564a8bec..00000000 --- a/examples/basehref-examples/webpack-app/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -const path = require('node:path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { withZephyr } = require('zephyr-webpack-plugin'); - -module.exports = (env = {}) => { - // auto is a default value for webpack - const publicPath = env.publicPath || 'auto'; - - return withZephyr()({ - mode: 'development', - entry: './src/index.tsx', - output: { - filename: 'bundle.[contenthash].js', - path: path.resolve(__dirname, 'dist'), - publicPath: publicPath, - clean: true, - }, - module: { - rules: [ - { - test: /\.(js|jsx|ts|tsx)$/, - exclude: /node_modules/, - use: { - loader: 'babel-loader', - options: { - presets: [ - '@babel/preset-env', - '@babel/preset-react', - '@babel/preset-typescript', - ], - }, - }, - }, - { - test: /\.css$/, - use: ['style-loader', 'css-loader'], - }, - { - test: /\.(png|svg|jpg|jpeg|gif)$/i, - type: 'asset/resource', - }, - ], - }, - resolve: { - extensions: ['.tsx', '.ts', '.js', '.jsx'], - }, - plugins: [ - new HtmlWebpackPlugin({ - template: './src/index.html', - filename: 'index.html', - inject: 'body', - }), - ], - devServer: { - static: { - directory: path.join(__dirname, 'dist'), - }, - compress: true, - port: 3000, - historyApiFallback: true, - hot: true, - }, - }); -}; diff --git a/examples/create-default-webpack-mf/app1/package.json b/examples/create-default-webpack-mf/app1/package.json deleted file mode 100755 index 7e8fad39..00000000 --- a/examples/create-default-webpack-mf/app1/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "default_webpack_mf_first", - "version": "1.0.0", - "main": "index.js", - "license": "MIT", - "scripts": { - "start": "webpack serve", - "build": "webpack --mode production" - }, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18", - "zephyr-webpack-plugin": "catalog:zephyr", - "external-remotes-plugin": "^1.0.0" - }, - "devDependencies": { - "@babel/core": "catalog:babel", - "@babel/preset-react": "catalog:babel", - "babel-loader": "catalog:babel", - "html-webpack-plugin": "catalog:webpack5", - "webpack": "catalog:webpack5", - "webpack-cli": "catalog:webpack5", - "webpack-dev-server": "catalog:webpack5" - }, - "zephyr:dependencies": { - "default_webpack_mf_second": "zephyr:default_webpack_mf_second@*" - } -} diff --git a/examples/create-default-webpack-mf/app1/src/bootstrap.js b/examples/create-default-webpack-mf/app1/src/bootstrap.js deleted file mode 100755 index bc6fa1ef..00000000 --- a/examples/create-default-webpack-mf/app1/src/bootstrap.js +++ /dev/null @@ -1,5 +0,0 @@ -import App from "./App"; -import React from "react"; -import ReactDOM from "react-dom"; - -ReactDOM.render(, document.getElementById("root")); diff --git a/examples/create-default-webpack-mf/app2/package.json b/examples/create-default-webpack-mf/app2/package.json deleted file mode 100755 index 370ebd6f..00000000 --- a/examples/create-default-webpack-mf/app2/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "default_webpack_mf_second", - "version": "1.0.0", - "main": "index.js", - "license": "MIT", - "scripts": { - "start": "webpack serve", - "build": "webpack --mode production" - }, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18", - "zephyr-webpack-plugin": "catalog:zephyr" - }, - "devDependencies": { - "@babel/core": "catalog:babel", - "@babel/preset-react": "catalog:babel", - "babel-loader": "catalog:babel", - "html-webpack-plugin": "catalog:webpack5", - "webpack": "catalog:webpack5", - "webpack-cli": "catalog:webpack5", - "webpack-dev-server": "catalog:webpack5" - } -} diff --git a/examples/create-default-webpack-mf/app2/src/bootstrap.js b/examples/create-default-webpack-mf/app2/src/bootstrap.js deleted file mode 100755 index b312c56d..00000000 --- a/examples/create-default-webpack-mf/app2/src/bootstrap.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom"; - -import App from "./App"; - -ReactDOM.render(, document.getElementById("root")); diff --git a/examples/create-default-webpack-mf/app2/webpack.config.js b/examples/create-default-webpack-mf/app2/webpack.config.js deleted file mode 100755 index e5472836..00000000 --- a/examples/create-default-webpack-mf/app2/webpack.config.js +++ /dev/null @@ -1,42 +0,0 @@ -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { withZephyr } = require("zephyr-webpack-plugin"); -const { ModuleFederationPlugin } = require('webpack').container; -const path = require('path'); - -module.exports = withZephyr()({ - entry: './src/index', - mode: 'development', - devServer: { - static: path.join(__dirname, 'dist'), - port: 3002, - }, - output: { - publicPath: 'auto', - }, - module: { - rules: [ - { - test: /\.jsx?$/, - loader: 'babel-loader', - exclude: /node_modules/, - options: { - presets: ['@babel/preset-react'], - }, - }, - ], - }, - plugins: [ - // To learn more about the usage of this plugin, please visit https://webpack.js.org/plugins/module-federation-plugin/ - new ModuleFederationPlugin({ - name: 'default_webpack_mf_second', - filename: 'remoteEntry.js', - exposes: { - './App': './src/App', - }, - shared: { react: { singleton: true }, 'react-dom': { singleton: true } }, - }), - new HtmlWebpackPlugin({ - template: './public/index.html', - }), - ], -}); diff --git a/examples/create-mf-app-rspack/README.md b/examples/create-mf-app-rspack/README.md deleted file mode 100644 index 892a68d7..00000000 --- a/examples/create-mf-app-rspack/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# React + Rspack + Module Federation Application - -A React application built with Rspack bundler demonstrating Module Federation capabilities with fast builds and modern development experience. - -## Technology Stack - -- **Framework**: React with TypeScript -- **Architecture**: Module Federation -- **Bundler**: Rspack -- **Language**: TypeScript -- **Deployment**: Zephyr Cloud - -## Prerequisites - -- Node.js (version 16 or higher) -- pnpm (recommended) or npm - -## Getting Started - -1. **Install dependencies** - ```bash - pnpm install - ``` - -2. **Start development server** - ```bash - pnpm dev - ``` - - The application will be available at `http://localhost:3000` - -3. **Build for production** - ```bash - pnpm build - ``` - -## Module Federation Configuration - -This application is configured as a Module Federation container with: -- **Name**: `create_mf_app_rspack` -- **Remote Entry**: `remoteEntry.js` -- **Shared Dependencies**: React, React-DOM, React-Router-DOM (all eager loaded) - -The application uses the `zephyr-rspack-plugin` for seamless integration with Zephyr Cloud deployment. - -## Zephyr Cloud Integration - -This example is configured to deploy to Zephyr Cloud automatically when built. The Zephyr plugin handles Module Federation deployment, ensuring proper remote entry generation and dependency sharing. After running the build command, your application will be deployed and a preview URL will be provided. - -## About Zephyr Cloud - -Zephyr Cloud is a micro-frontend deployment platform that provides: -- **Auto-deployment**: Seamless deployment from your build process -- **Live preview links**: Instant preview URLs for your applications -- **SemVer versioning**: Semantic versioning for your frontend modules -- **Rollback capabilities**: Easy rollback to previous versions -- **Enterprise-scale orchestration**: Built for composable frontend systems - -## Learn More - -- [Rspack Documentation](https://rspack.dev/) -- [React Documentation](https://reactjs.org/) -- [Zephyr Cloud Documentation](https://docs.zephyr-cloud.io) \ No newline at end of file diff --git a/examples/create-mf-app-rspack/package.json b/examples/create-mf-app-rspack/package.json deleted file mode 100644 index 1435cca2..00000000 --- a/examples/create-mf-app-rspack/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "create-mf-app-rspack-host", - "version": "1.0.0", - "scripts": { - "build": "cross-env NODE_ENV=production rspack build", - "build:dev": "cross-env NODE_ENV=development rspack build", - "build:start": "cd dist && rspack serve", - "start": "cross-env NODE_ENV=development rspack serve" - }, - "license": "MIT", - "author": { - "name": "Jack Herrington", - "email": "jherr@pobox.com" - }, - "devDependencies": { - "@rspack/cli": "catalog:rspack", - "@rspack/core": "catalog:rspack", - "@rspack/plugin-react-refresh": "catalog:rspack", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "autoprefixer": "catalog:postcss", - "cross-env": "catalog:common", - "css-loader": "catalog:common", - "postcss": "catalog:postcss", - "postcss-loader": "catalog:postcss", - "react-refresh": "catalog:react18", - "style-loader": "catalog:common" - }, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18", - "zephyr-rspack-plugin": "catalog:zephyr" - } -} diff --git a/examples/create-mf-app-rspack/rspack.config.js b/examples/create-mf-app-rspack/rspack.config.js deleted file mode 100644 index 66223edd..00000000 --- a/examples/create-mf-app-rspack/rspack.config.js +++ /dev/null @@ -1,87 +0,0 @@ -const rspack = require('@rspack/core') -const refreshPlugin = require('@rspack/plugin-react-refresh') -const { withZephyr } = require('zephyr-rspack-plugin'); -const isDev = process.env.NODE_ENV === 'development' -/** - * @type {import('@rspack/cli').Configuration} - */ -module.exports = withZephyr()({ - context: __dirname, - entry: { - main: './src/index.ts', - }, - // devServer: { - // historyApiFallback: true, - // port: 8080, - // }, - resolve: { - extensions: ['.js','.jsx','.ts','.tsx','.json'] - }, - module: { - rules: [ - { - test: /\.svg$/, - type: 'asset', - }, - { - test: /\.(jsx?|tsx?)$/, - use: [ - { - loader: 'builtin:swc-loader', - options: { - sourceMap: true, - jsc: { - parser: { - syntax: 'typescript', - tsx: true, - }, - transform: { - react: { - runtime: 'automatic', - development: isDev, - refresh: isDev, - }, - }, - }, - env: { - targets: [ - 'chrome >= 87', - 'edge >= 88', - 'firefox >= 78', - 'safari >= 14', - ], - }, - }, - }, - ], - }, - { - test: /\.css$/, - use: [ - 'style-loader', - 'css-loader' - ], - }, - ], - }, - plugins: [ - new rspack.container.ModuleFederationPlugin({ - name: 'create_mf_app_rspack', - filename: 'remoteEntry.js', - exposes: {}, - shared: { - react: { eager: true }, - 'react-dom': { eager: true }, - 'react-router-dom': { eager: true }, - }, - }), - new rspack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), - }), - new rspack.ProgressPlugin({}), - new rspack.HtmlRspackPlugin({ - template: './src/index.html', - }), - isDev ? new refreshPlugin() : null, - ].filter(Boolean), -}) diff --git a/examples/create-mf-app-rspack/src/App.tsx b/examples/create-mf-app-rspack/src/App.tsx deleted file mode 100644 index 3f595b37..00000000 --- a/examples/create-mf-app-rspack/src/App.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' - -import './index.css' - -const App = () => ( -
-
Name: create-mf-app-rspack with zephyr
-
Framework: react
-
Language: TypeScript
-
CSS: Empty CSS
-
-) -const rootElement = document.getElementById('app') -if (!rootElement) throw new Error('Failed to find the root element') - -const root = ReactDOM.createRoot(rootElement as HTMLElement) - -root.render() diff --git a/examples/create-mf-app-rspack/src/index.css b/examples/create-mf-app-rspack/src/index.css deleted file mode 100644 index 20e225c5..00000000 --- a/examples/create-mf-app-rspack/src/index.css +++ /dev/null @@ -1,10 +0,0 @@ -body { - font-family: Arial, Helvetica, sans-serif; -} - -.container { - font-size: 3rem; - margin: auto; - max-width: 800px; - margin-top: 20px; -} \ No newline at end of file diff --git a/examples/create-mf-app-rspack/src/index.html b/examples/create-mf-app-rspack/src/index.html deleted file mode 100644 index 1c59fe00..00000000 --- a/examples/create-mf-app-rspack/src/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - create-mf-app-rspack - - - -
Module federation rspack example
- - - diff --git a/examples/create-mf-app-rspack/src/index.ts b/examples/create-mf-app-rspack/src/index.ts deleted file mode 100644 index fc3cee10..00000000 --- a/examples/create-mf-app-rspack/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -import("./App"); diff --git a/examples/create-nx-rspack-workspace-mf/.eslintignore b/examples/create-nx-rspack-workspace-mf/.eslintignore deleted file mode 100644 index 3c3629e6..00000000 --- a/examples/create-nx-rspack-workspace-mf/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/examples/create-nx-rspack-workspace-mf/.eslintrc.json b/examples/create-nx-rspack-workspace-mf/.eslintrc.json deleted file mode 100644 index 0be733b7..00000000 --- a/examples/create-nx-rspack-workspace-mf/.eslintrc.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "root": true, - "ignorePatterns": ["**/*"], - "plugins": ["@nx"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": { - "@nx/enforce-module-boundaries": [ - "error", - { - "enforceBuildableLibDependency": true, - "allow": [], - "depConstraints": [ - { - "sourceTag": "*", - "onlyDependOnLibsWithTags": ["*"] - } - ] - } - ] - } - }, - { - "files": ["*.ts", "*.tsx"], - "extends": ["plugin:@nx/typescript"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "extends": ["plugin:@nx/javascript"], - "rules": {} - }, - { - "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], - "env": { - "jest": true - }, - "rules": {} - } - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/README.md b/examples/create-nx-rspack-workspace-mf/README.md deleted file mode 100644 index 8adaef13..00000000 --- a/examples/create-nx-rspack-workspace-mf/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# Nx + Rspack + Module Federation Workspace - -A comprehensive Nx workspace demonstrating Module Federation architecture with Rspack bundler and multiple micro-frontend applications. - -## Technology Stack - -- **Framework**: React 18 with TypeScript -- **Architecture**: Module Federation -- **Build System**: Nx Workspace -- **Bundler**: Rspack -- **Language**: TypeScript -- **Deployment**: Zephyr Cloud -- **Development**: Rspack Dev Server - -## Prerequisites - -- Node.js (version 16 or higher) -- npm or yarn - -## Project Structure - -This Nx workspace consists of three federated applications: - -- **`host/`** - Host application that orchestrates the micro-frontends -- **`rspack_remote1/`** - Remote application exposing shared components -- **`rspack_remote2/`** - Another remote application with independent functionality - -## Getting Started - -1. **Install dependencies** - ```bash - npm install - ``` - -2. **Development mode** - - Start all applications concurrently: - ```bash - npx nx run-many --target=serve --projects=rspack_remote1,rspack_remote2,host --parallel - ``` - - Or start individually: - ```bash - npx nx serve rspack_remote1 - npx nx serve rspack_remote2 - npx nx serve host - ``` - -3. **Build for production** (in correct order) - - Because this is a Module Federation setup, remotes must be built before the host: - - ```bash - npx nx run rspack_remote1:build - npx nx run rspack_remote2:build - npx nx run host:build - ``` - - Or use the convenience script that handles build order: - ```bash - npm run build - ``` - -4. **Visual project graph** - ```bash - npx nx graph - ``` - -## Module Federation Configuration - -Each application uses Rspack's Module Federation plugin: - -- **Host Application**: Consumes remote modules at runtime -- **Remote Applications**: Expose components for consumption -- **Shared Dependencies**: React, React-DOM shared as singletons -- **Build Dependencies**: Remotes must be built before host for proper mapping - -## Rspack Benefits - -This example showcases Rspack's advantages: -- **Faster builds**: Significantly faster than Webpack -- **Module Federation support**: First-class MF support -- **Webpack compatibility**: Easy migration from Webpack setups -- **Development experience**: Fast HMR and dev server - -## Zephyr Cloud Integration - -This example demonstrates enterprise-scale micro-frontend deployment: - -1. **Build Order**: Remotes built and deployed first -2. **Automatic Mapping**: Zephyr Cloud maps remote entry points -3. **Runtime Loading**: Host consumes deployed remotes at runtime -4. **Independent Deployment**: Each micro-frontend deploys separately - -## About Module Federation - -Module Federation enables: -- **Independent deployment**: Each micro-frontend can deploy separately -- **Runtime composition**: Applications compose at runtime, not build time -- **Team autonomy**: Different teams can own different remotes -- **Technology flexibility**: Different versions of dependencies per remote -- **Shared dependencies**: Efficient sharing of common libraries - -## About Zephyr Cloud - -Zephyr Cloud is a micro-frontend deployment platform that provides: -- **Auto-deployment**: Seamless deployment from your build process -- **Live preview links**: Instant preview URLs for your applications -- **SemVer versioning**: Semantic versioning for your frontend modules -- **Rollback capabilities**: Easy rollback to previous versions -- **Enterprise-scale orchestration**: Built for composable frontend systems - -## Learn More - -- [Nx Documentation](https://nx.dev/) -- [Rspack Documentation](https://rspack.dev/) -- [Module Federation Documentation](https://module-federation.io/) -- [Zephyr Cloud Micro-Frontend Guide](https://docs.zephyr-cloud.io/how-to/mf-guide) -- [Zephyr Cloud Documentation](https://docs.zephyr-cloud.io) \ No newline at end of file diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/.eslintrc.json b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/.eslintrc.json deleted file mode 100644 index 696cb8b1..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/cypress.config.ts b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/cypress.config.ts deleted file mode 100644 index c0cb8d88..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/cypress.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; - -import { defineConfig } from 'cypress'; - -export default defineConfig({ - e2e: { - ...nxE2EPreset(__filename, { cypressDir: 'src' }), - baseUrl: 'http://localhost:4200', - }, -}); diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/project.json b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/project.json deleted file mode 100644 index b658fd54..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/project.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "host-e2e", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "application", - "sourceRoot": "apps/host-e2e/src", - "tags": [], - "implicitDependencies": ["host"], - "targets": { - "e2e": { - "executor": "@nx/cypress:cypress", - "options": { - "cypressConfig": "apps/host-e2e/cypress.config.ts", - "testingType": "e2e", - "devServerTarget": "host:serve", - "baseUrl": "http://localhost:4200" - }, - "configurations": { - "production": { - "devServerTarget": "host:serve:production" - }, - "ci": { - "devServerTarget": "host:serve-static" - } - } - }, - "lint": { - "executor": "@nx/eslint:lint" - } - } -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/e2e/app.cy.ts b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/e2e/app.cy.ts deleted file mode 100644 index f2fff31b..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/e2e/app.cy.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { getGreeting } from '../support/app.po'; - -describe('host-e2e', () => { - beforeEach(() => cy.visit('/')); - - it('should display welcome message', () => { - // Custom command example, see `../support/commands.ts` file - cy.login('my-email@something.com', 'myPassword'); - - // Function helper example, see `../support/app.po.ts` file - getGreeting().contains(/Welcome/); - }); -}); diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/fixtures/example.json b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/fixtures/example.json deleted file mode 100644 index 02e42543..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/app.po.ts b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/app.po.ts deleted file mode 100644 index 32934246..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/app.po.ts +++ /dev/null @@ -1 +0,0 @@ -export const getGreeting = () => cy.get('h1'); diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/commands.ts b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/commands.ts deleted file mode 100644 index c421a3c4..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/commands.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** - -// eslint-disable-next-line @typescript-eslint/no-namespace -declare namespace Cypress { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - interface Chainable { - login(email: string, password: string): void; - } -} - -// -- This is a parent command -- -Cypress.Commands.add('login', (email, password) => { - console.log('Custom command example: Login', email, password); -}); -// -// -- This is a child command -- -// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/e2e.ts b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/e2e.ts deleted file mode 100644 index 1c1a9e77..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/src/support/e2e.ts +++ /dev/null @@ -1,17 +0,0 @@ -// *********************************************************** -// This example support/e2e.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.ts using ES2015 syntax: -import './commands'; diff --git a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/tsconfig.json b/examples/create-nx-rspack-workspace-mf/apps/host-e2e/tsconfig.json deleted file mode 100644 index e1eeabdb..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host-e2e/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["cypress", "node"], - "sourceMap": false - }, - "include": [ - "**/*.ts", - "**/*.js", - "cypress.config.ts", - "**/*.cy.ts", - "**/*.cy.tsx", - "**/*.cy.js", - "**/*.cy.jsx", - "**/*.d.ts" - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/.eslintrc.json b/examples/create-nx-rspack-workspace-mf/apps/host/.eslintrc.json deleted file mode 100644 index a39ac5d0..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/jest.config.ts b/examples/create-nx-rspack-workspace-mf/apps/host/jest.config.ts deleted file mode 100644 index 1d600dda..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/jest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'host', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/apps/host', -}; diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/module-federation.config.ts b/examples/create-nx-rspack-workspace-mf/apps/host/module-federation.config.ts deleted file mode 100644 index 285f108d..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/module-federation.config.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ModuleFederationConfig } from '@nx/rspack/module-federation'; - -const config: ModuleFederationConfig = { - name: 'host', - /** - * To use a remote that does not exist in your current Nx Workspace - * You can use the tuple-syntax to define your remote - * - * remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']] - * - * You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the - * following content: - * - * declare module 'my-external-remote'; - * - */ - remotes: ['rspack_remote1', 'rspack_remote2'], -}; - -export default config; diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/package.json b/examples/create-nx-rspack-workspace-mf/apps/host/package.json deleted file mode 100644 index b23fc613..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "host", - "version": "0.0.0", - "zephyr:dependencies": { - "rspack_remote1": "zephyr:rspack_remote1@*", - "rspack_remote2": "zephyr:rspack_remote2@*" - } -} \ No newline at end of file diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/rspack.config.prod.ts b/examples/create-nx-rspack-workspace-mf/apps/host/rspack.config.prod.ts deleted file mode 100644 index 4c47cd86..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/rspack.config.prod.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { composePlugins, withNx, withReact } from '@nx/rspack'; -import { - withModuleFederation, - ModuleFederationConfig, -} from '@nx/rspack/module-federation'; -import { withZephyr } from 'zephyr-rspack-plugin'; -import baseConfig from './module-federation.config'; - -const prodConfig: ModuleFederationConfig = { - ...baseConfig, - /* - * Remote overrides for production. - * Each entry is a pair of a unique name and the URL where it is deployed. - * - * e.g. - * remotes: [ - * ['app1', 'http://app1.example.com'], - * ['app2', 'http://app2.example.com'], - * ] - * - * You can also use a full path to the remoteEntry.js file if desired. - * - * remotes: [ - * ['app1', 'http://example.com/path/to/app1/remoteEntry.js'], - * ['app2', 'http://example.com/path/to/app2/remoteEntry.js'], - * ] - */ - remotes: [ - ['rspack_remote1', 'http://localhost:4201/'], - ['rspack_remote2', 'http://localhost:4202/'], - ], -}; - -// Nx plugins for rspack to build config object from Nx options and context. -/** - * DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support for Module Federation - * The DTS Plugin can be enabled by setting dts: true - * Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html - */ -export default composePlugins( - withNx(), - withReact(), - withModuleFederation(prodConfig, { dts: false }), - withZephyr() -); diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.module.css b/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.module.css deleted file mode 100644 index 7b88fbab..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.module.css +++ /dev/null @@ -1 +0,0 @@ -/* Your styles goes here. */ diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.spec.tsx b/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.spec.tsx deleted file mode 100644 index f76fa4de..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.spec.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { render } from '@testing-library/react'; - -import { BrowserRouter } from 'react-router-dom'; - -import App from './app'; - -describe('App', () => { - it('should render successfully', () => { - const { baseElement } = render( - - - , - ); - expect(baseElement).toBeTruthy(); - }); - - it('should have a greeting as the title', () => { - const { getByText } = render( - - - , - ); - expect(getByText(/Welcome host/gi)).toBeTruthy(); - }); -}); diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.tsx b/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.tsx deleted file mode 100644 index fe9bf4b0..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/src/app/app.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import * as React from 'react'; - -import NxWelcome from './nx-welcome'; - -import { Link, Route, Routes } from 'react-router-dom'; - -const Remote1 = React.lazy(() => import('rspack_remote1/Module')); - -const Remote2 = React.lazy(() => import('rspack_remote2/Module')); - -export function App() { - return ( - -
    -
  • - Home -
  • - -
  • - Remote1 -
  • - -
  • - Remote2 -
  • -
- - } /> - - } /> - - } /> - -
- ); -} - -export default App; diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/src/react-router-dom.d.ts b/examples/create-nx-rspack-workspace-mf/apps/host/src/react-router-dom.d.ts deleted file mode 100644 index d41e4430..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/src/react-router-dom.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -declare module 'react-router-dom' { - import * as React from 'react'; - - export interface RouteProps { - path?: string; - element?: React.ReactNode; - index?: boolean; - children?: React.ReactNode; - } - - export interface RoutesProps { - children?: React.ReactNode; - } - - export interface LinkProps { - to: string; - children?: React.ReactNode; - [key: string]: any; - } - - export const Route: React.FC; - export const Routes: React.FC; - export const Link: React.FC; - export const BrowserRouter: React.FC<{ children?: React.ReactNode }>; -} \ No newline at end of file diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/src/styles.css b/examples/create-nx-rspack-workspace-mf/apps/host/src/styles.css deleted file mode 100644 index 90d4ee00..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/tsconfig.json b/examples/create-nx-rspack-workspace-mf/apps/host/tsconfig.json deleted file mode 100644 index 21b50710..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": false, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - } - ], - "extends": "../../tsconfig.base.json" -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/host/tsconfig.spec.json b/examples/create-nx-rspack-workspace-mf/apps/host/tsconfig.spec.json deleted file mode 100644 index 643969a8..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/host/tsconfig.spec.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": [ - "jest", - "node", - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/.eslintrc.json b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/.eslintrc.json deleted file mode 100644 index 696cb8b1..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/cypress.config.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/cypress.config.ts deleted file mode 100644 index 064eb21a..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/cypress.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; - -import { defineConfig } from 'cypress'; - -export default defineConfig({ - e2e: { - ...nxE2EPreset(__filename, { cypressDir: 'src' }), - baseUrl: 'http://localhost:4201', - }, -}); diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/project.json b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/project.json deleted file mode 100644 index 0369174b..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/project.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "rspack_remote1-e2e", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "application", - "sourceRoot": "apps/rspack_remote1-e2e/src", - "tags": [], - "implicitDependencies": ["rspack_remote1"], - "targets": { - "e2e": { - "executor": "@nx/cypress:cypress", - "options": { - "cypressConfig": "apps/rspack_remote1-e2e/cypress.config.ts", - "testingType": "e2e", - "devServerTarget": "rspack_remote1:serve" - }, - "configurations": { - "production": { - "devServerTarget": "rspack_remote1:serve:production" - }, - "ci": { - "devServerTarget": "rspack_remote1:serve-static" - } - } - }, - "lint": { - "executor": "@nx/eslint:lint" - } - } -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/e2e/app.cy.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/e2e/app.cy.ts deleted file mode 100644 index 975e2d8d..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/e2e/app.cy.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { getGreeting } from '../support/app.po'; - -describe('rspack_remote1-e2e', () => { - beforeEach(() => cy.visit('/')); - - it('should display welcome message', () => { - // Custom command example, see `../support/commands.ts` file - cy.login('my-email@something.com', 'myPassword'); - - // Function helper example, see `../support/app.po.ts` file - getGreeting().contains(/Welcome/); - }); -}); diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/fixtures/example.json b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/fixtures/example.json deleted file mode 100644 index 02e42543..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/app.po.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/app.po.ts deleted file mode 100644 index 32934246..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/app.po.ts +++ /dev/null @@ -1 +0,0 @@ -export const getGreeting = () => cy.get('h1'); diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/commands.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/commands.ts deleted file mode 100644 index c421a3c4..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/commands.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** - -// eslint-disable-next-line @typescript-eslint/no-namespace -declare namespace Cypress { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - interface Chainable { - login(email: string, password: string): void; - } -} - -// -- This is a parent command -- -Cypress.Commands.add('login', (email, password) => { - console.log('Custom command example: Login', email, password); -}); -// -// -- This is a child command -- -// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/e2e.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/e2e.ts deleted file mode 100644 index 1c1a9e77..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/src/support/e2e.ts +++ /dev/null @@ -1,17 +0,0 @@ -// *********************************************************** -// This example support/e2e.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.ts using ES2015 syntax: -import './commands'; diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/tsconfig.json b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/tsconfig.json deleted file mode 100644 index e1eeabdb..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1-e2e/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["cypress", "node"], - "sourceMap": false - }, - "include": [ - "**/*.ts", - "**/*.js", - "cypress.config.ts", - "**/*.cy.ts", - "**/*.cy.tsx", - "**/*.cy.js", - "**/*.cy.jsx", - "**/*.d.ts" - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/.eslintrc.json b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/.eslintrc.json deleted file mode 100644 index a39ac5d0..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/jest.config.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/jest.config.ts deleted file mode 100644 index 475272b3..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/jest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'rspack_remote1', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/apps/rspack_remote1', -}; diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/module-federation.config.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/module-federation.config.ts deleted file mode 100644 index a7ff9438..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/module-federation.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ModuleFederationConfig } from '@nx/rspack/module-federation'; - -const config: ModuleFederationConfig = { - name: 'rspack_remote1', - - exposes: { - './Module': './src/remote-entry.ts', - }, -}; - -export default config; diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/package.json b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/package.json deleted file mode 100644 index 17c2e13b..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "rspack_remote1", - "version": "0.0.0" -} \ No newline at end of file diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/rspack.config.prod.ts b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/rspack.config.prod.ts deleted file mode 100644 index 0c2be66b..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/rspack.config.prod.ts +++ /dev/null @@ -1 +0,0 @@ -export default require('./rspack.config'); diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.module.css b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.module.css deleted file mode 100644 index 7b88fbab..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.module.css +++ /dev/null @@ -1 +0,0 @@ -/* Your styles goes here. */ diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.spec.tsx b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.spec.tsx deleted file mode 100644 index f98d55e2..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.spec.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from '@testing-library/react'; - -import App from './app'; - -describe('App', () => { - it('should render successfully', () => { - const { baseElement } = render(); - expect(baseElement).toBeTruthy(); - }); - - it('should have a greeting as the title', () => { - const { getByText } = render(); - expect(getByText(/Welcome rspack_remote1/gi)).toBeTruthy(); - }); -}); diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.tsx b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.tsx deleted file mode 100644 index 3334d540..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/app.tsx +++ /dev/null @@ -1,14 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import styles from './app.module.css'; - -import NxWelcome from './nx-welcome'; - -export function App() { - return ( -
- -
- ); -} - -export default App; diff --git a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/nx-welcome.tsx b/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/nx-welcome.tsx deleted file mode 100644 index f3c5c7a9..00000000 --- a/examples/create-nx-rspack-workspace-mf/apps/rspack_remote1/src/app/nx-welcome.tsx +++ /dev/null @@ -1,856 +0,0 @@ -/* - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - This is a starter component and can be deleted. - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - Delete this file and get started with your project! - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - */ -export function NxWelcome({ title }: { title: string }) { - return ( - <> - -
-
- -
-

- Hello there, - Welcome nx-ng 👋 -

-
- -
-
-

- - - - You're up and running -

- What's next? -
-
- - - -
-
- - - -
-

Next steps

-

Here are some things you can do with Nx:

-
- - - - - Add UI library - -
# Generate UI lib
-nx g @nx/angular:lib ui
-# Add a component
-nx g @nx/angular:component button --project ui
-
-
- - - - - View interactive project graph - -
nx graph
-
-
- - - - - Run affected commands - -
# see what's been affected by changes
-nx affected:graph
-# run tests for current changes
-nx affected:test
-# run e2e tests for current changes
-nx affected:e2e
-
-
-

- Carefully crafted with - - - -

-
-
- `, - styles: [], - encapsulation: ViewEncapsulation.None, -}) -export class NxWelcomeComponent {} diff --git a/examples/nx-ng/src/assets/.gitkeep b/examples/nx-ng/src/assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/nx-ng/src/favicon.ico b/examples/nx-ng/src/favicon.ico deleted file mode 100644 index 317ebcb2..00000000 Binary files a/examples/nx-ng/src/favicon.ico and /dev/null differ diff --git a/examples/nx-ng/src/index.html b/examples/nx-ng/src/index.html deleted file mode 100644 index 2dd929cc..00000000 --- a/examples/nx-ng/src/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - nx-ng - - - - - - - - diff --git a/examples/nx-ng/src/main.ts b/examples/nx-ng/src/main.ts deleted file mode 100644 index 4ecc5cf6..00000000 --- a/examples/nx-ng/src/main.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { appConfig } from './app/app.config'; -import { bootstrapApplication } from '@angular/platform-browser'; - -import { AppComponent } from './app/app.component'; - -bootstrapApplication(AppComponent, appConfig).catch((err) => - console.error(err) -); diff --git a/examples/nx-ng/src/styles.css b/examples/nx-ng/src/styles.css deleted file mode 100644 index 90d4ee00..00000000 --- a/examples/nx-ng/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/examples/nx-ng/src/test-setup.ts b/examples/nx-ng/src/test-setup.ts deleted file mode 100644 index 1100b3e8..00000000 --- a/examples/nx-ng/src/test-setup.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest-preset-angular/setup-jest'; diff --git a/examples/nx-ng/tsconfig.app.json b/examples/nx-ng/tsconfig.app.json deleted file mode 100644 index 3c5c0c56..00000000 --- a/examples/nx-ng/tsconfig.app.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./dist/out-tsc", - "types": [] - }, - "files": ["src/main.ts"], - "include": ["src/**/*.d.ts"], - "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] -} diff --git a/examples/nx-ng/tsconfig.editor.json b/examples/nx-ng/tsconfig.editor.json deleted file mode 100644 index 8ae117d9..00000000 --- a/examples/nx-ng/tsconfig.editor.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*.ts"], - "compilerOptions": { - "types": ["jest", "node"] - } -} diff --git a/examples/nx-ng/tsconfig.json b/examples/nx-ng/tsconfig.json deleted file mode 100644 index 29636fe1..00000000 --- a/examples/nx-ng/tsconfig.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "compilerOptions": { - "rootDir": ".", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "target": "es2022", - "module": "esnext", - "lib": ["es2017", "dom"], - "skipLibCheck": true, - "skipDefaultLibCheck": true, - "baseUrl": ".", - "useDefineForClassFields": false, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - }, - { - "path": "./tsconfig.editor.json" - } - ], - "compileOnSave": false, - "exclude": ["node_modules", "tmp"], - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true - } -} diff --git a/examples/nx-ng/tsconfig.spec.json b/examples/nx-ng/tsconfig.spec.json deleted file mode 100644 index 1dbe7f64..00000000 --- a/examples/nx-ng/tsconfig.spec.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./dist/out-tsc", - "module": "commonjs", - "target": "es2016", - "types": ["jest", "node"] - }, - "files": ["src/test-setup.ts"], - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.d.ts" - ] -} diff --git a/examples/parcel-react/package.json b/examples/parcel-react/package.json deleted file mode 100644 index 631cd067..00000000 --- a/examples/parcel-react/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "parcel-react", - "version": "1.0.0", - "description": "", - "scripts": { - "dev": "parcel index.html", - "build": "parcel build index.html" - }, - "dependencies": { - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@parcel/config-default": "2.13.3", - "parcel": "2.13.3", - "parcel-reporter-zephyr": "catalog:zephyr", - "typescript": "^5.7.3", - "process": "^0.11.10" - }, - "browserslist": ["> 0.5%, last 2 versions, not dead"] -} diff --git a/examples/react-airbnb-clone/package.json b/examples/react-airbnb-clone/package.json deleted file mode 100644 index ad2505d8..00000000 --- a/examples/react-airbnb-clone/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "react-airbnb-clone", - "workspaces": [ - "./apps/*" - ], - "scripts": { - "dev": "pnpm -r --parallel run dev", - "build": "pnpm build-remotes && pnpm build-host", - "build-remotes": "pnpm --filter=./apps/* --filter=!airbnb-react-host --parallel run build", - "build-host": "pnpm --filter=airbnb-react-host run build", - "start": "pnpm --filter=./apps/* --parallel run start", - "start-remotes": "pnpm --filter=./apps/* --filter=!airbnb-react-host --parallel run start", - "start-host": "pnpm --filter=airbnb-react-host run start" - }, - "dependencies": { - "concurrently": "^9.1.0", - "date-fns": "^4.1.0", - "eslint": "catalog:eslint", - "leaflet": "^1.9.4", - "match-sorter": "^8.0.0", - "path-browserify": "^1.0.1", - "query-string": "^9.1.1", - "react": "^18.3.1", - "react-date-range": "^2.0.1", - "react-dom": "^18.3.1", - "react-error-boundary": "^4.1.2", - "react-hook-form": "^7.53.2", - "react-hot-toast": "^2.4.1", - "react-icons": "^5.3.0", - "react-leaflet": "^4.2.1", - "react-router-dom": "^6.30.0", - "react-select": "^5.8.3", - "react-spinners": "^0.14.1", - "sort-by": "^1.2.0", - "swr": "^2.2.5", - "util": "^0.12.5", - "uuid": "^11.0.3", - "world-countries": "^5.0.0", - "zephyr-webpack-plugin": "catalog:zephyr", - "zustand": "^5.0.1" - }, - "devDependencies": { - "@babel/core": "catalog:babel", - "@babel/preset-react": "catalog:babel", - "@babel/preset-typescript": "catalog:babel", - "@module-federation/enhanced": "catalog:module-federation", - "@types/leaflet": "^1.9.14", - "@types/node": "catalog:typescript", - "@types/react": "^18.3.20", - "@types/react-date-range": "^1.4.9", - "@types/react-dom": "^18.3.5", - "@types/uuid": "^10.0.0", - "@webpack-cli/serve": "^2.0.5", - "autoprefixer": "catalog:postcss", - "babel-loader": "catalog:babel", - "css-loader": "catalog:common", - "file-loader": "^6.2.0", - "html-webpack-plugin": "catalog:webpack5", - "http-server": "^14.1.1", - "postcss": "catalog:postcss", - "postcss-loader": "catalog:postcss", - "rimraf": "^6.0.1", - "style-loader": "catalog:common", - "tailwindcss": "catalog:tailwind3", - "tslib": "catalog:typescript", - "typescript": "catalog:typescript", - "webpack": "catalog:webpack5", - "webpack-cli": "catalog:webpack5", - "webpack-dev-server": "catalog:webpack5" - } -} diff --git a/examples/react-rollup-ts/package.json b/examples/react-rollup-ts/package.json deleted file mode 100644 index 1b2aae66..00000000 --- a/examples/react-rollup-ts/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "rollup-react-ts", - "version": "0.0.1", - "main": "./dist/index.js", - "scripts": { - "build": "rollup -c --environment NODE_ENV:production", - "build:watch": "rollup -c --watch" - }, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18", - "rollup-plugin-zephyr": "catalog:zephyr" - }, - "devDependencies": { - "@babel/preset-react": "catalog:babel", - "@rollup/plugin-babel": "catalog:rollup", - "@rollup/plugin-commonjs": "catalog:rollup", - "@rollup/plugin-html": "catalog:rollup", - "@rollup/plugin-node-resolve": "catalog:rollup", - "@rollup/plugin-replace": "catalog:rollup", - "@rollup/plugin-typescript": "catalog:rollup", - "@svgr/rollup": "catalog:rollup", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "rollup": "catalog:rollup", - "rollup-plugin-postcss": "catalog:rollup", - "typescript": "catalog:typescript" - } -} diff --git a/examples/react-tractor-sample/.gitignore b/examples/react-tractor-sample/.gitignore deleted file mode 100644 index 09d0cb96..00000000 --- a/examples/react-tractor-sample/.gitignore +++ /dev/null @@ -1,46 +0,0 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -.nx -.env -.node-persist -dist -tmp -/out-tsc - -# dependencies -node_modules - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -../.vscode/* -!../.vscode/settings.json -!../.vscode/tasks.json -!../.vscode/launch.json -!../.vscode/extensions.json - -# misc -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -yarn-error.log -testem.log -/typings - -# System Files -.DS_Store -Thumbs.db - -# nx -.nx/cache -migrations.json diff --git a/examples/react-tractor-sample/.npmrc b/examples/react-tractor-sample/.npmrc deleted file mode 100644 index 521a9f7c..00000000 --- a/examples/react-tractor-sample/.npmrc +++ /dev/null @@ -1 +0,0 @@ -legacy-peer-deps=true diff --git a/examples/react-tractor-sample/README.md b/examples/react-tractor-sample/README.md deleted file mode 100644 index 7525e106..00000000 --- a/examples/react-tractor-sample/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# React Tractor Sample - Nx + Webpack + Module Federation - -A micro-frontend implementation of the classic Tractor Store demonstrating Module Federation with Nx workspace management and Webpack 5. - -## Technology Stack - -- **Framework**: React 18 with TypeScript -- **Architecture**: Module Federation -- **Build System**: Nx Workspace -- **Bundler**: Webpack 5 -- **Language**: TypeScript -- **Deployment**: Zephyr Cloud -- **Development**: Webpack Dev Server - -## Prerequisites - -- Node.js (version 16 or higher) -- npm or yarn - -## Project Structure - -This Nx workspace consists of three federated teams/applications: - -- **`team-red/`** - Host application that orchestrates the micro-frontends -- **`team-blue/`** - Remote application with product catalog functionality -- **`team-green/`** - Remote application with checkout and cart functionality - -## Getting Started - -1. **Install dependencies** - ```bash - npm install - ``` - -2. **Development mode** - - Start all applications: - ```bash - # Development servers will start on different ports - npx nx serve team-red # Host application - npx nx serve team-blue # Remote application - npx nx serve team-green # Remote application - ``` - -3. **Build for production** (in correct order) - - Because this is a Module Federation setup, remotes must be built before the host: - - ```bash - npx nx run team-green:build - npx nx run team-blue:build - npx nx run team-red:build - ``` - - Or use the convenience script: - ```bash - npm run build - ``` - -4. **Individual team builds** - ```bash - npm run build:team-red - npm run build:team-blue - npm run build:team-green - ``` - -## Module Federation Architecture - -- **Host Application** (`team-red`) consumes and orchestrates the remote micro-frontends -- **Remote Applications** (`team-blue`, `team-green`) expose components that represent different business domains -- **Build Order Dependency**: Remotes must be built first so Zephyr Cloud can map remote applications to the host - -## Zephyr Cloud Integration - -This example demonstrates enterprise-scale micro-frontend deployment with Zephyr Cloud: - -1. Remote applications are built and deployed first -2. Zephyr Cloud maps the remote entry points automatically -3. The host application consumes the deployed remotes at runtime -4. Independent deployment cycles for each team's micro-frontend - -## About Module Federation - -Module Federation enables: -- **Team autonomy**: Different teams can own different micro-frontends -- **Independent deployment**: Each team can deploy their part separately -- **Runtime composition**: Applications compose at runtime, not build time -- **Technology diversity**: Teams can use different versions of libraries -- **Shared dependencies**: Efficient sharing of common libraries like React - -## About Zephyr Cloud - -Zephyr Cloud is a micro-frontend deployment platform that provides: -- **Auto-deployment**: Seamless deployment from your build process -- **Live preview links**: Instant preview URLs for your applications -- **SemVer versioning**: Semantic versioning for your frontend modules -- **Rollback capabilities**: Easy rollback to previous versions -- **Enterprise-scale orchestration**: Built for composable frontend systems - -## Learn More - -- [Nx Documentation](https://nx.dev/) -- [Module Federation Documentation](https://module-federation.io/) -- [React Tractor Store Tutorial](https://micro-frontends.org/tractor-store/) -- [Zephyr Cloud Documentation](https://docs.zephyr-cloud.io) \ No newline at end of file diff --git a/examples/react-tractor-sample/apps/team-blue/.babelrc b/examples/react-tractor-sample/apps/team-blue/.babelrc deleted file mode 100644 index 88ee27b1..00000000 --- a/examples/react-tractor-sample/apps/team-blue/.babelrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic" - } - ] - ], - "plugins": [] -} diff --git a/examples/react-tractor-sample/apps/team-blue/.eslintrc.json b/examples/react-tractor-sample/apps/team-blue/.eslintrc.json deleted file mode 100644 index 772a43d2..00000000 --- a/examples/react-tractor-sample/apps/team-blue/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/examples/react-tractor-sample/apps/team-blue/jest.config.ts b/examples/react-tractor-sample/apps/team-blue/jest.config.ts deleted file mode 100644 index 789e7dab..00000000 --- a/examples/react-tractor-sample/apps/team-blue/jest.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'team-blue', - preset: '../../../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: - '../../coverage/apps/team-blue', -}; diff --git a/examples/react-tractor-sample/apps/team-blue/package.json b/examples/react-tractor-sample/apps/team-blue/package.json deleted file mode 100644 index 38cfd7c0..00000000 --- a/examples/react-tractor-sample/apps/team-blue/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "team_blue", - "version": "0.1.0", - "repository": { - "type": "git", - "url": "https://github.com/valorkin/zephyr-mono.git" - }, - "private": true -} diff --git a/examples/react-tractor-sample/apps/team-blue/project.json b/examples/react-tractor-sample/apps/team-blue/project.json deleted file mode 100644 index de9917d7..00000000 --- a/examples/react-tractor-sample/apps/team-blue/project.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "team_blue", - "$schema": "../../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/team-blue/src", - "projectType": "application", - "tags": [], - "targets": { - "build": { - "executor": "@nx/webpack:webpack", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "production", - "options": { - "compiler": "babel", - "outputPath": "dist/apps/team-blue", - "index": "apps/team-blue/src/index.html", - "baseHref": "/", - "main": "apps/team-blue/src/main.tsx", - "tsConfig": "apps/team-blue/tsconfig.app.json", - "assets": [], - "styles": [ - "apps/team-blue/src/styles.css" - ], - "scripts": [], - "webpackConfig": "apps/team-blue/webpack.config.ts" - }, - "configurations": { - "development": { - "extractLicenses": false, - "optimization": false, - "sourceMap": true, - "vendorChunk": true - }, - "production": { - "fileReplacements": [ - { - "replace": "apps/team-blue/src/environments/environment.ts", - "with": "apps/team-blue/src/environments/environment.prod.ts" - } - ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "extractLicenses": false, - "vendorChunk": false - } - } - }, - "serve": { - "executor": "@nx/webpack:dev-server", - "defaultConfiguration": "development", - "options": { - "port": 4300, - "buildTarget": "team_blue:build", - "hmr": false - }, - "configurations": { - "development": { - "buildTarget": "team_blue:build:development" - }, - "production": { - "buildTarget": "team_blue:build:production", - "hmr": false - } - } - }, - "lint": { - "executor": "@nx/eslint:lint", - "options": { - "lintFilePatterns": ["{projectRoot}/**/*.{ts,tsx,js,jsx}"] - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "apps/team-blue/jest.config.ts", - "passWithNoTests": true - }, - "configurations": { - "ci": { - "ci": true, - "codeCoverage": true - } - } - } - } -} diff --git a/examples/react-tractor-sample/apps/team-blue/src/app/app.tsx b/examples/react-tractor-sample/apps/team-blue/src/app/app.tsx deleted file mode 100644 index 4b33d130..00000000 --- a/examples/react-tractor-sample/apps/team-blue/src/app/app.tsx +++ /dev/null @@ -1,24 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars - -import * as ReactDOM from 'react-dom/client'; -import { StrictMode } from 'react'; -import BlueBasket from './team-blue-basket'; -import BlueBuy from './team-blue-buy'; - -export function App() { - return ( -
- - -
- ); -} - -const root = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement -); -root.render( - - - -); diff --git a/examples/react-tractor-sample/apps/team-blue/src/app/team-blue-basket.tsx b/examples/react-tractor-sample/apps/team-blue/src/app/team-blue-basket.tsx deleted file mode 100644 index 4d832ef3..00000000 --- a/examples/react-tractor-sample/apps/team-blue/src/app/team-blue-basket.tsx +++ /dev/null @@ -1,39 +0,0 @@ -// todo: split and export default - -import { useEffect, useState } from 'react'; - -function log(...args: string[]) { - console.log('🛒 blue-basket', ...args); -} - -const state: { count: number } = { - count: 0, -}; - -export default function BlueBasket({ id }: { id: string }) { - const [classname, setClassname] = useState( - state.count === 0 ? 'empty' : 'filled' - ); - const [count, setCount] = useState(state.count); - - useEffect(() => { - log('connected'); - const refresh = () => { - log('event recieved "blue:basket:changed"'); - setCount(++state.count); - }; - - window.addEventListener('blue:basket:changed', refresh); - - return () => { - window.removeEventListener('blue:basket:changed', refresh); - log('disconnected'); - }; - }, []); - - return ( -
-
basket: {count} item(s)
-
- ); -} diff --git a/examples/react-tractor-sample/apps/team-blue/src/app/team-blue-buy.tsx b/examples/react-tractor-sample/apps/team-blue/src/app/team-blue-buy.tsx deleted file mode 100644 index afdccd80..00000000 --- a/examples/react-tractor-sample/apps/team-blue/src/app/team-blue-buy.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { useEffect, useState } from 'react'; - -const prices: Record = { - t_porsche: '66,00 €', - t_fendt: '54,00 €', - t_eicher: '58,00 €', -}; -export default function BlueBuy({ id, sku }: { id: string; sku: string }) { - const [price, setPrice] = useState(prices[sku]); - - const log = (...args: string[]) => { - console.log('🔘 blue-buy', ...args); - }; - - const addToCart = () => { - log('event sent "blue:basket:changed"'); - window.dispatchEvent( - new CustomEvent('blue:basket:changed', { - bubbles: true, - detail: { price }, - }) - ); - }; - - log('connected', sku); - - useEffect(() => { - setPrice(prices[sku]); - log('event sent "blue:basket:changed"'); - - return () => { - log('disconnected', sku); - }; - }, [sku]); - - return ( -
- -
- ); -} diff --git a/examples/react-tractor-sample/apps/team-blue/src/assets/.gitkeep b/examples/react-tractor-sample/apps/team-blue/src/assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/react-tractor-sample/apps/team-blue/src/index.html b/examples/react-tractor-sample/apps/team-blue/src/index.html deleted file mode 100644 index 81c7d4d5..00000000 --- a/examples/react-tractor-sample/apps/team-blue/src/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - TeamBlue - - - - - - -
- - diff --git a/examples/react-tractor-sample/apps/team-blue/src/main.tsx b/examples/react-tractor-sample/apps/team-blue/src/main.tsx deleted file mode 100644 index 2cc957ee..00000000 --- a/examples/react-tractor-sample/apps/team-blue/src/main.tsx +++ /dev/null @@ -1 +0,0 @@ -import('./app/app'); diff --git a/examples/react-tractor-sample/apps/team-blue/src/styles.css b/examples/react-tractor-sample/apps/team-blue/src/styles.css deleted file mode 100644 index 90d4ee00..00000000 --- a/examples/react-tractor-sample/apps/team-blue/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/examples/react-tractor-sample/apps/team-blue/tsconfig.app.json b/examples/react-tractor-sample/apps/team-blue/tsconfig.app.json deleted file mode 100644 index 54488401..00000000 --- a/examples/react-tractor-sample/apps/team-blue/tsconfig.app.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "es2022", - "target": "ES2022", - "outDir": "../../dist/out-tsc", - "types": [ - "node", - - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "jest.config.ts", - "src/**/*.spec.ts", - "src/**/*.test.ts", - "src/**/*.spec.tsx", - "src/**/*.test.tsx", - "src/**/*.spec.js", - "src/**/*.test.js", - "src/**/*.spec.jsx", - "src/**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/examples/react-tractor-sample/apps/team-blue/tsconfig.json b/examples/react-tractor-sample/apps/team-blue/tsconfig.json deleted file mode 100644 index c9dd5f81..00000000 --- a/examples/react-tractor-sample/apps/team-blue/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": false, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - } - ], - "extends": "../../tsconfig.json" -} diff --git a/examples/react-tractor-sample/apps/team-blue/tsconfig.spec.json b/examples/react-tractor-sample/apps/team-blue/tsconfig.spec.json deleted file mode 100644 index 610cd1b0..00000000 --- a/examples/react-tractor-sample/apps/team-blue/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": ["jest", "node"] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ], - "types": ["@nx/react/typings/cssmodule.d.ts", "@nx/react/typings/image.d.ts"] -} diff --git a/examples/react-tractor-sample/apps/team-blue/webpack.config.ts b/examples/react-tractor-sample/apps/team-blue/webpack.config.ts deleted file mode 100644 index 5beb0783..00000000 --- a/examples/react-tractor-sample/apps/team-blue/webpack.config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { withReact } from '@nx/react'; -import { withModuleFederation } from '@nx/module-federation/webpack'; -import type { ModuleFederationConfig } from '@nx/module-federation'; -import { composePlugins, withNx } from '@nx/webpack'; -import { withZephyr } from 'zephyr-webpack-plugin'; - -const mfConfig: ModuleFederationConfig = { - name: 'team_blue', - exposes: { - './BlueBasket': './src/app/team-blue-basket.tsx', - './BlueBuy': './src/app/team-blue-buy.tsx', - }, - additionalShared: [ - ['react', { singleton: true }] , - ['react-dom', { singleton: true }] , - ], -}; - -// Nx plugins for webpack. -module.exports = composePlugins( - withNx(), - withReact(), - withModuleFederation(mfConfig), - withZephyr(), - (config) => { - return config; - }, -); diff --git a/examples/react-tractor-sample/apps/team-green/.babelrc b/examples/react-tractor-sample/apps/team-green/.babelrc deleted file mode 100644 index 88ee27b1..00000000 --- a/examples/react-tractor-sample/apps/team-green/.babelrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic" - } - ] - ], - "plugins": [] -} diff --git a/examples/react-tractor-sample/apps/team-green/.eslintrc.json b/examples/react-tractor-sample/apps/team-green/.eslintrc.json deleted file mode 100644 index 772a43d2..00000000 --- a/examples/react-tractor-sample/apps/team-green/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/examples/react-tractor-sample/apps/team-green/jest.config.ts b/examples/react-tractor-sample/apps/team-green/jest.config.ts deleted file mode 100644 index 8483f67f..00000000 --- a/examples/react-tractor-sample/apps/team-green/jest.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'team-green', - preset: '../../../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: - '../../coverage/apps/team-green', -}; diff --git a/examples/react-tractor-sample/apps/team-green/package.json b/examples/react-tractor-sample/apps/team-green/package.json deleted file mode 100644 index ddb1d709..00000000 --- a/examples/react-tractor-sample/apps/team-green/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "team_green", - "version": "0.1.0", - "repository": { - "type": "git", - "url": "https://github.com/valorkin/zephyr-mono.git" - }, - "private": true -} diff --git a/examples/react-tractor-sample/apps/team-green/project.json b/examples/react-tractor-sample/apps/team-green/project.json deleted file mode 100644 index 8a8afbdd..00000000 --- a/examples/react-tractor-sample/apps/team-green/project.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "team_green", - "$schema": "../../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/team-green/src", - "projectType": "application", - "tags": [], - "targets": { - "build": { - "executor": "@nx/webpack:webpack", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "production", - "options": { - "compiler": "babel", - "outputPath": "dist/apps/team-green", - "index": "apps/team-green/src/index.html", - "baseHref": "/", - "main": "apps/team-green/src/main.tsx", - "tsConfig": "apps/team-green/tsconfig.app.json", - "assets": [ - { - "glob": "**/*", - "input": "apps/team-green/src/assets", - "output": "." - } - ], - "styles": [ - "apps/team-green/src/styles.css" - ], - "scripts": [], - "webpackConfig": "apps/team-green/webpack.config.ts" - }, - "configurations": { - "development": { - "extractLicenses": false, - "optimization": false, - "sourceMap": true, - "vendorChunk": true - }, - "production": { - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "extractLicenses": false, - "vendorChunk": false - } - } - }, - "serve": { - "executor": "@nx/webpack:dev-server", - "defaultConfiguration": "development", - "options": { - "port": 4400, - "buildTarget": "team_green:build", - "hmr": false - }, - "configurations": { - "development": { - "buildTarget": "team_green:build:development" - }, - "production": { - "buildTarget": "team_green:build:production", - "hmr": false - } - } - }, - "lint": { - "executor": "@nx/eslint:lint", - "options": { - "lintFilePatterns": ["{projectRoot}/**/*.{ts,tsx,js,jsx}"] - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "apps/team-green/jest.config.ts", - "passWithNoTests": true - }, - "configurations": { - "ci": { - "ci": true, - "codeCoverage": true - } - } - } - } -} diff --git a/examples/react-tractor-sample/apps/team-green/src/app/app.tsx b/examples/react-tractor-sample/apps/team-green/src/app/app.tsx deleted file mode 100644 index a38120f5..00000000 --- a/examples/react-tractor-sample/apps/team-green/src/app/app.tsx +++ /dev/null @@ -1,22 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars - -import GreenRecos from './team-green-recos'; -import * as ReactDOM from 'react-dom/client'; -import { StrictMode } from 'react'; - -export function App() { - return ( -
- -
- ); -} - -const root = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement -); -root.render( - - - -); diff --git a/examples/react-tractor-sample/apps/team-green/src/app/team-green-recos-v2.tsx b/examples/react-tractor-sample/apps/team-green/src/app/team-green-recos-v2.tsx deleted file mode 100644 index ee6b3a06..00000000 --- a/examples/react-tractor-sample/apps/team-green/src/app/team-green-recos-v2.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useEffect, useState } from 'react'; - -const recos: Record = { - t_porsche: ['3', '5', '6'], - t_fendt: ['3', '6', '4'], - t_eicher: ['1', '8', '7'], -}; - -function log(...args: string[]) { - console.log('🖼️ green-recos', ...args); -} - -export default function GreenRecos({ id, sku }: { id: string; sku: string }) { - const [reco, setReco] = useState(recos[sku] || []); - - log('connected', sku); - useEffect(() => { - setReco(recos[sku] || []); - return () => { - log('disconnected', sku); - }; - }, [sku]); - - return ( -
-

Related Products v2

- {reco.map((id) => ( - {`Reco - ))} -
- ); -} diff --git a/examples/react-tractor-sample/apps/team-green/src/app/team-green-recos.tsx b/examples/react-tractor-sample/apps/team-green/src/app/team-green-recos.tsx deleted file mode 100644 index a4f1c5a4..00000000 --- a/examples/react-tractor-sample/apps/team-green/src/app/team-green-recos.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { useEffect, useState } from 'react'; - -const recos: Record = { - t_porsche: ['3', '5', '6'], - t_fendt: ['3', '6', '4'], - t_eicher: ['1', '8', '7'], -}; - -function log(...args: string[]) { - console.log('🖼️ green-recos', ...args); -} - -export default function GreenRecos({ id, sku }: { id: string; sku: string }) { - const [reco, setReco] = useState(recos[sku] || []); - - log('connected', sku); - useEffect(() => { - setReco(recos[sku] || []); - return () => { - log('disconnected', sku); - }; - }, [sku]); - - return ( -
- {/*---------------*/} -

Related Products v11

- {/*---------------*/} - {reco.map((id) => ( - {`Reco - ))} -
- ); -} diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/.gitkeep b/examples/react-tractor-sample/apps/team-green/src/assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_1.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_1.jpg deleted file mode 100644 index 9722a95a..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_1.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_2.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_2.jpg deleted file mode 100644 index 530e00b6..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_2.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_3.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_3.jpg deleted file mode 100644 index 04c287ad..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_3.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_4.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_4.jpg deleted file mode 100644 index f8951d42..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_4.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_5.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_5.jpg deleted file mode 100644 index 13840c0f..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_5.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_6.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_6.jpg deleted file mode 100644 index 2674bc40..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_6.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_7.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_7.jpg deleted file mode 100644 index b553271d..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_7.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_8.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_8.jpg deleted file mode 100644 index e28ffb7b..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_8.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_9.jpg b/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_9.jpg deleted file mode 100644 index a3f05294..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/assets/team-green/images/reco_9.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/favicon.ico b/examples/react-tractor-sample/apps/team-green/src/favicon.ico deleted file mode 100644 index 317ebcb2..00000000 Binary files a/examples/react-tractor-sample/apps/team-green/src/favicon.ico and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-green/src/index.html b/examples/react-tractor-sample/apps/team-green/src/index.html deleted file mode 100644 index 588166e7..00000000 --- a/examples/react-tractor-sample/apps/team-green/src/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - TeamGreen - - - - - -
- - diff --git a/examples/react-tractor-sample/apps/team-green/src/main.tsx b/examples/react-tractor-sample/apps/team-green/src/main.tsx deleted file mode 100644 index 2cc957ee..00000000 --- a/examples/react-tractor-sample/apps/team-green/src/main.tsx +++ /dev/null @@ -1 +0,0 @@ -import('./app/app'); diff --git a/examples/react-tractor-sample/apps/team-green/src/styles.css b/examples/react-tractor-sample/apps/team-green/src/styles.css deleted file mode 100644 index 90d4ee00..00000000 --- a/examples/react-tractor-sample/apps/team-green/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/examples/react-tractor-sample/apps/team-green/tsconfig.app.json b/examples/react-tractor-sample/apps/team-green/tsconfig.app.json deleted file mode 100644 index 54488401..00000000 --- a/examples/react-tractor-sample/apps/team-green/tsconfig.app.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "es2022", - "target": "ES2022", - "outDir": "../../dist/out-tsc", - "types": [ - "node", - - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "jest.config.ts", - "src/**/*.spec.ts", - "src/**/*.test.ts", - "src/**/*.spec.tsx", - "src/**/*.test.tsx", - "src/**/*.spec.js", - "src/**/*.test.js", - "src/**/*.spec.jsx", - "src/**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/examples/react-tractor-sample/apps/team-green/tsconfig.json b/examples/react-tractor-sample/apps/team-green/tsconfig.json deleted file mode 100644 index c9dd5f81..00000000 --- a/examples/react-tractor-sample/apps/team-green/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": false, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - } - ], - "extends": "../../tsconfig.json" -} diff --git a/examples/react-tractor-sample/apps/team-green/tsconfig.spec.json b/examples/react-tractor-sample/apps/team-green/tsconfig.spec.json deleted file mode 100644 index 610cd1b0..00000000 --- a/examples/react-tractor-sample/apps/team-green/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": ["jest", "node"] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ], - "types": ["@nx/react/typings/cssmodule.d.ts", "@nx/react/typings/image.d.ts"] -} diff --git a/examples/react-tractor-sample/apps/team-green/webpack.config.ts b/examples/react-tractor-sample/apps/team-green/webpack.config.ts deleted file mode 100644 index fdfd8c9d..00000000 --- a/examples/react-tractor-sample/apps/team-green/webpack.config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { withReact } from '@nx/react'; -import { withModuleFederation } from '@nx/module-federation/webpack'; -import { ModuleFederationConfig } from '@nx/module-federation'; -import { composePlugins, withNx } from '@nx/webpack'; -import { withZephyr } from 'zephyr-webpack-plugin'; - -const mfConfig: ModuleFederationConfig = { - name: 'team_green', - exposes: { - './GreenRecos': './src/app/team-green-recos.tsx', - }, - additionalShared: [ - ['react', { singleton: true }] , - ['react-dom', { singleton: true }] , - ], -}; - -// Nx plugins for webpack. -module.exports = composePlugins( - withNx(), - withReact(), - withModuleFederation(mfConfig), - withZephyr(), - (config, ctx) => { - return config; - } -); diff --git a/examples/react-tractor-sample/apps/team-red/.babelrc b/examples/react-tractor-sample/apps/team-red/.babelrc deleted file mode 100644 index 88ee27b1..00000000 --- a/examples/react-tractor-sample/apps/team-red/.babelrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic" - } - ] - ], - "plugins": [] -} diff --git a/examples/react-tractor-sample/apps/team-red/.eslintrc.json b/examples/react-tractor-sample/apps/team-red/.eslintrc.json deleted file mode 100644 index 772a43d2..00000000 --- a/examples/react-tractor-sample/apps/team-red/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/index.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/index.d.ts deleted file mode 100644 index 9034fcf0..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { PackageType as PackageType_0,RemoteKeys as RemoteKeys_0 } from './team_blue/apis.d.ts'; -import type { PackageType as PackageType_1,RemoteKeys as RemoteKeys_1 } from './team_green/apis.d.ts'; - declare module "@module-federation/runtime" { - type RemoteKeys = RemoteKeys_0 | RemoteKeys_1; - type PackageType = T extends RemoteKeys_0 ? PackageType_0 : -T extends RemoteKeys_1 ? PackageType_1 : -Y ; - export function loadRemote(packageName: T): Promise>; - export function loadRemote(packageName: T): Promise>; - } -declare module "@module-federation/enhanced/runtime" { - type RemoteKeys = RemoteKeys_0 | RemoteKeys_1; - type PackageType = T extends RemoteKeys_0 ? PackageType_0 : -T extends RemoteKeys_1 ? PackageType_1 : -Y ; - export function loadRemote(packageName: T): Promise>; - export function loadRemote(packageName: T): Promise>; - } -declare module "@module-federation/runtime-tools" { - type RemoteKeys = RemoteKeys_0 | RemoteKeys_1; - type PackageType = T extends RemoteKeys_0 ? PackageType_0 : -T extends RemoteKeys_1 ? PackageType_1 : -Y ; - export function loadRemote(packageName: T): Promise>; - export function loadRemote(packageName: T): Promise>; - } - \ No newline at end of file diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/BlueBasket.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/BlueBasket.d.ts deleted file mode 100644 index 982c1677..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/BlueBasket.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './compiled-types/apps/team-blue/src/app/team-blue-basket'; -export { default } from './compiled-types/apps/team-blue/src/app/team-blue-basket'; \ No newline at end of file diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/BlueBuy.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/BlueBuy.d.ts deleted file mode 100644 index 35986bd4..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/BlueBuy.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './compiled-types/apps/team-blue/src/app/team-blue-buy'; -export { default } from './compiled-types/apps/team-blue/src/app/team-blue-buy'; \ No newline at end of file diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/apis.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/apis.d.ts deleted file mode 100644 index 85ed5401..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/apis.d.ts +++ /dev/null @@ -1,3 +0,0 @@ - - export type RemoteKeys = 'team_blue/BlueBasket' | 'team_blue/BlueBuy'; - type PackageType = T extends 'team_blue/BlueBuy' ? typeof import('team_blue/BlueBuy') :T extends 'team_blue/BlueBasket' ? typeof import('team_blue/BlueBasket') :any; \ No newline at end of file diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/compiled-types/apps/team-blue/src/app/team-blue-basket.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/compiled-types/apps/team-blue/src/app/team-blue-basket.d.ts deleted file mode 100644 index 475a9906..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/compiled-types/apps/team-blue/src/app/team-blue-basket.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default function BlueBasket({ id }: { - id: string; -}): import("react/jsx-runtime").JSX.Element; diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/compiled-types/apps/team-blue/src/app/team-blue-buy.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/compiled-types/apps/team-blue/src/app/team-blue-buy.d.ts deleted file mode 100644 index 2ea72cbb..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_blue/compiled-types/apps/team-blue/src/app/team-blue-buy.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default function BlueBuy({ id, sku }: { - id: string; - sku: string; -}): import("react/jsx-runtime").JSX.Element; diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/GreenRecos.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/GreenRecos.d.ts deleted file mode 100644 index e02296ae..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/GreenRecos.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './compiled-types/apps/team-green/src/app/team-green-recos'; -export { default } from './compiled-types/apps/team-green/src/app/team-green-recos'; \ No newline at end of file diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/apis.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/apis.d.ts deleted file mode 100644 index 10538563..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/apis.d.ts +++ /dev/null @@ -1,3 +0,0 @@ - - export type RemoteKeys = 'team_green/GreenRecos'; - type PackageType = T extends 'team_green/GreenRecos' ? typeof import('team_green/GreenRecos') :any; \ No newline at end of file diff --git a/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/compiled-types/apps/team-green/src/app/team-green-recos.d.ts b/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/compiled-types/apps/team-green/src/app/team-green-recos.d.ts deleted file mode 100644 index 767067f4..00000000 --- a/examples/react-tractor-sample/apps/team-red/@mf-types/team_green/compiled-types/apps/team-green/src/app/team-green-recos.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default function GreenRecos({ id, sku }: { - id: string; - sku: string; -}): import("react/jsx-runtime").JSX.Element; diff --git a/examples/react-tractor-sample/apps/team-red/jest.config.ts b/examples/react-tractor-sample/apps/team-red/jest.config.ts deleted file mode 100644 index b564637d..00000000 --- a/examples/react-tractor-sample/apps/team-red/jest.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'team-red', - preset: '../../../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: - '../../coverage/apps/team-red', -}; diff --git a/examples/react-tractor-sample/apps/team-red/package.json b/examples/react-tractor-sample/apps/team-red/package.json deleted file mode 100644 index 0156c10d..00000000 --- a/examples/react-tractor-sample/apps/team-red/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "team_red", - "version": "0.1.0", - "repository": { - "type": "git", - "url": "https://github.com/valorkin/zephyr-mono.git" - }, - "scripts": { - "build": "nx run team_red:build --skip-nx-cache" - }, - "private": true, - "zephyr:dependencies": { - "team_green": "zephyr:team_green@*", - "team_blue": "zephyr:team_blue@*" - } -} diff --git a/examples/react-tractor-sample/apps/team-red/project.json b/examples/react-tractor-sample/apps/team-red/project.json deleted file mode 100644 index ba4923ff..00000000 --- a/examples/react-tractor-sample/apps/team-red/project.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "team_red", - "$schema": "../../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/team-red/src", - "projectType": "application", - "tags": [], - "targets": { - "build": { - "executor": "@nx/webpack:webpack", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "production", - "options": { - "compiler": "swc", - "outputPath": "dist/apps/team-red", - "index": "apps/team-red/src/index.html", - "baseHref": "/", - "main": "apps/team-red/src/main.tsx", - "tsConfig": "apps/team-red/tsconfig.app.json", - "assets": [ - { - "glob": "**/*", - "input": "apps/team-red/src/assets", - "output": "." - } - ], - "styles": [ - "apps/team-red/src/styles.css" - ], - "scripts": [], - "webpackConfig": "apps/team-red/webpack.config.ts" - }, - "configurations": { - "development": { - "extractLicenses": false, - "optimization": false, - "sourceMap": true, - "vendorChunk": true - }, - "production": { - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "extractLicenses": false, - "vendorChunk": false - } - } - }, - "serve": { - "executor": "@nx/webpack:dev-server", - "defaultConfiguration": "development", - "options": { - "port": 4500, - "buildTarget": "team_red:build", - "hmr": false - }, - "configurations": { - "development": { - "buildTarget": "team_red:build:development" - }, - "production": { - "buildTarget": "team_red:build:production", - "hmr": false - } - } - }, - "lint": { - "executor": "@nx/eslint:lint", - "options": { - "lintFilePatterns": ["{projectRoot}/**/*.{ts,tsx,js,jsx}"] - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "apps/team-red/jest.config.ts", - "passWithNoTests": true - }, - "configurations": { - "ci": { - "ci": true, - "codeCoverage": true - } - } - } - } -} diff --git a/examples/react-tractor-sample/apps/team-red/src/app/app.tsx b/examples/react-tractor-sample/apps/team-red/src/app/app.tsx deleted file mode 100644 index 86343cf2..00000000 --- a/examples/react-tractor-sample/apps/team-red/src/app/app.tsx +++ /dev/null @@ -1,22 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars - -import * as ReactDOM from 'react-dom/client'; -import { StrictMode } from 'react'; -import TeamRedLayout from './team-red-layout'; - -export function App() { - return ( -
- -
- ); -} - -const root = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement -); -root.render( - - - -); diff --git a/examples/react-tractor-sample/apps/team-red/src/app/team-red-layout.tsx b/examples/react-tractor-sample/apps/team-red/src/app/team-red-layout.tsx deleted file mode 100644 index f81a8830..00000000 --- a/examples/react-tractor-sample/apps/team-red/src/app/team-red-layout.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import { useEffect, useState, lazy, Suspense } from 'react'; - -const GreenRecos = lazy(() => import('team_green/GreenRecos')); -const BlueBasket = lazy(() => import('team_blue/BlueBasket')); -const BlueBuy = lazy(() => import('team_blue/BlueBuy')); - -interface VariantOption { - sku: string; - color: string; - name: string; - image: string; - thumb: string; - price: string; -} - -const product: { name: string; variants: VariantOption[] } = { - name: 'Tractor', - variants: [ - { - sku: 't_porsche', - color: 'red', - name: 'Porsche-Diesel Master 419', - image: './team-red/images/tractor-red.jpg', - thumb: './team-red/images/tractor-red-thumb.jpg', - price: '66,00 €', - }, - { - sku: 't_fendt', - color: 'green', - name: 'Fendt F20 Dieselroß', - image: './team-red/images/tractor-green.jpg', - thumb: './team-red/images/tractor-green-thumb.jpg', - price: '54,00 €', - }, - { - sku: 't_eicher', - color: 'blue', - name: 'Eicher Diesel 215/16', - image: './team-red/images/tractor-blue.jpg', - thumb: './team-red/images/tractor-blue-thumb.jpg', - price: '58,00 €', - }, - ], -}; - -const state: { variant: string } = { - variant: 't_porsche', -}; - -function RenderVariantOption(variant: VariantOption) { - const active = state.variant === variant.sku ? 'active' : ''; - const handleVariantClick = () => { - state.variant = variant.sku; - console.log('Red variant changed to', variant.sku); - window.dispatchEvent( - new CustomEvent('red:variant:changed', { - bubbles: true, - }) - ); - }; - return ( - - ); -} - -export function TeamRedLayout({ id }: { id: string }) { - const [variant, setVariant] = useState( - product.variants.find((v) => state.variant === v.sku) - ); - useEffect(() => { - const refresh = () => { - setVariant(product.variants.find((v) => state.variant === v.sku)); - }; - window.addEventListener('red:variant:changed', refresh); - - return () => { - window.removeEventListener('red:variant:changed', refresh); - }; - }, []); - - return ( -
-

The Model Store

- Loading...
}> - - - {variant ? ( - <> -
-
- {variant.name} -
-
-

- {product.name} {variant.name} -

-
{product.variants.map(RenderVariantOption)}
- Loading...}> - - - Loading...}> - - - - ) : null} - - ); -} - -export default TeamRedLayout; diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/.gitkeep b/examples/react-tractor-sample/apps/team-red/src/assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_1.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_1.jpg deleted file mode 100644 index 9722a95a..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_1.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_2.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_2.jpg deleted file mode 100644 index 530e00b6..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_2.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_3.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_3.jpg deleted file mode 100644 index 04c287ad..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_3.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_4.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_4.jpg deleted file mode 100644 index f8951d42..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_4.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_5.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_5.jpg deleted file mode 100644 index 13840c0f..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_5.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_6.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_6.jpg deleted file mode 100644 index 2674bc40..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_6.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_7.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_7.jpg deleted file mode 100644 index b553271d..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_7.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_8.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_8.jpg deleted file mode 100644 index e28ffb7b..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_8.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_9.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_9.jpg deleted file mode 100644 index a3f05294..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-green/images/reco_9.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-blue-thumb.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-blue-thumb.jpg deleted file mode 100644 index d488548f..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-blue-thumb.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-blue.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-blue.jpg deleted file mode 100644 index 1164c93d..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-blue.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-green-thumb.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-green-thumb.jpg deleted file mode 100644 index f28df471..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-green-thumb.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-green.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-green.jpg deleted file mode 100644 index fc30650f..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-green.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-red-thumb.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-red-thumb.jpg deleted file mode 100644 index 7cc0fef4..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-red-thumb.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-red.jpg b/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-red.jpg deleted file mode 100644 index 6e4e6bfa..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/assets/team-red/images/tractor-red.jpg and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/favicon.ico b/examples/react-tractor-sample/apps/team-red/src/favicon.ico deleted file mode 100644 index 317ebcb2..00000000 Binary files a/examples/react-tractor-sample/apps/team-red/src/favicon.ico and /dev/null differ diff --git a/examples/react-tractor-sample/apps/team-red/src/index.html b/examples/react-tractor-sample/apps/team-red/src/index.html deleted file mode 100644 index 3ef40976..00000000 --- a/examples/react-tractor-sample/apps/team-red/src/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - TeamRed - - - - - - -
- - diff --git a/examples/react-tractor-sample/apps/team-red/src/main.tsx b/examples/react-tractor-sample/apps/team-red/src/main.tsx deleted file mode 100644 index 2cc957ee..00000000 --- a/examples/react-tractor-sample/apps/team-red/src/main.tsx +++ /dev/null @@ -1 +0,0 @@ -import('./app/app'); diff --git a/examples/react-tractor-sample/apps/team-red/src/styles.css b/examples/react-tractor-sample/apps/team-red/src/styles.css deleted file mode 100644 index fbcc8695..00000000 --- a/examples/react-tractor-sample/apps/team-red/src/styles.css +++ /dev/null @@ -1,221 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ -* { - box-sizing: border-box; - font-family: 'Helvetica Neue', Arial, sans-serif; -} - -aside { - border-top: 1px solid gray; - padding-top: 20px; -} - -dl { - display: grid; - grid-gap: 2px 15px; - grid-template-columns: 2fr 1fr; - max-width: 300px; -} - -dt { - text-align: right; -} - -dd { - margin: 0; -} - -#app { - display: grid; - grid-gap: 10px 20px; - margin: 20px auto; - min-width: 500px; - outline: 3px dashed orangered; - padding: 15px; -} - -@media only screen and (max-width: 999px) { - #app { - grid-template-areas: - 'store basket' - 'image name' - 'image options' - 'image buy' - 'reco reco'; - grid-template-columns: 4fr 3fr; - } -} - -@media only screen and (min-width: 1000px) { - #app { - grid-template-areas: - 'store basket reco' - 'image name reco' - 'image options reco' - 'image buy reco'; - grid-template-columns: 4fr 3fr 200px; - width: 1000px; - } -} - -#store { - font-weight: 400; - grid-area: store; - margin-top: 5px; -} - -#basket { - align-self: baseline; - grid-area: basket; - justify-self: end; - margin-top: 11px; -} - -#basket .empty, -#basket .filled { - border-radius: 5px; - color: white; - padding: 5px 10px; -} - -#basket .empty { - background-color: gray; -} - -#basket .filled { - background-color: seagreen; -} - -#image { - grid-area: image; - width: 100%; -} - -#image > div { - padding-top: 100%; - position: relative; -} - -#image img { - bottom: 0; - left: 0; - max-width: 100%; - position: absolute; - right: 0; - top: 0; -} - -#name { - font-weight: 400; - grid-area: name; - height: 3em; -} - -#name small { - font-size: 1em; - font-weight: 200; -} - -#options { - align-self: center; - display: flex; - grid-area: options; -} - -#options button { - border: none; - border-bottom: 2px solid white; - cursor: pointer; - display: block; - margin: 2px; - outline: none; - padding: 0; -} - -#options button.active, -#options button:hover { - border-bottom-color: seagreen; -} - -#options img { - display: block; - max-width: 100%; -} - -#buy { - align-self: center; - grid-area: buy; -} - -#buy button { - background: none; - border: 1px solid gray; - border-radius: 20px; - cursor: pointer; - display: block; - font-size: 20px; - outline: none; - padding: 20px; - width: 100%; -} - -#buy button:hover { - border-color: black; -} - -#buy button:active { - border-color: seagreen; -} - -#reco { - grid-area: reco; -} - -@media only screen and (max-width: 999px) { - #reco { - align-items: center; - display: flex; - flex-wrap: wrap; - justify-content: space-around; - margin-top: 20px; - padding-top: 20px; - } -} - -@media only screen and (min-width: 1000px) { - #reco { - justify-content: stretch; - text-align: center; - width: 100%; - } -} - -#reco h3 { - font-weight: 400; -} - -#reco img { - display: inline-block; - height: 180px; - width: 180px; -} - -green-recos, -#reco { - display: block; - outline: 3px dashed forestgreen; - width: 100%; -} - -blue-basket, -#basket { - display: block; - outline: 3px dashed royalblue; - padding: 5px; -} - -blue-buy, -#buy { - display: block; - outline: 3px dashed royalblue; - padding: 5px; -} diff --git a/examples/react-tractor-sample/apps/team-red/tsconfig.app.json b/examples/react-tractor-sample/apps/team-red/tsconfig.app.json deleted file mode 100644 index c57aebbc..00000000 --- a/examples/react-tractor-sample/apps/team-red/tsconfig.app.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "ES2020", - "target": "ES2020", - "outDir": "../../dist/out-tsc", - "types": [ - "node", - - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "jest.config.ts", - "src/**/*.spec.ts", - "src/**/*.test.ts", - "src/**/*.spec.tsx", - "src/**/*.test.tsx", - "src/**/*.spec.js", - "src/**/*.test.js", - "src/**/*.spec.jsx", - "src/**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/examples/react-tractor-sample/apps/team-red/tsconfig.json b/examples/react-tractor-sample/apps/team-red/tsconfig.json deleted file mode 100644 index 3b3be518..00000000 --- a/examples/react-tractor-sample/apps/team-red/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": false, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true, - "baseUrl": ".", - "paths": { - "*": ["./@mf-types/*"] - } - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - } - ], - "extends": "../../tsconfig.json" -} diff --git a/examples/react-tractor-sample/apps/team-red/tsconfig.spec.json b/examples/react-tractor-sample/apps/team-red/tsconfig.spec.json deleted file mode 100644 index 610cd1b0..00000000 --- a/examples/react-tractor-sample/apps/team-red/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": ["jest", "node"] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ], - "types": ["@nx/react/typings/cssmodule.d.ts", "@nx/react/typings/image.d.ts"] -} diff --git a/examples/react-tractor-sample/apps/team-red/webpack.config.ts b/examples/react-tractor-sample/apps/team-red/webpack.config.ts deleted file mode 100644 index 6aba01a3..00000000 --- a/examples/react-tractor-sample/apps/team-red/webpack.config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { withReact } from '@nx/react'; -import { withModuleFederation } from '@nx/module-federation/webpack'; -import { ModuleFederationConfig } from '@nx/module-federation' -import { composePlugins, withNx } from '@nx/webpack'; -import { withZephyr } from 'zephyr-webpack-plugin'; - -const mfConfig: ModuleFederationConfig = { - name: 'team_red', - exposes: { - './TeamRedLayout': './src/app/team-red-layout', - }, - additionalShared: [ - ['react', { singleton: true }] , - ['react-dom', { singleton: true }] , - ], - remotes: ['team_green', 'team_blue'], -}; - -// Nx plugins for webpack. -export default composePlugins( - withNx(), - withReact(), - withModuleFederation(mfConfig), - withZephyr(), - (config) => { - return config; - } -); diff --git a/examples/react-tractor-sample/package.json b/examples/react-tractor-sample/package.json deleted file mode 100644 index 8a40f1cc..00000000 --- a/examples/react-tractor-sample/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "tractor-sample-root", - "version": "0.0.0", - "license": "MIT", - "scripts": { - "build": "nx reset && nx run-many -t build --parallel=1 --skip-nx-cache -p team_blue team_green team_red --verbose", - "build:team-red": "nx run team_red:build:production --skip-nx-cache", - "build:team-blue": "nx run team_blue:build:production --skip-nx-cache", - "build:team-green": "nx run team_green:build:production --skip-nx-cache --watch" - }, - "private": true, - "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1", - "tslib": "catalog:typescript", - "zephyr-webpack-plugin": "catalog:zephyr" - }, - "devDependencies": { - "@babel/core": "catalog:babel", - "@babel/preset-react": "catalog:babel", - "@nx/react": "catalog:nx", - "@nx/module-federation": "catalog:nx", - "@nx/webpack": "catalog:nx", - "@pmmmwh/react-refresh-webpack-plugin": "catalog:react18", - "@rspack/core": "catalog:rspack", - "@svgr/webpack": "catalog:webpack5", - "@swc-node/register": "catalog:swc", - "@swc/cli": "catalog:swc", - "@swc/core": "catalog:swc", - "@testing-library/react": "catalog:react18", - "@types/jest": "catalog:jest", - "@types/node": "catalog:typescript", - "@types/react": "^18.3.20", - "@types/react-dom": "^18.3.5", - "@typescript-eslint/eslint-plugin": "catalog:eslint", - "@typescript-eslint/parser": "catalog:eslint", - "babel-jest": "catalog:jest", - "eslint": "catalog:eslint", - "eslint-config-prettier": "catalog:eslint", - "eslint-plugin-import": "catalog:eslint", - "eslint-plugin-jsx-a11y": "catalog:eslint", - "eslint-plugin-react": "catalog:eslint", - "eslint-plugin-react-hooks": "catalog:eslint", - "jest-environment-jsdom": "catalog:jest", - "nx": "catalog:nx", - "react-refresh": "catalog:react18", - "swc-loader": "catalog:swc", - "ts-jest": "catalog:jest", - "ts-node": "catalog:typescript", - "typescript": "catalog:typescript", - "url-loader": "catalog:webpack5" - } -} diff --git a/examples/react-tractor-sample/tsconfig.json b/examples/react-tractor-sample/tsconfig.json deleted file mode 100644 index 6f286b14..00000000 --- a/examples/react-tractor-sample/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "rootDir": ".", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "module": "ES2020", - "target": "ES2020", - "lib": ["es2020", "dom"], - "skipLibCheck": true, - "skipDefaultLibCheck": true, - "baseUrl": "." - }, - "exclude": ["node_modules", "tmp"] -} diff --git a/examples/react-vite-mf/host/package.json b/examples/react-vite-mf/host/package.json deleted file mode 100644 index 196826dd..00000000 --- a/examples/react-vite-mf/host/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "vite-host", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "cross-env DEBUG=zephyr:log,zephyr:error vite", - "build": "tsc -b && vite build", - "lint": "eslint .", - "preview": "vite preview" - }, - "dependencies": { - "@module-federation/runtime": "catalog:module-federation", - "react": "catalog:react18", - "react-dom": "catalog:react18", - "vite-plugin-zephyr": "catalog:zephyr" - }, - "devDependencies": { - "@eslint/js": "catalog:eslint", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "@vitejs/plugin-react": "catalog:vite5", - "cross-env": "catalog:common", - "eslint": "catalog:eslint", - "eslint-plugin-react-hooks": "catalog:eslint", - "eslint-plugin-react-refresh": "catalog:eslint", - "globals": "catalog:vite5", - "typescript": "catalog:typescript", - "typescript-eslint": "catalog:eslint", - "vite": "catalog:vite5" - }, - "zephyr:dependencies": { - "vite_remote": "zephyr:vite_remote@*", - "vite_rspack": "zephyr:vite_rspack@*", - "vite_webpack": "zephyr:vite_webpack@*" - } -} diff --git a/examples/react-vite-mf/remote/package.json b/examples/react-vite-mf/remote/package.json deleted file mode 100644 index 23bb6ba2..00000000 --- a/examples/react-vite-mf/remote/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "vite_remote", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc -b && vite build", - "lint": "eslint .", - "preview": "vite preview" - }, - "dependencies": { - "@module-federation/runtime": "catalog:module-federation", - "react": "catalog:react18", - "react-dom": "catalog:react18", - "vite-plugin-zephyr": "catalog:zephyr" - }, - "devDependencies": { - "@eslint/js": "catalog:eslint", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "@vitejs/plugin-react": "catalog:vite5", - "eslint": "catalog:eslint", - "eslint-plugin-react-hooks": "catalog:eslint", - "eslint-plugin-react-refresh": "catalog:eslint", - "globals": "catalog:vite5", - "typescript": "catalog:typescript", - "typescript-eslint": "catalog:eslint", - "vite": "catalog:vite5" - } -} diff --git a/examples/react-vite-mf/rspack/.babelrc b/examples/react-vite-mf/rspack/.babelrc deleted file mode 100644 index 88e14d6a..00000000 --- a/examples/react-vite-mf/rspack/.babelrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "presets": ["@babel/preset-typescript", "@babel/preset-react", "@babel/preset-env"], - "plugins": [ - ["@babel/transform-runtime"] - ] -} diff --git a/examples/react-vite-mf/rspack/package.json b/examples/react-vite-mf/rspack/package.json deleted file mode 100644 index 168009e2..00000000 --- a/examples/react-vite-mf/rspack/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "vite_rspack", - "version": "1.0.0", - "scripts": { - "build": "cross-env NODE_ENV=production rspack build", - "build:dev": "cross-env NODE_ENV=development rspack build", - "build:start": "cd dist && rspack serve", - "start": "cross-env NODE_ENV=development rspack serve" - }, - "license": "MIT", - "author": { - "name": "Jack Herrington", - "email": "jherr@pobox.com" - }, - "devDependencies": { - "@rspack/cli": "catalog:rspack", - "@rspack/core": "catalog:rspack", - "@rspack/plugin-react-refresh": "catalog:rspack", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "autoprefixer": "catalog:postcss", - "cross-env": "catalog:common", - "postcss": "catalog:postcss", - "postcss-loader": "catalog:postcss", - "react-refresh": "catalog:react18", - "tailwindcss": "catalog:tailwind3" - }, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18", - "zephyr-rspack-plugin": "catalog:zephyr" - } -} diff --git a/examples/react-vite-mf/webpack/.gitignore b/examples/react-vite-mf/webpack/.gitignore deleted file mode 100644 index 1f22b9c2..00000000 --- a/examples/react-vite-mf/webpack/.gitignore +++ /dev/null @@ -1,116 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* diff --git a/examples/react-vite-mf/webpack/package.json b/examples/react-vite-mf/webpack/package.json deleted file mode 100644 index eaaf2c3e..00000000 --- a/examples/react-vite-mf/webpack/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "vite_webpack", - "version": "1.0.0", - "scripts": { - "build": "webpack --mode production", - "build:dev": "webpack --mode development", - "build:start": "cd dist && PORT=8080 npx serve", - "start": "webpack serve --mode development", - "start:live": "webpack serve --mode development --live-reload --hot" - }, - "license": "MIT", - "author": { - "name": "Jack Herrington", - "email": "jherr@pobox.com" - }, - "devDependencies": { - "@babel/core": "catalog:babel", - "@babel/plugin-transform-runtime": "catalog:babel", - "@babel/preset-env": "catalog:babel", - "@babel/preset-react": "catalog:babel", - "@babel/preset-typescript": "catalog:babel", - "@babel/runtime": "catalog:babel", - "@module-federation/enhanced": "catalog:module-federation", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "autoprefixer": "catalog:postcss", - "babel-loader": "catalog:babel", - "css-loader": "catalog:common", - "dotenv-webpack": "catalog:webpack5", - "html-webpack-plugin": "catalog:webpack5", - "postcss": "catalog:postcss", - "postcss-loader": "catalog:postcss", - "style-loader": "catalog:common", - "tailwindcss": "catalog:tailwind3", - "typescript": "catalog:typescript", - "webpack": "catalog:webpack5", - "webpack-cli": "catalog:webpack5", - "webpack-dev-server": "catalog:webpack5" - }, - "dependencies": { - "@babel/plugin-syntax-dynamic-import": "catalog:babel", - "react": "catalog:react18", - "react-dom": "catalog:react18", - "zephyr-webpack-plugin": "catalog:zephyr" - } -} diff --git a/examples/react-vite-mf/webpack/tsconfig.json b/examples/react-vite-mf/webpack/tsconfig.json deleted file mode 100644 index 4bf995cd..00000000 --- a/examples/react-vite-mf/webpack/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "target": "ES6", // Specify ECMAScript target version - "outDir": "dist", - "lib": ["dom", "dom.iterable", "esnext"], // List of library files to be included in the compilation - "allowJs": true, // Allow JavaScript files to be compiled - "skipLibCheck": true, // Skip type checking of all declaration files - "esModuleInterop": true, // Disables namespace imports (import * as fs from "fs") and enables CJS/AMD/UMD style imports (import fs from "fs") - "allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export - "strict": true, // Enable all strict type checking options - "forceConsistentCasingInFileNames": true, // Disallow inconsistently-cased references to the same file. - "module": "esnext", // Specify module code generation - "moduleResolution": "node", // Resolve modules using Node.js style - "isolatedModules": true, // Unconditionally emit imports for unresolved files - "resolveJsonModule": true, // Include modules imported with .json extension - "noEmit": true, // Do not emit output (meaning do not compile code, only perform type checking) - "jsx": "react", // Support JSX in .tsx files - "sourceMap": true, // Generate corrresponding .map file - "declaration": true, // Generate corresponding .d.ts file - "noUnusedLocals": true, // Report errors on unused locals - "noUnusedParameters": true, // Report errors on unused parameters - "incremental": true, // Enable incremental compilation by reading/writing information from prior compilations to a file on disk - "noFallthroughCasesInSwitch": true // Report errors for fallthrough cases in switch statement - }, - "include": [ - "src/**/*" // *** The files TypeScript should type check *** - ], - "exclude": ["node_modules", "build", "dist"] -} diff --git a/examples/react-vite-nx/.gitignore b/examples/react-vite-nx/.gitignore deleted file mode 100644 index 56c6400f..00000000 --- a/examples/react-vite-nx/.gitignore +++ /dev/null @@ -1,44 +0,0 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -dist -tmp -/out-tsc - -# dependencies -node_modules - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# misc -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -yarn-error.log -testem.log -/typings - -# System Files -.DS_Store -Thumbs.db - -.nx/cache -.nx/workspace-data - -vite.config.*.timestamp* \ No newline at end of file diff --git a/examples/react-vite-nx/.prettierignore b/examples/react-vite-nx/.prettierignore deleted file mode 100644 index e26f0b3f..00000000 --- a/examples/react-vite-nx/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -# Add files here to ignore them from prettier formatting -/dist -/coverage -/.nx/cache -/.nx/workspace-data \ No newline at end of file diff --git a/examples/react-vite-nx/.prettierrc b/examples/react-vite-nx/.prettierrc deleted file mode 100644 index 544138be..00000000 --- a/examples/react-vite-nx/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "singleQuote": true -} diff --git a/examples/react-vite-nx/eslint.config.js b/examples/react-vite-nx/eslint.config.js deleted file mode 100644 index 44d828eb..00000000 --- a/examples/react-vite-nx/eslint.config.js +++ /dev/null @@ -1,21 +0,0 @@ -const nx = require('@nx/eslint-plugin'); - -module.exports = [ - ...nx.configs['flat/base'], - ...nx.configs['flat/typescript'], - ...nx.configs['flat/javascript'], - { - ignores: ['**/dist'], - }, - { - files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], - // Override or add rules here - rules: {}, - }, - ...nx.configs['flat/react'], - { - files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], - // Override or add rules here - rules: {}, - }, -]; diff --git a/examples/react-vite-nx/index.html b/examples/react-vite-nx/index.html deleted file mode 100644 index 8637df75..00000000 --- a/examples/react-vite-nx/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - ReactViteNx - - - - - - - -
- - - diff --git a/examples/react-vite-nx/package.json b/examples/react-vite-nx/package.json deleted file mode 100644 index 0337b70f..00000000 --- a/examples/react-vite-nx/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@react-vite-nx/source", - "version": "0.0.0", - "license": "MIT", - "scripts": { - "start": "nx serve", - "build": "nx build", - "test": "nx test" - }, - "private": true, - "dependencies": { - "react": "catalog:react18", - "react-dom": "catalog:react18", - "vite-plugin-zephyr": "catalog:zephyr" - }, - "devDependencies": { - "@eslint/js": "catalog:eslint", - "@nx/eslint": "catalog:nx", - "@nx/eslint-plugin": "catalog:nx", - "@nx/js": "catalog:nx", - "@nx/react": "catalog:nx", - "@nx/vite": "catalog:nx", - "@nx/web": "catalog:nx", - "@nx/workspace": "catalog:nx", - "@swc-node/register": "catalog:swc", - "@swc/cli": "catalog:swc", - "@swc/core": "catalog:swc", - "@swc/helpers": "catalog:swc", - "@testing-library/react": "catalog:react18", - "@types/node": "catalog:typescript", - "@types/react": "catalog:react18", - "@types/react-dom": "catalog:react18", - "@vitejs/plugin-react": "catalog:vite5", - "@vitest/coverage-v8": "catalog:vitest1", - "@vitest/ui": "catalog:vitest1", - "eslint": "catalog:eslint", - "eslint-config-prettier": "catalog:eslint", - "eslint-plugin-import": "catalog:eslint", - "eslint-plugin-jsx-a11y": "catalog:eslint", - "eslint-plugin-react": "catalog:eslint", - "eslint-plugin-react-hooks": "catalog:eslint", - "jsdom": "~22.1.0", - "nx": "catalog:nx", - "prettier": "catalog:prettier2", - "tslib": "catalog:typescript", - "typescript": "catalog:typescript", - "typescript-eslint": "catalog:eslint", - "vite": "^5.4.15", - "vitest": "catalog:vitest1" - }, - "nx": { - "includedScripts": [] - } -} diff --git a/examples/react-vite-nx/project.json b/examples/react-vite-nx/project.json deleted file mode 100644 index 76dff809..00000000 --- a/examples/react-vite-nx/project.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "react-vite-nx", - "$schema": "node_modules/nx/schemas/project-schema.json", - "includedScripts": [], - "sourceRoot": "./src", - "projectType": "application", - "tags": [], - "// targets": "to see all targets run: nx show project react-vite-nx --web", - "targets": { - "build": { - "options": { - "cwd": "./", - "command": "vite build" - }, - "cache": false, - "dependsOn": ["^build"], - "inputs": [ - "production", - "^production", - { - "externalDependencies": [] - } - ], - "outputs": ["{workspaceRoot}/dist/"], - "executor": "nx:run-commands" - } - } -} diff --git a/examples/react-vite-nx/public/favicon.ico b/examples/react-vite-nx/public/favicon.ico deleted file mode 100644 index 317ebcb2..00000000 Binary files a/examples/react-vite-nx/public/favicon.ico and /dev/null differ diff --git a/examples/react-vite-nx/src/app/app.module.css b/examples/react-vite-nx/src/app/app.module.css deleted file mode 100644 index 7b88fbab..00000000 --- a/examples/react-vite-nx/src/app/app.module.css +++ /dev/null @@ -1 +0,0 @@ -/* Your styles goes here. */ diff --git a/examples/react-vite-nx/src/app/app.spec.tsx b/examples/react-vite-nx/src/app/app.spec.tsx deleted file mode 100644 index bdcf7b7d..00000000 --- a/examples/react-vite-nx/src/app/app.spec.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from '@testing-library/react'; - -import App from './app'; - -describe('App', () => { - it('should render successfully', () => { - const { baseElement } = render(); - expect(baseElement).toBeTruthy(); - }); - - it('should have a greeting as the title', () => { - const { getByText } = render(); - expect(getByText(/Welcome react-vite-nx/gi)).toBeTruthy(); - }); -}); diff --git a/examples/react-vite-nx/src/app/app.tsx b/examples/react-vite-nx/src/app/app.tsx deleted file mode 100644 index b01dbdc7..00000000 --- a/examples/react-vite-nx/src/app/app.tsx +++ /dev/null @@ -1,13 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import styles from './app.module.css'; -import NxWelcome from './nx-welcome'; - -export function App() { - return ( -
- -
- ); -} - -export default App; diff --git a/examples/react-vite-nx/src/app/nx-welcome.tsx b/examples/react-vite-nx/src/app/nx-welcome.tsx deleted file mode 100644 index 2c287676..00000000 --- a/examples/react-vite-nx/src/app/nx-welcome.tsx +++ /dev/null @@ -1,856 +0,0 @@ -/* - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - This is a starter component and can be deleted. - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - Delete this file and get started with your project! - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - */ -export function NxWelcome({ title }: { title: string }) { - return ( - <> - + diff --git a/vanilla/examples/astro/public/fonts/atkinson-bold.woff b/vanilla/examples/astro/public/fonts/atkinson-bold.woff new file mode 100644 index 00000000..e7f8977e Binary files /dev/null and b/vanilla/examples/astro/public/fonts/atkinson-bold.woff differ diff --git a/vanilla/examples/astro/public/fonts/atkinson-regular.woff b/vanilla/examples/astro/public/fonts/atkinson-regular.woff new file mode 100644 index 00000000..bbe09c58 Binary files /dev/null and b/vanilla/examples/astro/public/fonts/atkinson-regular.woff differ diff --git a/vanilla/examples/astro/src/assets/blog-placeholder-1.jpg b/vanilla/examples/astro/src/assets/blog-placeholder-1.jpg new file mode 100644 index 00000000..74d4009b Binary files /dev/null and b/vanilla/examples/astro/src/assets/blog-placeholder-1.jpg differ diff --git a/vanilla/examples/astro/src/assets/blog-placeholder-2.jpg b/vanilla/examples/astro/src/assets/blog-placeholder-2.jpg new file mode 100644 index 00000000..c4214b0e Binary files /dev/null and b/vanilla/examples/astro/src/assets/blog-placeholder-2.jpg differ diff --git a/vanilla/examples/astro/src/assets/blog-placeholder-3.jpg b/vanilla/examples/astro/src/assets/blog-placeholder-3.jpg new file mode 100644 index 00000000..fbe2ac0c Binary files /dev/null and b/vanilla/examples/astro/src/assets/blog-placeholder-3.jpg differ diff --git a/vanilla/examples/astro/src/assets/blog-placeholder-4.jpg b/vanilla/examples/astro/src/assets/blog-placeholder-4.jpg new file mode 100644 index 00000000..f4fc88e2 Binary files /dev/null and b/vanilla/examples/astro/src/assets/blog-placeholder-4.jpg differ diff --git a/vanilla/examples/astro/src/assets/blog-placeholder-5.jpg b/vanilla/examples/astro/src/assets/blog-placeholder-5.jpg new file mode 100644 index 00000000..c5646746 Binary files /dev/null and b/vanilla/examples/astro/src/assets/blog-placeholder-5.jpg differ diff --git a/vanilla/examples/astro/src/assets/blog-placeholder-about.jpg b/vanilla/examples/astro/src/assets/blog-placeholder-about.jpg new file mode 100644 index 00000000..cf5f6853 Binary files /dev/null and b/vanilla/examples/astro/src/assets/blog-placeholder-about.jpg differ diff --git a/vanilla/examples/astro/src/components/BaseHead.astro b/vanilla/examples/astro/src/components/BaseHead.astro new file mode 100644 index 00000000..a0f9a7cf --- /dev/null +++ b/vanilla/examples/astro/src/components/BaseHead.astro @@ -0,0 +1,57 @@ +--- +// Import the global.css file here so that it is included on +// all pages through the use of the component. +import '../styles/global.css'; +import type { ImageMetadata } from 'astro'; +import FallbackImage from '../assets/blog-placeholder-1.jpg'; +import { SITE_TITLE } from '../consts'; + +interface Props { + title: string; + description: string; + image?: ImageMetadata; +} + +const canonicalURL = new URL(Astro.url.pathname, Astro.site); + +const { title, description, image = FallbackImage } = Astro.props; +--- + + + + + + + + + + + + + + + + + +{title} + + + + + + + + + + + + + + + + diff --git a/vanilla/examples/astro/src/components/Footer.astro b/vanilla/examples/astro/src/components/Footer.astro new file mode 100644 index 00000000..96c2fce9 --- /dev/null +++ b/vanilla/examples/astro/src/components/Footer.astro @@ -0,0 +1,62 @@ +--- +const today = new Date(); +--- + + + diff --git a/vanilla/examples/astro/src/components/FormattedDate.astro b/vanilla/examples/astro/src/components/FormattedDate.astro new file mode 100644 index 00000000..1bcce73a --- /dev/null +++ b/vanilla/examples/astro/src/components/FormattedDate.astro @@ -0,0 +1,17 @@ +--- +interface Props { + date: Date; +} + +const { date } = Astro.props; +--- + + diff --git a/vanilla/examples/astro/src/components/Header.astro b/vanilla/examples/astro/src/components/Header.astro new file mode 100644 index 00000000..fe2906c2 --- /dev/null +++ b/vanilla/examples/astro/src/components/Header.astro @@ -0,0 +1,85 @@ +--- +import { SITE_TITLE } from '../consts'; +import HeaderLink from './HeaderLink.astro'; +--- + +
+ +
+ diff --git a/vanilla/examples/astro/src/components/HeaderLink.astro b/vanilla/examples/astro/src/components/HeaderLink.astro new file mode 100644 index 00000000..41da8462 --- /dev/null +++ b/vanilla/examples/astro/src/components/HeaderLink.astro @@ -0,0 +1,24 @@ +--- +import type { HTMLAttributes } from 'astro/types'; + +type Props = HTMLAttributes<'a'>; + +const { href, class: className, ...props } = Astro.props; +const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ''); +const subpath = pathname.match(/[^\/]+/g); +const isActive = href === pathname || href === '/' + (subpath?.[0] || ''); +--- + + + + + diff --git a/vanilla/examples/astro/src/consts.ts b/vanilla/examples/astro/src/consts.ts new file mode 100644 index 00000000..0df8a61f --- /dev/null +++ b/vanilla/examples/astro/src/consts.ts @@ -0,0 +1,5 @@ +// Place any global data in this file. +// You can import this data from anywhere in your site by using the `import` keyword. + +export const SITE_TITLE = 'Astro Blog'; +export const SITE_DESCRIPTION = 'Welcome to my website!'; diff --git a/vanilla/examples/astro/src/content.config.ts b/vanilla/examples/astro/src/content.config.ts new file mode 100644 index 00000000..ce37c7f6 --- /dev/null +++ b/vanilla/examples/astro/src/content.config.ts @@ -0,0 +1,19 @@ +import { defineCollection, z } from 'astro:content'; +import { glob } from 'astro/loaders'; + +const blog = defineCollection({ + // Load Markdown and MDX files in the `src/content/blog/` directory. + loader: glob({ base: './src/content/blog', pattern: '**/*.{md,mdx}' }), + // Type-check frontmatter using a schema + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string(), + // Transform string to Date object + pubDate: z.coerce.date(), + updatedDate: z.coerce.date().optional(), + heroImage: image().optional(), + }), +}); + +export const collections = { blog }; diff --git a/vanilla/examples/astro/src/content/blog/first-post.md b/vanilla/examples/astro/src/content/blog/first-post.md new file mode 100644 index 00000000..cb457dcb --- /dev/null +++ b/vanilla/examples/astro/src/content/blog/first-post.md @@ -0,0 +1,16 @@ +--- +title: 'First post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 08 2022' +heroImage: '../../assets/blog-placeholder-3.jpg' +--- + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. + +Morbi tristique senectus et netus. Id semper risus in hendrerit gravida rutrum quisque non tellus. Habitasse platea dictumst quisque sagittis purus sit amet. Tellus molestie nunc non blandit massa. Cursus vitae congue mauris rhoncus. Accumsan tortor posuere ac ut. Fringilla urna porttitor rhoncus dolor. Elit ullamcorper dignissim cras tincidunt lobortis. In cursus turpis massa tincidunt dui ut ornare lectus. Integer feugiat scelerisque varius morbi enim nunc. Bibendum neque egestas congue quisque egestas diam. Cras ornare arcu dui vivamus arcu felis bibendum. Dignissim suspendisse in est ante in nibh mauris. Sed tempus urna et pharetra pharetra massa massa ultricies mi. + +Mollis nunc sed id semper risus in. Convallis a cras semper auctor neque. Diam sit amet nisl suscipit. Lacus viverra vitae congue eu consequat ac felis donec. Egestas integer eget aliquet nibh praesent tristique magna sit amet. Eget magna fermentum iaculis eu non diam. In vitae turpis massa sed elementum. Tristique et egestas quis ipsum suspendisse ultrices. Eget lorem dolor sed viverra ipsum. Vel turpis nunc eget lorem dolor sed viverra. Posuere ac ut consequat semper viverra nam. Laoreet suspendisse interdum consectetur libero id faucibus. Diam phasellus vestibulum lorem sed risus ultricies tristique. Rhoncus dolor purus non enim praesent elementum facilisis. Ultrices tincidunt arcu non sodales neque. Tempus egestas sed sed risus pretium quam vulputate. Viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare. Fringilla urna porttitor rhoncus dolor purus non. Amet dictum sit amet justo donec enim. + +Mattis ullamcorper velit sed ullamcorper morbi tincidunt. Tortor posuere ac ut consequat semper viverra. Tellus mauris a diam maecenas sed enim ut sem viverra. Venenatis urna cursus eget nunc scelerisque viverra mauris in. Arcu ac tortor dignissim convallis aenean et tortor at. Curabitur gravida arcu ac tortor dignissim convallis aenean et tortor. Egestas tellus rutrum tellus pellentesque eu. Fusce ut placerat orci nulla pellentesque dignissim enim sit amet. Ut enim blandit volutpat maecenas volutpat blandit aliquam etiam. Id donec ultrices tincidunt arcu. Id cursus metus aliquam eleifend mi. + +Tempus quam pellentesque nec nam aliquam sem. Risus at ultrices mi tempus imperdiet. Id porta nibh venenatis cras sed felis eget velit. Ipsum a arcu cursus vitae. Facilisis magna etiam tempor orci eu lobortis elementum. Tincidunt dui ut ornare lectus sit. Quisque non tellus orci ac. Blandit libero volutpat sed cras. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida. Egestas integer eget aliquet nibh praesent tristique magna. diff --git a/vanilla/examples/astro/src/content/blog/markdown-style-guide.md b/vanilla/examples/astro/src/content/blog/markdown-style-guide.md new file mode 100644 index 00000000..b7a4c9ea --- /dev/null +++ b/vanilla/examples/astro/src/content/blog/markdown-style-guide.md @@ -0,0 +1,214 @@ +--- +title: 'Markdown Style Guide' +description: 'Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.' +pubDate: 'Jun 19 2024' +heroImage: '../../assets/blog-placeholder-1.jpg' +--- + +Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro. + +## Headings + +The following HTML `

`—`

` elements represent six levels of section headings. `

` is the highest section level while `

` is the lowest. + +# H1 + +## H2 + +### H3 + +#### H4 + +##### H5 + +###### H6 + +## Paragraph + +Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat. + +Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat. + +## Images + +### Syntax + +```markdown +![Alt text](./full/or/relative/path/of/image) +``` + +### Output + +![blog placeholder](../../assets/blog-placeholder-about.jpg) + +## Blockquotes + +The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations. + +### Blockquote without attribution + +#### Syntax + +```markdown +> Tiam, ad mint andaepu dandae nostion secatur sequo quae. +> **Note** that you can use _Markdown syntax_ within a blockquote. +``` + +#### Output + +> Tiam, ad mint andaepu dandae nostion secatur sequo quae. +> **Note** that you can use _Markdown syntax_ within a blockquote. + +### Blockquote with attribution + +#### Syntax + +```markdown +> Don't communicate by sharing memory, share memory by communicating.
+> — Rob Pike[^1] +``` + +#### Output + +> Don't communicate by sharing memory, share memory by communicating.
+> — Rob Pike[^1] + +[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015. + +## Tables + +### Syntax + +```markdown +| Italics | Bold | Code | +| --------- | -------- | ------ | +| _italics_ | **bold** | `code` | +``` + +### Output + +| Italics | Bold | Code | +| --------- | -------- | ------ | +| _italics_ | **bold** | `code` | + +## Code Blocks + +### Syntax + +we can use 3 backticks ``` in new line and write snippet and close with 3 backticks on new line and to highlight language specific syntax, write one word of language name after first 3 backticks, for eg. html, javascript, css, markdown, typescript, txt, bash + +````markdown +```html + + + + + Example HTML5 Document + + +

Test

+ + +``` +```` + +### Output + +```html + + + + + Example HTML5 Document + + +

Test

+ + +``` + +## List Types + +### Ordered List + +#### Syntax + +```markdown +1. First item +2. Second item +3. Third item +``` + +#### Output + +1. First item +2. Second item +3. Third item + +### Unordered List + +#### Syntax + +```markdown +- List item +- Another item +- And another item +``` + +#### Output + +- List item +- Another item +- And another item + +### Nested list + +#### Syntax + +```markdown +- Fruit + - Apple + - Orange + - Banana +- Dairy + - Milk + - Cheese +``` + +#### Output + +- Fruit + - Apple + - Orange + - Banana +- Dairy + - Milk + - Cheese + +## Other Elements — abbr, sub, sup, kbd, mark + +### Syntax + +```markdown +GIF is a bitmap image format. + +H2O + +Xn + Yn = Zn + +Press CTRL + ALT + Delete to end the session. + +Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures. +``` + +### Output + +GIF is a bitmap image format. + +H2O + +Xn + Yn = Zn + +Press CTRL + ALT + Delete to end the session. + +Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures. diff --git a/vanilla/examples/astro/src/content/blog/second-post.md b/vanilla/examples/astro/src/content/blog/second-post.md new file mode 100644 index 00000000..79337d41 --- /dev/null +++ b/vanilla/examples/astro/src/content/blog/second-post.md @@ -0,0 +1,16 @@ +--- +title: 'Second post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 15 2022' +heroImage: '../../assets/blog-placeholder-4.jpg' +--- + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. + +Morbi tristique senectus et netus. Id semper risus in hendrerit gravida rutrum quisque non tellus. Habitasse platea dictumst quisque sagittis purus sit amet. Tellus molestie nunc non blandit massa. Cursus vitae congue mauris rhoncus. Accumsan tortor posuere ac ut. Fringilla urna porttitor rhoncus dolor. Elit ullamcorper dignissim cras tincidunt lobortis. In cursus turpis massa tincidunt dui ut ornare lectus. Integer feugiat scelerisque varius morbi enim nunc. Bibendum neque egestas congue quisque egestas diam. Cras ornare arcu dui vivamus arcu felis bibendum. Dignissim suspendisse in est ante in nibh mauris. Sed tempus urna et pharetra pharetra massa massa ultricies mi. + +Mollis nunc sed id semper risus in. Convallis a cras semper auctor neque. Diam sit amet nisl suscipit. Lacus viverra vitae congue eu consequat ac felis donec. Egestas integer eget aliquet nibh praesent tristique magna sit amet. Eget magna fermentum iaculis eu non diam. In vitae turpis massa sed elementum. Tristique et egestas quis ipsum suspendisse ultrices. Eget lorem dolor sed viverra ipsum. Vel turpis nunc eget lorem dolor sed viverra. Posuere ac ut consequat semper viverra nam. Laoreet suspendisse interdum consectetur libero id faucibus. Diam phasellus vestibulum lorem sed risus ultricies tristique. Rhoncus dolor purus non enim praesent elementum facilisis. Ultrices tincidunt arcu non sodales neque. Tempus egestas sed sed risus pretium quam vulputate. Viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare. Fringilla urna porttitor rhoncus dolor purus non. Amet dictum sit amet justo donec enim. + +Mattis ullamcorper velit sed ullamcorper morbi tincidunt. Tortor posuere ac ut consequat semper viverra. Tellus mauris a diam maecenas sed enim ut sem viverra. Venenatis urna cursus eget nunc scelerisque viverra mauris in. Arcu ac tortor dignissim convallis aenean et tortor at. Curabitur gravida arcu ac tortor dignissim convallis aenean et tortor. Egestas tellus rutrum tellus pellentesque eu. Fusce ut placerat orci nulla pellentesque dignissim enim sit amet. Ut enim blandit volutpat maecenas volutpat blandit aliquam etiam. Id donec ultrices tincidunt arcu. Id cursus metus aliquam eleifend mi. + +Tempus quam pellentesque nec nam aliquam sem. Risus at ultrices mi tempus imperdiet. Id porta nibh venenatis cras sed felis eget velit. Ipsum a arcu cursus vitae. Facilisis magna etiam tempor orci eu lobortis elementum. Tincidunt dui ut ornare lectus sit. Quisque non tellus orci ac. Blandit libero volutpat sed cras. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida. Egestas integer eget aliquet nibh praesent tristique magna. diff --git a/vanilla/examples/astro/src/content/blog/third-post.md b/vanilla/examples/astro/src/content/blog/third-post.md new file mode 100644 index 00000000..b871fa15 --- /dev/null +++ b/vanilla/examples/astro/src/content/blog/third-post.md @@ -0,0 +1,16 @@ +--- +title: 'Third post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 22 2022' +heroImage: '../../assets/blog-placeholder-2.jpg' +--- + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. + +Morbi tristique senectus et netus. Id semper risus in hendrerit gravida rutrum quisque non tellus. Habitasse platea dictumst quisque sagittis purus sit amet. Tellus molestie nunc non blandit massa. Cursus vitae congue mauris rhoncus. Accumsan tortor posuere ac ut. Fringilla urna porttitor rhoncus dolor. Elit ullamcorper dignissim cras tincidunt lobortis. In cursus turpis massa tincidunt dui ut ornare lectus. Integer feugiat scelerisque varius morbi enim nunc. Bibendum neque egestas congue quisque egestas diam. Cras ornare arcu dui vivamus arcu felis bibendum. Dignissim suspendisse in est ante in nibh mauris. Sed tempus urna et pharetra pharetra massa massa ultricies mi. + +Mollis nunc sed id semper risus in. Convallis a cras semper auctor neque. Diam sit amet nisl suscipit. Lacus viverra vitae congue eu consequat ac felis donec. Egestas integer eget aliquet nibh praesent tristique magna sit amet. Eget magna fermentum iaculis eu non diam. In vitae turpis massa sed elementum. Tristique et egestas quis ipsum suspendisse ultrices. Eget lorem dolor sed viverra ipsum. Vel turpis nunc eget lorem dolor sed viverra. Posuere ac ut consequat semper viverra nam. Laoreet suspendisse interdum consectetur libero id faucibus. Diam phasellus vestibulum lorem sed risus ultricies tristique. Rhoncus dolor purus non enim praesent elementum facilisis. Ultrices tincidunt arcu non sodales neque. Tempus egestas sed sed risus pretium quam vulputate. Viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare. Fringilla urna porttitor rhoncus dolor purus non. Amet dictum sit amet justo donec enim. + +Mattis ullamcorper velit sed ullamcorper morbi tincidunt. Tortor posuere ac ut consequat semper viverra. Tellus mauris a diam maecenas sed enim ut sem viverra. Venenatis urna cursus eget nunc scelerisque viverra mauris in. Arcu ac tortor dignissim convallis aenean et tortor at. Curabitur gravida arcu ac tortor dignissim convallis aenean et tortor. Egestas tellus rutrum tellus pellentesque eu. Fusce ut placerat orci nulla pellentesque dignissim enim sit amet. Ut enim blandit volutpat maecenas volutpat blandit aliquam etiam. Id donec ultrices tincidunt arcu. Id cursus metus aliquam eleifend mi. + +Tempus quam pellentesque nec nam aliquam sem. Risus at ultrices mi tempus imperdiet. Id porta nibh venenatis cras sed felis eget velit. Ipsum a arcu cursus vitae. Facilisis magna etiam tempor orci eu lobortis elementum. Tincidunt dui ut ornare lectus sit. Quisque non tellus orci ac. Blandit libero volutpat sed cras. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida. Egestas integer eget aliquet nibh praesent tristique magna. diff --git a/vanilla/examples/astro/src/content/blog/using-mdx.mdx b/vanilla/examples/astro/src/content/blog/using-mdx.mdx new file mode 100644 index 00000000..bd8856e2 --- /dev/null +++ b/vanilla/examples/astro/src/content/blog/using-mdx.mdx @@ -0,0 +1,31 @@ +--- +title: 'Using MDX' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jun 01 2024' +heroImage: '../../assets/blog-placeholder-5.jpg' +--- + +This theme comes with the [@astrojs/mdx](https://docs.astro.build/en/guides/integrations-guide/mdx/) integration installed and configured in your `astro.config.mjs` config file. If you prefer not to use MDX, you can disable support by removing the integration from your config file. + +## Why MDX? + +MDX is a special flavor of Markdown that supports embedded JavaScript & JSX syntax. This unlocks the ability to [mix JavaScript and UI Components into your Markdown content](https://docs.astro.build/en/guides/markdown-content/#mdx-features) for things like interactive charts or alerts. + +If you have existing content authored in MDX, this integration will hopefully make migrating to Astro a breeze. + +## Example + +Here is how you import and use a UI component inside of MDX. +When you open this page in the browser, you should see the clickable button below. + +import HeaderLink from '../../components/HeaderLink.astro'; + + + Embedded component in MDX + + +## More Links + +- [MDX Syntax Documentation](https://mdxjs.com/docs/what-is-mdx) +- [Astro Usage Documentation](https://docs.astro.build/en/guides/markdown-content/#markdown-and-mdx-pages) +- **Note:** [Client Directives](https://docs.astro.build/en/reference/directives-reference/#client-directives) are still required to create interactive components. Otherwise, all components in your MDX will render as static HTML (no JavaScript) by default. diff --git a/vanilla/examples/astro/src/layouts/BlogPost.astro b/vanilla/examples/astro/src/layouts/BlogPost.astro new file mode 100644 index 00000000..2c79f3bb --- /dev/null +++ b/vanilla/examples/astro/src/layouts/BlogPost.astro @@ -0,0 +1,86 @@ +--- +import { Image } from 'astro:assets'; +import type { CollectionEntry } from 'astro:content'; +import BaseHead from '../components/BaseHead.astro'; +import Footer from '../components/Footer.astro'; +import FormattedDate from '../components/FormattedDate.astro'; +import Header from '../components/Header.astro'; + +type Props = CollectionEntry<'blog'>['data']; + +const { title, description, pubDate, updatedDate, heroImage } = Astro.props; +--- + + + + + + + + +
+
+
+
+ {heroImage && } +
+
+
+
+ + { + updatedDate && ( +
+ Last updated on +
+ ) + } +
+

{title}

+
+
+ +
+
+
+