Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

fix(vercel): rush monorepo support #479

Closed
wants to merge 2 commits into from

Conversation

jamsch
Copy link

@jamsch jamsch commented Dec 11, 2024

Changes

This change uncomments a line used to detect the monorepo root for Rush projects. This change is necessary to include the node modules + correct symlinks as part of the Vercel build.

In a Rush monorepo with the following structure:

.
├── README.md
├── apps
│   ├── admin
│   ├── web
│   └── www
├── common
│   ├── changes
│   ├── config
│   ├── git-hooks
│   ├── pnpm-patches
│   ├── scripts
│   └── temp
├── package.json
├── packages
│   ├── api
│   ├── eslint-config
│   ├── shared
│   ├── test
│   ├── tsconfig
│   ├── types
│   └── ui
├── rush.json
└── tsconfig.base.json

Running the build process in our apps/www folder results in the following structure:

 ._render.func
├── dist
│   └── server
│       ├── _noop-middleware.mjs
│       ├── chunks
│       ├── entry.mjs
│       ├── manifest_Bl2bl94u.mjs
│       ├── pages
│       └── renderers.mjs
├── node_modules
│   ├── @radix-ui
│   │   ├── react-avatar -> ../../../../common/temp/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@radix-ui/react-avatar
│   │   └── react-select -> ../../../../common/temp/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@radix-ui/react-select
│   ├── clsx -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/clsx
│   ├── dayjs -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/dayjs
│   ├── react -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/react
│   ├── react-dom -> ../../../common/temp/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom
│   ├── sharp -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/sharp
│   └── tailwind-merge -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/tailwind-merge
├── package.json
└── src
    └── pages
        ├── [...path].astro
        ├── aboutus.astro
        ├── help.astro
        ├── index.astro
        ├── pricing.astro
        └── reviews.astro

Which resolves in incorrect symlinks, as well as no node_modules sources copied in to the .vercel folder.

If deployed to Vercel, it results in the following error:

Screenshot 2024-12-11 at 4 27 16 PM

After the fix, the project structure uses the monorepo root:

.
└── _render.func
    ├── apps
    │   └── www
    │       ├── dist
    │       │   └── server
    │       │       ├── _noop-middleware.mjs
    │       │       ├── chunks
    │       ├── node_modules
    │       │   ├── @radix-ui
    │       │   │   ├── react-avatar -> ../../../../common/temp/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@radix-ui/react-avatar
    │       │   │   └── react-select -> ../../../../common/temp/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@radix-ui/react-select
    │       │   ├── clsx -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/clsx
    │       │   ├── dayjs -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/dayjs
    │       │   ├── react -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/react
    │       │   ├── react-dom -> ../../../common/temp/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom
    │       │   ├── sharp -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/sharp
    │       │   └── tailwind-merge -> ../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/tailwind-merge
    │       └── src
    │           └── pages
    │               ├── [...path].astro
    │               ├── aboutus.astro
    │               ├── help.astro
    │               ├── index.astro
    │               ├── pricing.astro
    │               └── reviews.astro
    ├── common
    │   └── temp
    │       └── node_modules
    │          └── .pnpm (all of our dependencies here)
    └── package.json

Testing

Testing was done manually on a Vercel account. I highly doubt before this users were able to run Astro on their monorepos.

Docs

Nothing of note

Copy link

changeset-bot bot commented Dec 11, 2024

🦋 Changeset detected

Latest commit: af81c7e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@astrojs/vercel Patch
@test/astro-vercel-basic Patch
@test/astro-vercel-image Patch
@test/vercel-isr Patch
@test/vercel-max-duration Patch
@test/vercel-edge-middleware-with-edge-file Patch
@test/vercel-edge-middleware-without-edge-file Patch
@test/astro-vercel-no-output Patch
@test/astro-vercel-prerendered-error-pages Patch
@test/astro-vercel-redirects-serverless Patch
@test/astro-vercel-redirects Patch
@test/vercel-server-islands Patch
@test/astro-vercel-serverless-prerender Patch
@test/astro-vercel-serverless-with-dynamic-routes Patch
@test/astro-vercel-static-assets Patch
@test/astro-vercel-static Patch
@test/vercel-streaming Patch
@test/astro-vercel-with-web-analytics-enabled-output-as-static Patch
vercel-hosted-astro-project Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: vercel Related to Vercel adapter (scope) label Dec 11, 2024
@ematipico
Copy link
Member

Hi, we moved the vercel adapter in a new repository: https://github.com/withastro/astro/tree/main/packages/integrations/vercel

We will achieve this repository soon, so if you wish to land this PR, you'll have to create a new one.

@ematipico ematipico closed this Feb 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg: vercel Related to Vercel adapter (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants