Deploy a package from a workspace. During deployment, the files of the deployed package are copied to the target directory. All dependencies of the deployed package, including dependencies from the workspace, are installed inside an isolated
node_modules directory at the target directory. The target directory will contain a portable package that can be copied to a server and executed without additional steps.
pnpm --filter=<deployed project name> deploy <target directory>
In case you build your project before deployment, also use the
--prod option to skip
pnpm --filter=<deployed project name> --prod deploy <target directory>
Usage in a docker image. After building everything in your monorepo, do this in a second image that uses your monorepo base image as a build context or in an additional build stage:
FROM workspace as pruned
RUN pnpm --filter <your package name> --prod deploy pruned
COPY --from=pruned /app/pruned .
ENTRYPOINT ["node", "index.js"]
NODE_ENV değeri ne olursa olsun, sadece
devDependencies kısmındaki kütüphaneleri yükler.
optionalDependencies kısmındaki kütüphaneleri göz ardı ederek yükleme yapar.
devDependencies won't be installed.
Files included in the deployed project
By default, all the files of the project are copied during deployment. The project's
package.json may contain a "files" field to list the files and directories that should be copied.