yarn: adjust docs (#9279)

pull/9295/head
Alexei Znamensky 2024-12-19 20:43:44 +13:00 committed by GitHub
parent dcdec6ee4e
commit d629a50b17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 53 additions and 81 deletions

View File

@ -11,12 +11,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: yarn module: yarn
short_description: Manage node.js packages with Yarn short_description: Manage Node.js packages with Yarn
description: description:
- Manage node.js packages with the Yarn package manager (https://yarnpkg.com/) - Manage Node.js packages with the Yarn package manager U(https://yarnpkg.com/).
author: author:
- "David Gunter (@verkaufer)" - "David Gunter (@verkaufer)"
- "Chris Hoffman (@chrishoffman), creator of NPM Ansible module)" - "Chris Hoffman (@chrishoffman), creator of NPM Ansible module)"
@ -31,25 +30,25 @@ options:
name: name:
type: str type: str
description: description:
- The name of a node.js library to install - The name of a Node.js library to install.
- If omitted all packages in package.json are installed. - If omitted all packages in package.json are installed.
- To globally install from local node.js library. Prepend "file:" to the path of the node.js library. - To globally install from local Node.js library. Prepend C(file:) to the path of the Node.js library.
required: false required: false
path: path:
type: path type: path
description: description:
- The base path where Node.js libraries will be installed. - The base path where Node.js libraries will be installed.
- This is where the node_modules folder lives. - This is where the C(node_modules) folder lives.
required: false required: false
version: version:
type: str type: str
description: description:
- The version of the library to be installed. - The version of the library to be installed.
- Must be in semver format. If "latest" is desired, use "state" arg instead - Must be in semver format. If "latest" is desired, use O(state) arg instead.
required: false required: false
global: global:
description: description:
- Install the node.js library globally - Install the Node.js library globally.
required: false required: false
default: false default: false
type: bool type: bool
@ -60,14 +59,14 @@ options:
required: false required: false
ignore_scripts: ignore_scripts:
description: description:
- Use the --ignore-scripts flag when installing. - Use the C(--ignore-scripts) flag when installing.
required: false required: false
type: bool type: bool
default: false default: false
production: production:
description: description:
- Install dependencies in production mode. - Install dependencies in production mode.
- Yarn will ignore any dependencies under devDependencies in package.json - Yarn will ignore any dependencies under devDependencies in C(package.json).
required: false required: false
type: bool type: bool
default: false default: false
@ -79,28 +78,28 @@ options:
state: state:
type: str type: str
description: description:
- Installation state of the named node.js library - Installation state of the named Node.js library.
- If absent is selected, a name option must be provided - If V(absent) is selected, a O(name) option must be provided.
required: false required: false
default: present default: present
choices: ["present", "absent", "latest"] choices: ["present", "absent", "latest"]
requirements: requirements:
- Yarn installed in bin path (typically /usr/local/bin) - Yarn installed in bin path (typically C(/usr/local/bin))
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Install "imagemin" node.js package. - name: Install "imagemin" Node.js package.
community.general.yarn: community.general.yarn:
name: imagemin name: imagemin
path: /app/location path: /app/location
- name: Install "imagemin" node.js package on version 5.3.1 - name: Install "imagemin" Node.js package on version 5.3.1
community.general.yarn: community.general.yarn:
name: imagemin name: imagemin
version: '5.3.1' version: '5.3.1'
path: /app/location path: /app/location
- name: Install "imagemin" node.js package globally. - name: Install "imagemin" Node.js package globally.
community.general.yarn: community.general.yarn:
name: imagemin name: imagemin
global: true global: true
@ -111,7 +110,7 @@ EXAMPLES = '''
global: true global: true
state: absent state: absent
- name: Install "imagemin" node.js package from custom registry. - name: Install "imagemin" Node.js package from custom registry.
community.general.yarn: community.general.yarn:
name: imagemin name: imagemin
registry: 'http://registry.mysite.com' registry: 'http://registry.mysite.com'
@ -124,43 +123,16 @@ EXAMPLES = '''
community.general.yarn: community.general.yarn:
path: /app/location path: /app/location
state: latest state: latest
''' """
RETURN = ''' RETURN = r"""
changed:
description: Whether Yarn changed any package data
returned: always
type: bool
sample: true
msg:
description: Provides an error message if Yarn syntax was incorrect
returned: failure
type: str
sample: "Package must be explicitly named when uninstalling."
invocation:
description: Parameters and values used during execution
returned: success
type: dict
sample: {
"module_args": {
"executable": null,
"globally": false,
"ignore_scripts": false,
"name": null,
"path": "/some/path/folder",
"production": false,
"registry": null,
"state": "present",
"version": null
}
}
out: out:
description: Output generated from Yarn. description: Output generated from Yarn.
returned: always returned: always
type: str type: str
sample: "yarn add v0.16.1[1/4] Resolving packages...[2/4] Fetching packages...[3/4] Linking dependencies...[4/4] sample: "yarn add v0.16.1[1/4] Resolving packages...[2/4] Fetching packages...[3/4] Linking dependencies...[4/4] Building fresh packages...success
Building fresh packages...success Saved lockfile.success Saved 1 new dependency..left-pad@1.1.3 Done in 0.59s." Saved lockfile.success Saved 1 new dependency..left-pad@1.1.3 Done in 0.59s."
''' """
import os import os
import json import json