-
Notifications
You must be signed in to change notification settings - Fork 58
test: improve node monorepo test coverage #361
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
Draft
iloveitaly
wants to merge
11
commits into
railwayapp:main
Choose a base branch
from
iloveitaly:claude/add-node-monorepo-example-01H2QtRHL9hvyGbYxNVrgc37
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
test: improve node monorepo test coverage #361
iloveitaly
wants to merge
11
commits into
railwayapp:main
from
iloveitaly:claude/add-node-monorepo-example-01H2QtRHL9hvyGbYxNVrgc37
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Addresses user questions about monorepo support by documenting that Railpack automatically handles npm/pnpm/yarn workspaces and Turborepo configurations with links to example projects.
Enhanced integration tests for monorepo examples to properly test that workspace package linking and dependencies work correctly: **node-npm-workspaces:** - Root now imports and uses functions from pkg-a and pkg-b workspace packages - pkg-a uses its dependency (abbrev) to demonstrate transitive deps work - pkg-b exports a simple function - Updated to ES modules for consistency - Test now verifies all workspace packages load and execute correctly **node-pnpm-workspaces:** - Root now imports and uses functions from pkg-a and pkg-b workspace packages - pkg-a uses its dependency (abbrev) to demonstrate transitive deps work - pkg-b exports a simple function - Updated to ES modules for consistency - Test now verifies all workspace packages load and execute correctly **node-turborepo:** - Changed from justBuild to httpCheck since this is a Next.js web server - Added start script to root package.json to run the web app - Test now verifies the built app starts and responds to HTTP requests - This properly tests that the @repo/ui workspace package is built and linked These changes ensure that monorepo builds are actually testing workspace functionality, not just that the root package builds in isolation. Fixes railwayapp#332
Added two new monorepo examples to complete coverage: **node-yarn-workspaces:** - Demonstrates yarn workspaces with workspace package imports - Uses the packageManager field for corepack - Similar structure to npm/pnpm workspace examples for consistency - Tests that workspace packages load and transitive dependencies work **node-monorepo-fullstack:** - Real-world example with Express API + frontend + shared package - Shows how to share code (@monorepo/shared) between API and web packages - API uses Express and shared utilities/constants - Frontend demonstrates importing shared code - Uses HTTP checks to verify API endpoints work correctly - Demonstrates common full-stack monorepo pattern Updated documentation to link to the yarn workspaces example and added a note about the full-stack example for users looking for a more realistic monorepo setup. Addresses railwayapp#332
Fixed uglified JSON that was created with echo instead of proper editing.
- Added yarn.lock file required by yarn 4 - Added workspace package dependencies (pkg-a, pkg-b) to root package.json - Yarn requires lockfile to exist and won't create one in CI mode
- Added workspace:* aliases to pkg-a and pkg-b entries - Removed unused transitive dependencies that aren't in package.json - Yarn requires both the workspace:* and workspace:packages/* forms
Never manually update lockfiles - always use the package manager to generate them properly with correct checksums.
102f88a to
4f18e9a
Compare
ES module imports require workspace packages to be listed as dependencies in the root package.json for Node.js to resolve them correctly.
Used yarn install via corepack to generate proper yarn.lock with real checksums instead of manually creating fake ones. Also includes Yarn PnP files (.pnp.cjs, .pnp.loader.mjs, .yarn/) generated by yarn 4.
Regenerated pnpm-lock.yaml and yarn install-state.gz using the actual package managers (pnpm and yarn via corepack) instead of manual edits. - pnpm-lock.yaml: Updated for new workspace dependencies - .yarn/install-state.gz: Regenerated by yarn install
Yarn PnP files (.pnp.cjs, .pnp.loader.mjs, .yarn/install-state.gz) should not be committed as they contain environment-specific paths. They will be generated during yarn install at build time. Added .gitignore matching the pattern used in node-yarn-3 example.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.