zeabur / zbpack

Build your project into static assets, serverless function or container image with magic, no Dockerfile needed!
Mozilla Public License 2.0
277 stars 44 forks source link

[feature] Better pnpm workspace support #182

Closed yjl9903 closed 5 months ago

yjl9903 commented 11 months ago

Is your feature request related to a problem? Please describe.

In my full-stack pnpm monorepo project, I use the following structure to manage my project.

root
├── packages/
│  ├─ shared1/
│  ├─ shared2/
│  └─ ... # packages shared in this repo
└── apps/
   ├─ frontend/ # A frontend project, may use the shared lib
   └─ backend/  # A backend project, may use the shared lib

Now, zeabur can not properly handle the pnpm monorepo correctly.

For installation, the generated dockerfile only copy and install the deps in the root package.json.

For building, I use some monorepo manager to build all the shared library and frontend app (or backend app).

Describe the solution you'd like

Detect the pnpm workspaces, see details in the pnpm docs.

And then generate dockerfile like:

# ...
Copy package.json pnpm-lock.yaml .
Copy packages/shared1/packages.json ./packages/shared1/
Copy packages/shared2/packages.json ./packages/shared2/
RUN pnpm install
# ...

In my previous experience, docker does not support something like glob pattern?

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

MichaelYuhe commented 11 months ago

Thank you for your suggestion! We highly value your feedback and think this is a great idea. In fact, this proposal is already on our roadmap. We are working to implement it and hope to make it available to all users in the near future. cc @pan93412