pnpm deploy
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.
Since pnpm v10, deploy
requires the injected-workspace-dependencies
setting to be set to true
.
사용법:
pnpm --filter=<deployed project name> deploy <target directory>
배포 전에 프로젝트를 빌드하는 경우 --prod
옵션을 사용하여 devDependencies
설치를 건너뜁니다.
pnpm --filter=<deployed project name> --prod deploy <target directory>
도커 이미지에서의 사용. 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:
# syntax=docker/dockerfile:1.4
FROM workspace as pruned
RUN pnpm --filter <your package name> --prod deploy pruned
FROM node:18-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY --from=pruned /app/pruned .
ENTRYPOINT ["node", "index.js"]
옵션
--dev, -D
Only devDependencies
are installed.
--no-optional
optionalDependencies
가 설치되지 않습니다.
--prod, -P
Packages in devDependencies
won't be installed.
--filter <package_selector>
--legacy
Force legacy deploy implementation.
Since pnpm v10, by default, pnpm deploy
will try creating a dedicated lockfile from a shared lockfile for deployment. The --legacy
flag disables this behavior.