-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yarn: adjust docs #9279
Merged
Merged
yarn: adjust docs #9279
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,12 +11,11 @@ | |
__metaclass__ = type | ||
|
||
|
||
DOCUMENTATION = ''' | ||
--- | ||
DOCUMENTATION = r""" | ||
module: yarn | ||
short_description: Manage node.js packages with Yarn | ||
short_description: Manage Node.js packages with Yarn | ||
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: | ||
- "David Gunter (@verkaufer)" | ||
- "Chris Hoffman (@chrishoffman), creator of NPM Ansible module)" | ||
|
@@ -31,25 +30,25 @@ | |
name: | ||
type: str | ||
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. | ||
- 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 | ||
path: | ||
type: path | ||
description: | ||
- 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 | ||
version: | ||
type: str | ||
description: | ||
- 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 | ||
global: | ||
description: | ||
- Install the node.js library globally | ||
- Install the Node.js library globally. | ||
required: false | ||
default: false | ||
type: bool | ||
|
@@ -60,14 +59,14 @@ | |
required: false | ||
ignore_scripts: | ||
description: | ||
- Use the --ignore-scripts flag when installing. | ||
- Use the C(--ignore-scripts) flag when installing. | ||
required: false | ||
type: bool | ||
default: false | ||
production: | ||
description: | ||
- 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 | ||
type: bool | ||
default: false | ||
|
@@ -79,88 +78,61 @@ | |
state: | ||
type: str | ||
description: | ||
- Installation state of the named node.js library | ||
- If absent is selected, a name option must be provided | ||
- Installation state of the named Node.js library. | ||
- If V(absent) is selected, a O(name) option must be provided. | ||
required: false | ||
default: present | ||
choices: [ "present", "absent", "latest" ] | ||
choices: ["present", "absent", "latest"] | ||
requirements: | ||
- Yarn installed in bin path (typically /usr/local/bin) | ||
''' | ||
|
||
EXAMPLES = ''' | ||
- name: Install "imagemin" node.js package. | ||
community.general.yarn: | ||
name: imagemin | ||
path: /app/location | ||
|
||
- name: Install "imagemin" node.js package on version 5.3.1 | ||
community.general.yarn: | ||
name: imagemin | ||
version: '5.3.1' | ||
path: /app/location | ||
|
||
- name: Install "imagemin" node.js package globally. | ||
community.general.yarn: | ||
name: imagemin | ||
global: true | ||
|
||
- name: Remove the globally-installed package "imagemin". | ||
community.general.yarn: | ||
name: imagemin | ||
global: true | ||
state: absent | ||
|
||
- name: Install "imagemin" node.js package from custom registry. | ||
community.general.yarn: | ||
name: imagemin | ||
registry: 'http://registry.mysite.com' | ||
|
||
- name: Install packages based on package.json. | ||
community.general.yarn: | ||
path: /app/location | ||
|
||
- name: Update all packages in package.json to their latest version. | ||
community.general.yarn: | ||
path: /app/location | ||
state: latest | ||
''' | ||
|
||
RETURN = ''' | ||
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 | ||
} | ||
} | ||
- Yarn installed in bin path (typically C(/usr/local/bin)) | ||
""" | ||
|
||
EXAMPLES = r""" | ||
- name: Install "imagemin" Node.js package. | ||
community.general.yarn: | ||
name: imagemin | ||
path: /app/location | ||
|
||
- name: Install "imagemin" Node.js package on version 5.3.1 | ||
community.general.yarn: | ||
name: imagemin | ||
version: '5.3.1' | ||
path: /app/location | ||
|
||
- name: Install "imagemin" Node.js package globally. | ||
community.general.yarn: | ||
name: imagemin | ||
global: true | ||
|
||
- name: Remove the globally-installed package "imagemin". | ||
community.general.yarn: | ||
name: imagemin | ||
global: true | ||
state: absent | ||
|
||
- name: Install "imagemin" Node.js package from custom registry. | ||
community.general.yarn: | ||
name: imagemin | ||
registry: 'http://registry.mysite.com' | ||
|
||
- name: Install packages based on package.json. | ||
community.general.yarn: | ||
path: /app/location | ||
|
||
- name: Update all packages in package.json to their latest version. | ||
community.general.yarn: | ||
path: /app/location | ||
state: latest | ||
""" | ||
|
||
RETURN = r""" | ||
out: | ||
description: Output generated from Yarn. | ||
returned: always | ||
type: str | ||
sample: "yarn add v0.16.1[1/4] Resolving packages...[2/4] Fetching packages...[3/4] Linking dependencies...[4/4] | ||
Building fresh packages...success Saved lockfile.success Saved 1 new [email protected] Done in 0.59s." | ||
''' | ||
description: Output generated from Yarn. | ||
returned: always | ||
type: str | ||
sample: "yarn add v0.16.1[1/4] Resolving packages...[2/4] Fetching packages...[3/4] Linking dependencies...[4/4] Building fresh packages...success | ||
Saved lockfile.success Saved 1 new [email protected] Done in 0.59s." | ||
""" | ||
|
||
import os | ||
import json | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now has extra indentation that shouldn't be there. Can you please remove the extra indent in the examples? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was done automatically. I am using ruamel.yaml and it has no provision for lists being the top levelof the document. But it is doable so, coming soon.