pnpm deploy
Розгортає пакунок з робочої області. Під час розгортання файли пакунка копіюються в цільову теку. All dependencies of the deployed package, including dependencies from the workspace, are installed inside an isolated node_modules directory at the target directory. Цільова тека міститиме переносимий пакунок, який можна скопіювати на сервер і виконати без додаткових кроків.
Використання:
pnpm --filter=<deployed project name> deploy <target directory>
In case you build your project before deployment, also use the --prod option to skip devDependencies installation.
pnpm --filter=<deployed project name> --prod deploy <target directory>
Використання в образі docker. Після створення всього у вашому монорепо, зробіть це у другому образі, який використовує ваш базовий образ монорепо як контекст збірки, або на додатковій стадії збирання:
# 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 regardless of the NODE_ENV.
--no-optional
optionalDependencies are not installed.
--prod, -P
Packages in devDependencies won't be installed.
--filter <package_selector>
Файли, включені в розгорнутий проєкт
By default, all the files of the project are copied during deployment but this can be modified in one of the following ways which are resolved in order:
- The project's
package.jsonmay contain a "files" field to list the files and directories that should be copied. - If there is an
.npmignorefile in the application directory then any files listed here are ignored. - If there is a
.gitignorefile in the application directory then any files listed here are ignored.