community.general.pnpm 模块 – 使用 pnpm 管理 node.js 包
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.general.pnpm
。
community.general 7.4.0 中的新功能
概要
使用 pnpm 包管理器 管理 node.js 包。
要求
以下要求需要在执行此模块的主机上满足。
Pnpm 可执行文件存在于
PATH
中。
参数
参数 |
注释 |
---|---|
node.js 库的别名。 |
|
在开发模式下安装依赖项。 Pnpm 将忽略 选择
|
|
pnpm 的可执行文件位置。 默认搜索位置是 |
|
全局安装 node.js 库。 选择
|
|
安装时使用 选择
|
|
要安装的 node.js 库的名称。 如果未提供,则安装 package.json 中的所有包。 |
|
不安装可选包,等同于 选择
|
|
在可选模式下安装依赖项。 选择
|
|
安装 node.js 库的基本路径。 |
|
在生产模式下安装依赖项。 Pnpm 将忽略 package.json 中 选择
|
|
已命名 node.js 库的安装状态。 如果选择 选择
|
|
要安装的库的版本,采用 semver 格式。 |
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 完整 |
可以在 |
|
支持: 无 |
当处于 diff 模式时,将返回有关已更改内容(或在 |
示例
- name: Install "tailwindcss" node.js package.
community.general.pnpm:
name: tailwindcss
path: /app/location
- name: Install "tailwindcss" node.js package on version 3.3.2
community.general.pnpm:
name: tailwindcss
version: 3.3.2
path: /app/location
- name: Install "tailwindcss" node.js package globally.
community.general.pnpm:
name: tailwindcss
global: true
- name: Install "tailwindcss" node.js package as dev dependency.
community.general.pnpm:
name: tailwindcss
path: /app/location
dev: true
- name: Install "tailwindcss" node.js package as optional dependency.
community.general.pnpm:
name: tailwindcss
path: /app/location
optional: true
- name: Install "tailwindcss" node.js package version 0.1.3 as tailwind-1
community.general.pnpm:
name: tailwindcss
alias: tailwind-1
version: 0.1.3
path: /app/location
- name: Remove the globally-installed package "tailwindcss".
community.general.pnpm:
name: tailwindcss
global: true
state: absent
- name: Install packages based on package.json.
community.general.pnpm:
path: /app/location
- name: Update all packages in package.json to their latest version.
community.general.pnpm:
path: /app/location
state: latest