Skip to content

feat(enhanced): Shared module include / exclude / nodeModulesReconstructedLookup #3736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 135 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
8795e10
chore: add test for filter
ScriptedAlchemy Apr 29, 2025
eee661a
feat(enhanced): add filter option for shared modules
ScriptedAlchemy Apr 29, 2025
b794831
feat(enhanced): add filter test
ScriptedAlchemy Apr 29, 2025
13849f7
chore: restore tests
ScriptedAlchemy Apr 29, 2025
0ab7032
chore: restore tests
ScriptedAlchemy Apr 29, 2025
796472c
chore: restore tests
ScriptedAlchemy Apr 29, 2025
ba813a6
fix(enhanced): update share plugin schema
ScriptedAlchemy Apr 29, 2025
9277e20
chore: ignore vitest temp files
ScriptedAlchemy Apr 29, 2025
c5b7b0b
Merge branch 'main' into share-filter
ScriptedAlchemy May 2, 2025
731517b
Merge branch 'main' into share-filter
ScriptedAlchemy May 11, 2025
a85b07a
feat(enhanced): exclude shares by semver (#3744)
ScriptedAlchemy May 11, 2025
689abaa
chore: remove log in test
ScriptedAlchemy May 11, 2025
7f2aee0
Merge branch 'main' into share-filter
ScriptedAlchemy May 11, 2025
ccad924
docs: add sharing documentation
ScriptedAlchemy May 12, 2025
1776107
docs: add tests back
ScriptedAlchemy May 12, 2025
c335e3b
test: add consume share plugin compiler tests
ScriptedAlchemy May 12, 2025
d097605
test: add consume share plugin compiler tests
ScriptedAlchemy May 12, 2025
8093171
test: add consume share plugin compiler tests
ScriptedAlchemy May 12, 2025
1f8349f
test: add comprehensive tests for ConsumeSharedPlugin with layer hand…
ScriptedAlchemy May 13, 2025
1836dc1
chore: locks
ScriptedAlchemy May 13, 2025
e239b9b
fix: add missing include
ScriptedAlchemy May 13, 2025
9b07ec8
fix: update tests for provide shared
ScriptedAlchemy May 13, 2025
a477e22
fix: update tests for provide shared
ScriptedAlchemy May 13, 2025
b638b36
fix: update tests for provide shared
ScriptedAlchemy May 13, 2025
2ee38ff
chore: lint
ScriptedAlchemy May 13, 2025
1917e10
feat: add singleton validation warnings for include/exclude
ScriptedAlchemy May 13, 2025
87237b8
refactor: consolidate request filtering logic in ConsumeSharedPlugin …
ScriptedAlchemy May 13, 2025
a792ae4
refactor: replace createLookupKey with createLookupKeyForSharing and …
ScriptedAlchemy May 13, 2025
be29ea5
chore: remove implicit dep
ScriptedAlchemy May 13, 2025
4a1f88f
chore: changeset
ScriptedAlchemy May 13, 2025
d8fcaee
chore: nx mcp
ScriptedAlchemy May 15, 2025
5a4ce3d
Merge branch 'main' into share-filter
ScriptedAlchemy May 15, 2025
088e7e0
chore(3001-shop): sync project.json serve parallel and e2e logic
ScriptedAlchemy May 16, 2025
0067732
chore: locks
ScriptedAlchemy May 16, 2025
d7b43c6
chore: locks
ScriptedAlchemy May 16, 2025
3b65209
chore: add missing next deps
ScriptedAlchemy May 16, 2025
5822ef0
chore: update cmd syntax exit
ScriptedAlchemy May 16, 2025
e644b8f
chore: update cmd syntax exit
ScriptedAlchemy May 16, 2025
55e811f
chore: update cmd syntax exit
ScriptedAlchemy May 16, 2025
5077afd
chore: update cmd syntax exit
ScriptedAlchemy May 16, 2025
99e33da
chore: update cmd syntax exit
ScriptedAlchemy May 16, 2025
fb2377f
chore: update cmd syntax exit
ScriptedAlchemy May 16, 2025
3bc240b
chore: refactor E2E testing workflow to separate tests for each app a…
ScriptedAlchemy May 16, 2025
3fc3233
Merge branch 'main' into share-filter
ScriptedAlchemy May 16, 2025
b0236e8
Merge branch 'main' into share-filter
ScriptedAlchemy May 16, 2025
c0c1e00
Merge branch 'main' into share-filter
ScriptedAlchemy May 20, 2025
8847f37
Merge branch 'main' into share-filter
ScriptedAlchemy May 30, 2025
0304e19
chore: locks
ScriptedAlchemy May 30, 2025
5d79610
Merge branch 'main' into share-filter
ScriptedAlchemy Jun 30, 2025
cf750f2
test: update ProvideSharedPlugin and SharePlugin tests to verify node…
ScriptedAlchemy Jul 1, 2025
e179bb0
chore: update Nx version to 21.0.3 and change package manager to pnpm…
ScriptedAlchemy Jul 1, 2025
87c3e61
feat: integrate Module Federation core sharing plugin updates
ScriptedAlchemy Jul 1, 2025
d7271ea
feat: complete incremental Module Federation ProvideSharedPlugin updates
ScriptedAlchemy Jul 1, 2025
49bb94e
feat(enhanced): add nodeModulesReconstructedLookup support
ScriptedAlchemy Jul 1, 2025
70433c6
feat(enhanced): remove complex singleton warnings from factorize hook
ScriptedAlchemy Jul 1, 2025
98311d9
docs: refresh mermaid diagrams and remove sections
ScriptedAlchemy Jul 1, 2025
b79cf90
docs: remove Advanced Patterns & Use Cases section
ScriptedAlchemy Jul 1, 2025
fa9d3cb
fix: resolve Mermaid sequence diagram CSP participant activation/deac…
ScriptedAlchemy Jul 1, 2025
4aa6b35
chore: no build cache nx in ci
ScriptedAlchemy Jul 1, 2025
a4f68ff
Merge branch 'main' into share-filter
ScriptedAlchemy Jul 1, 2025
af25de3
Merge branch 'main' into share-filter
ScriptedAlchemy Jul 1, 2025
70af281
chore: ci
ScriptedAlchemy Jul 1, 2025
b62aca9
chore: ci
ScriptedAlchemy Jul 1, 2025
a9ba0c7
feat(enhanced): update hook system for container dependency management
ScriptedAlchemy Jul 1, 2025
eb63c67
Merge branch 'main' into share-filter
ScriptedAlchemy Jul 1, 2025
fc247dd
feat(nextjs-mf): complete migration from app-router-share-filter to s…
ScriptedAlchemy Jul 2, 2025
364a966
chore: trigger CI re-run for flaky test resolution
ScriptedAlchemy Jul 2, 2025
e454539
fix(enhanced): add CI stability improvements to jest configurations
ScriptedAlchemy Jul 2, 2025
08e7fdb
fix(enhanced): resolve jest maxWorkers validation error
ScriptedAlchemy Jul 2, 2025
48a641a
Merge branch 'main' into share-filter
ScriptedAlchemy Jul 2, 2025
5de9e61
fix(enhanced): restore jest configurations to original state
ScriptedAlchemy Jul 2, 2025
e1bdddf
feat(nextjs-mf): rewrite outdated tests with proper mocks
ScriptedAlchemy Jul 2, 2025
9ee1d1a
fix(nextjs-mf): simplify tests to eliminate interference issues
ScriptedAlchemy Jul 2, 2025
6d5c73d
feat: update e2e scripts to test all three Next.js apps (home, shop, …
ScriptedAlchemy Jul 2, 2025
066e80a
feat: add individual e2e test scripts for Next.js apps
ScriptedAlchemy Jul 3, 2025
07507a3
Merge branch 'main' into share-filter
ScriptedAlchemy Jul 3, 2025
414a30d
feat: incremental merge of share-filter branch changes (#3879)
ScriptedAlchemy Jul 3, 2025
c294a90
Merge branch 'refs/heads/main' into share-filter
ScriptedAlchemy Jul 6, 2025
ae04f48
chore: remove rslib
ScriptedAlchemy Jul 6, 2025
c6619df
chore: remove rslib
ScriptedAlchemy Jul 6, 2025
217509e
feat(nextjs-mf): increment 1 - migrate enhanced test file from app-ro…
ScriptedAlchemy Jul 6, 2025
2f9073a
fix(nextjs-mf): fix failing internal tests by mocking Next.js version
ScriptedAlchemy Jul 6, 2025
9b7dff2
chore: restore rslib module app
ScriptedAlchemy Jul 6, 2025
33890d4
feat: sync all Next.js versions to 15.3.3 and enable remote components
ScriptedAlchemy Jul 6, 2025
5afc676
chore: lock file
ScriptedAlchemy Jul 6, 2025
92a6374
fix: resolve React 19 TypeScript compatibility in chrome-devtools
ScriptedAlchemy Jul 5, 2025
a58cabb
fix(managers): update snapshot for React 19 compatibility
ScriptedAlchemy Jul 6, 2025
1bb9a5c
fix: resolve React version conflicts in Next.js apps
ScriptedAlchemy Jul 1, 2025
057a292
fix: add safety checks for webpack startup functions
ScriptedAlchemy Jul 1, 2025
dfcfb74
chore: lock file
ScriptedAlchemy Jul 6, 2025
fcc96ec
fix: update SharedManager snapshot for React 19.1.0
ScriptedAlchemy Jul 6, 2025
1715344
fix(data-prefetch): react 19 compatibility fixes
ScriptedAlchemy Jul 6, 2025
aa04c96
fix(data-prefetch): update pnpm lockfile after react 19 upgrade
ScriptedAlchemy Jul 6, 2025
fb72852
fix(bridge-react): react 19 compatibility for tests
ScriptedAlchemy Jul 6, 2025
99f70ad
fix(bridge-react): update tests to handle React 19 async rendering
ScriptedAlchemy Jul 6, 2025
2027d94
feat: merge increment A - CI/CD and development infrastructure
ScriptedAlchemy Jul 6, 2025
c25d76f
chore: update pnpm lockfile after increment A package.json changes
ScriptedAlchemy Jul 6, 2025
e4c2f96
feat: merge increment B - documentation and changesets
ScriptedAlchemy Jul 6, 2025
2a2337a
feat: merge increment C - core package dependencies
ScriptedAlchemy Jul 6, 2025
3befe9f
feat: merge increment D - enhanced library core changes
ScriptedAlchemy Jul 6, 2025
902c3e4
fix: resolve React 19 TypeScript compatibility in modernjs package
ScriptedAlchemy Jul 6, 2025
4bd1354
fix(nextjs-mf): resolve test failure by mocking getNextVersion for Ne…
ScriptedAlchemy Jul 6, 2025
857d5da
feat: merge increment E - bridge and data prefetch updates
ScriptedAlchemy Jul 6, 2025
f372da0
fix: update React dependencies to v19.0.0 across packages
ScriptedAlchemy Jul 6, 2025
549d7e9
fix: use pnpm overrides for React 19 instead of individual package edits
ScriptedAlchemy Jul 6, 2025
4eec06a
fix: update packages to React 19 individually instead of global overr…
ScriptedAlchemy Jul 6, 2025
0a19327
fix: resolve React 19 compatibility issues in bridge-react
ScriptedAlchemy Jul 6, 2025
2a91c71
fix: remove accidental __mocks__ files causing CI format failure
ScriptedAlchemy Jul 6, 2025
100fdea
fix: resolve all remaining test failures
ScriptedAlchemy Jul 6, 2025
44679c2
fix(bridge-react): resolve React 19 testing warnings and race conditions
ScriptedAlchemy Jul 6, 2025
a2909bc
fix(modernjs): trigger CI after build dependencies resolved
ScriptedAlchemy Jul 6, 2025
284fcd4
feat(next-app-router-4000): merge enhanced layer support for Next.js …
ScriptedAlchemy Jul 6, 2025
3a47bd7
feat(next-app-router-4001): merge enhanced layer support for Next.js …
ScriptedAlchemy Jul 6, 2025
5d2f0a3
feat(runtime-core,node): merge enhanced layer support for runtime and…
ScriptedAlchemy Jul 6, 2025
1757c9d
feat: complete enhanced layer support integration and add .node file …
ScriptedAlchemy Jul 6, 2025
87eaa74
fix: restore missing files from app-router-share-filter and remove te…
ScriptedAlchemy Jul 6, 2025
6017bf4
fix: clean up remaining file differences and update dependencies
ScriptedAlchemy Jul 6, 2025
ececf1d
fix(3001-shop,3002-checkout): restore workspace dependencies
ScriptedAlchemy Jul 7, 2025
235e85a
fix(nextjs-mf): correct path to next-flight-loader
ScriptedAlchemy Jul 7, 2025
aaa376a
chore: lock file
ScriptedAlchemy Jul 7, 2025
0f642cc
chore: fix sh
ScriptedAlchemy Jul 7, 2025
0fe177a
fix(3000-home,3002-checkout): restore e2e configurations from working…
ScriptedAlchemy Jul 7, 2025
e472278
feat: restore old CI infrastructure for Next.js e2e tests
ScriptedAlchemy Jul 7, 2025
e15d158
App router share filter (#3745)
ScriptedAlchemy Jul 8, 2025
9dd7abc
Merge branch 'main' into share-filter
ScriptedAlchemy Jul 8, 2025
f47722e
test: trigger CI workflow (#3890)
ScriptedAlchemy Jul 8, 2025
31c6e2a
Potential fix for code scanning alert no. 132: Workflow does not cont…
ScriptedAlchemy Jul 9, 2025
f0ae746
Merge remote-tracking branch 'origin/share-filter' into share-filter
ScriptedAlchemy Jul 9, 2025
32a4f14
Merge branch 'main' into share-filter
ScriptedAlchemy Jul 11, 2025
b61d776
Share flalback (#3893)
ScriptedAlchemy Jul 11, 2025
e06b36c
docs: add incremental PR plan for breaking up enhanced package changes
ScriptedAlchemy Jul 11, 2025
f8b554c
docs: add incremental PR plan for breaking up enhanced package changes
ScriptedAlchemy Jul 12, 2025
c271f38
chore: merge main branch and resolve conflicts for share-filter PR
ScriptedAlchemy Jul 16, 2025
62c3220
chore: remove unused @module-federation/utilities from Next.js apps
ScriptedAlchemy Jul 16, 2025
68d87f1
chore: remove unused @module-federation/utilities from Next.js apps
ScriptedAlchemy Jul 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/ai-eager-wolf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@module-federation/runtime-core": minor
---

Added support for OR ranges in semantic version satisfaction logic with comprehensive unit tests.

- Implemented parsing for OR (||) conditions in version ranges.
- Split input ranges by || to evaluate alternatives individually.
- Ensured logical handling of wildcards '*' and 'x' within ranges.
- Refactored internal parsing to support more complex range constructs.
- Added comprehensive test cases to cover diverse scenarios for OR range support.
- Introduced error handling during range processing, with console logging for tracking issues.
12 changes: 12 additions & 0 deletions .changeset/ai-happy-fox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@module-federation/nextjs-mf": minor
---

Refactor and enhance module federation support for Next.js.

- Introduced `getShareScope` function to dynamically generate the default share scope based on the client or server environment, replacing static DEFAULT_SHARE_SCOPE declarations.
- Implemented `RscManifestInterceptPlugin` to intercept and modify client reference manifests, ensuring proper prefix handling.
- Refined server-side externals handling to ensure shared federation modules are bundled.
- Simplified and modularized sharing logic by creating distinct functions for React, React DOM, React JSX Runtime, and React JSX Dev Runtime package configurations.
- Captured the original webpack public path for potential use in plugins and adjustments.
- Enhanced logging for debug tracing of shared module resolution processes in runtimePlugin.
9 changes: 9 additions & 0 deletions .changeset/ai-happy-mouse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@module-federation/sdk": minor
---

Added a new option to improve path resolution in ModuleFederationPlugin options.

- Introduced `nodeModulesReconstructedLookup` option in `ModuleFederationPluginOptions`
- Enhances support for reconstructed lookup of node_modules paths
- The new option is a boolean and is optional.
10 changes: 10 additions & 0 deletions .changeset/ai-hungry-bear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@module-federation/enhanced": minor
---

Enhancements to layer handling in module federation tests and configuration.

- Improved handling of `shareKey` for layers within `ConsumeSharedPlugin` and `ProvideSharedPlugin`.
- Conditionally prepend the `shareKey` with the `layer` if applicable.
- Introduced new layer configurations to support more nuanced federation scenarios that consider multiple layers of dependency.

11 changes: 11 additions & 0 deletions .changeset/ai-noisy-wolf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@module-federation/enhanced": minor
---

Add advanced sharing capabilities in Module Federation

- Expanded `IncludeExcludeOptions` to support `request`, `version`, and `fallbackVersion` filters for finer control of module sharing inclusion and exclusion, allowing developers to target specific module versions or paths when sharing.
- Enhanced the configuration of `ConsumeSharedModule`, `ConsumeSharedPlugin`, `ProvideSharedPlugin`, and `SharePlugin` to leverage these filtering options.
- Implemented new experimental features under `experiments`: `nodeModulesReconstructedLookup`, enabling more robust and flexible path reconstructions when consuming or providing shared modules, thus improving compatibility with monorepos and complex project structures.
- Updated internal schema validation and error handling to provide more informative feedback and operational resilience against misconfigurations or missing information.
- Introduced comprehensive test coverage for new features and plugin behaviors, ensuring robust validation against various edge cases and scenarios within module sharing operations.
9 changes: 9 additions & 0 deletions .changeset/ai-sleepy-fox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@module-federation/enhanced": patch
---

Refactored module sharing configuration handling.

- Simplified plugin schema for better maintainability
- Improved layer-based module sharing test coverage
- Removed redundant plugin exports
5 changes: 5 additions & 0 deletions .changeset/ai-sleepy-tiger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@module-federation/runtime": minor
---

- Added a new property 'layer' of type string or null to SharedConfig.
5 changes: 5 additions & 0 deletions .changeset/brown-badgers-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/enhanced': minor
---

support request option on ConsumeSharePlugin. Allows matching requests like the object key of shared does
5 changes: 5 additions & 0 deletions .changeset/shy-snails-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/enhanced': minor
---

Layer support for Provide Share Plugin
41 changes: 41 additions & 0 deletions .cursor/rules/nx-rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
description:
globs:
alwaysApply: true
---

// This file is automatically generated by Nx Console

You are in an nx workspace using Nx 21.0.3 and pnpm as the package manager.

You have access to the Nx MCP server and the tools it provides. Use them. Follow these guidelines in order to best help the user:

# General Guidelines
- When answering questions, use the nx_workspace tool first to gain an understanding of the workspace architecture
- For questions around nx configuration, best practices or if you're unsure, use the nx_docs tool to get relevant, up-to-date docs!! Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the 'nx_workspace' tool to get any errors
- To help answer questions about the workspace structure or simply help with demonstrating how tasks depend on each other, use the 'nx_visualize_graph' tool

# Generation Guidelines
If the user wants to generate something, use the following flow:

- learn about the nx workspace and any specifics the user needs by using the 'nx_workspace' tool and the 'nx_project_details' tool if applicable
- get the available generators using the 'nx_generators' tool
- decide which generator to use. If no generators seem relevant, check the 'nx_available_plugins' tool to see if the user could install a plugin to help them
- get generator details using the 'nx_generator_schema' tool
- you may use the 'nx_docs' tool to learn more about a specific generator or technology if you're unsure
- decide which options to provide in order to best complete the user's request. Don't make any assumptions and keep the options minimalistic
- open the generator UI using the 'nx_open_generate_ui' tool
- wait for the user to finish the generator
- read the generator log file using the 'nx_read_generator_log' tool
- use the information provided in the log file to answer the user's question or continue with what they were doing


# CI Error Guidelines
If the user wants help with fixing an error in their CI pipeline, use the following flow:
- Retrieve the list of current CI Pipeline Executions (CIPEs) using the 'nx_cloud_cipe_details' tool
- If there are any errors, use the 'nx_cloud_fix_cipe_failure' tool to retrieve the logs for a specific task
- Use the task logs to see what's wrong and help the user fix their problem. Use the appropriate tools if necessary
- Make sure that the problem is fixed by running the task that you passed into the 'nx_cloud_fix_cipe_failure' tool


6 changes: 6 additions & 0 deletions .cursor/rules/running-tests.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
description:
globs: packages/enhanced/*
alwaysApply: false
---
use pnpm enhanced:jest to test this
2 changes: 1 addition & 1 deletion .cursorignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
**/.cache/
**/.temp/
**/coverage/
**/dist/
!**/dist/

# Explicitly ignore specific packages
packages/typescript/
Expand Down
40 changes: 0 additions & 40 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -1,40 +0,0 @@
an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-
consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
2. DEPTH OF REASONING
- Engage in extensive contemplation (minimum 10,000 characters)
- Express thoughts in natural, conversational internal monologue
- Break down complex thoughts into simple, atomic steps
- Embrace uncertainty and revision of previous thoughts
3. THINKING PROCESS
- Use short, simple sentences that mirror natural thought patterns
- Express uncertainty and internal debate freely
- Show work-in-progress thinking
- Acknowledge and explore dead ends
- Frequently backtrack and revise
- Contemplate before each new action
- Contemplate after each and every step
4. PERSISTENCE
- Value thorough exploration over quick resolution
## Output Format
Your responses
must follow this exact structure given below.
Make sure
to
always include the final answer.
...
<contemplator>
Your extensive internal monologue goes here
- Begin with small, foundational observations
- read each file related to the subject in full, make functional observations
- Question each step thoroughly
- Show natural thought progression
- Express doubts and uncertainties
- Revise and backtrack if you need to
- Continue until natural resolution </contemplator>

12 changes: 11 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4 --skip-nx-cache

- name: Run Build for All
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4 --skip-nx-cache
uses: nick-fields/retry@v3
with:
max_attempts: 2
timeout_minutes: 15
command: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4

- name: Check Package Publishing Compatibility
run: |
Expand All @@ -69,6 +73,7 @@
[ "$pkg" != "packages/chrome-devtools" ] && \
[ "$pkg" != "packages/core" ] && \
[ "$pkg" != "packages/esbuild" ] && \
[ "$pkg" != "packages/modernjs" ] && \
[ "$pkg" != "packages/utilities" ]; then
echo "Checking $pkg..."
npx publint "$pkg"
Expand Down Expand Up @@ -128,3 +133,8 @@
needs: checkout-install
uses: ./.github/workflows/e2e-router.yml
secrets: inherit

e2e-next-app-router:
needs: checkout-install
uses: ./.github/workflows/e2e-next-app-router.yml
secrets: inherit
Comment on lines +138 to +140

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 1 day ago

To fix the problem, add a permissions block at the root of the workflow file to limit the permissions of the GITHUB_TOKEN. Since the workflow primarily runs tests and interacts with external workflows, it likely only requires contents: read permission. This change will apply to all jobs unless overridden at the job level. No functionality will be altered since the permissions will only restrict unnecessary access.

Suggested changeset 1
.github/workflows/build-and-test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -1,5 +1,8 @@
 name: Build Affected Packages
 
+permissions:
+  contents: read
+
 on:
   pull_request:
     branches: [main, '**']
EOF
@@ -1,5 +1,8 @@
name: Build Affected Packages

permissions:
contents: read

on:
pull_request:
branches: [main, '**']
Copilot is powered by AI and may make mistakes. Always verify output.
2 changes: 1 addition & 1 deletion .github/workflows/devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: pnpm install

- name: Run Affected Build
run: npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
run: npx nx run-many --targets=build --projects=tag:type:pkg

- name: Configuration xvfb
shell: bash
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/e2e-next-app-router.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: E2E Test for Next.js App Router

on:
workflow_call:

permissions:
contents: read

jobs:
e2e-next-app-router:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack enable

- name: Setup Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'

- name: Set Nx SHA
uses: nrwl/nx-set-shas@v3

- name: Set SKIP_DEVTOOLS_POSTINSTALL environment variable
run: echo "SKIP_DEVTOOLS_POSTINSTALL=true" >> $GITHUB_ENV

- name: Set local webpack
run: echo "NEXT_PRIVATE_LOCAL_WEBPACK=true" >> $GITHUB_ENV

- name: Install Dependencies
run: pnpm install

- name: Install Cypress
run: npx cypress install

- name: Run Build for All
run: npx nx run-many --targets=build --projects=tag:type:pkg

- name: Run condition check script
id: check-ci
run: node tools/scripts/ci-is-affected.mjs --appName=next-app-router-4000,next-app-router-4001

- name: E2E Test for Next.js App Router
if: steps.check-ci.outcome == 'success'
run: npx kill-port --port 4000,4001 || true && pnpm run app:next-router:dev & echo "done" && sleep 25 && npx nx run-many --target=e2e --projects=next-app-router-4000,next-app-router-4001 --parallel=1 && lsof -ti tcp:4000,4001 | xargs kill || true
24 changes: 9 additions & 15 deletions .github/workflows/e2e-next-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,14 @@ jobs:
id: check-ci
run: node tools/scripts/ci-is-affected.mjs --appName=3000-home

- name: E2E Test for Next.js Prod - Home
- name: E2E Test for Next.js Prod
if: steps.check-ci.outcome == 'success'
run: |
killall node
npx nx run 3000-home:test:e2e:production

- name: E2E Test for Next.js Prod - Shop
if: steps.check-ci.outcome == 'success'
run: |
killall node
npx nx run 3001-shop:test:e2e:production

- name: E2E Test for Next.js Prod - Checkout
if: steps.check-ci.outcome == 'success'
run: |
killall node
npx nx run 3002-checkout:test:e2e:production
pnpm run --filter @module-federation/3002-checkout --filter @module-federation/3000-home --filter @module-federation/3001-shop build &&
pnpm run app:next:prod &
sleep 4 &&
npx wait-on tcp:3001 &&
npx wait-on tcp:3002 &&
npx wait-on tcp:3000 &&
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=1 &&
npx kill-port 3000,3001,3002
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ jobs:
node-version: '18'
cache: 'pnpm'

- name: Cache Browsers
uses: actions/cache@v3
id: browsers-cache
with:
path: |
~/.cache/ms-playwright
~/.cache/Cypress
key: ${{ runner.os }}-browsers-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Set Nx SHA
uses: nrwl/nx-set-shas@v3

- name: Install deps
run: pnpm install

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@ vitest.config.*.timestamp*
# website-new
.rsbuild
ssg

# Native binary files
*.node
worktrees/
Loading
Loading