en-US/about_Whiskey_Npm_Task.help.txt

TOPIC
    about_Whiskey_Npm_Task
 
 
SUMMARY
    Runs NPM commands.
 
 
DESCRIPTION
    The `Npm` task runs NPM commands. Pass the name of the command to the `Command` property. Pass command arguments to the `Argument` property. If the NPM command returns a non-zero exit code, the build will fail.
 
    By default, uses the latest LTS version of Node and the version of NPM that ships with it. To customize the version of Node to use, specify that version in the `engines.node` property in the package.json file or use the task's `NodeVersion` property. The task looks for a package.json file in the its working directory, which by default is the directory of your whiskey.yml file. You can change the task's working directory with the `WorkingDirectory` property.
 
    You can customize the version of NPM to use with the `NpmVersion` property.
 
PROPERTIES
 
    * `NodeVersion`: the version of Node to use. By default, the version in the `engines.node` property of your package.json file is used. If that is missing, the latest LTS version of Node is used.
    * `NpmVersion`: the version of NPM to use. By default, the version that ships with the version of Node you're using is used. The `npm audit` command is available in NPM version 6 and later. A Node semver expression is allowed, e.g. use `>=6' to use the most recent version of NPM after and including version 6.
 
 
EXAMPLES
 
    ## Example 1
 
        Build:
        - Npm:
            Command: install
 
    Demonstrates how to run `npm install` to download and install your project's dependencies.
 
    ## Example 2
 
        Build:
        - Npm:
            Command: install
            WorkingDirectory: app
 
    Demonstrates how to run an NPM command in a custom working directory. The default working directory is the directory of your whiskey.yml file.
 
    ## Example 3
 
        Build:
        - Npm:
            Command: install
            NodeVersion: 10.9.0
            NpmVersion: 6.4.1
 
    Demonstrates how to customize your version of Node and NPM to install and use. The default is to use the latest LTS version of Node.js with the version of NPM it ships with.
 
    ## Example 4
 
        Build:
        - Npm:
            Command: install
            Argument:
            - gulp
            - --global
 
    Demonstrate how to run the `npm install` command to install a module globally. In Whiskey, the global Node is the version of Node downloaded into a ".node" directory in your project's root.
 
    ## Example 5
 
        Build:
        - Npm:
            Command: prune
 
    Demonstrates how you would call the `npm prune` command to prune/remove your dev dependencies.
 
    ## Example 6
 
        Build:
        - Npm:
            Command: run-script
            Argument:
            - build
 
    Demonstrates how to run `npm run` to run a custom build command defined in your package.json file.
 
    ## Example 7
 
        Build:
        - Npm:
            Command: audit
            NpmVersion: ">=6"
 
    Demonstrates how to run the `npm audit` command. Since this command was introduced in NPM 6, it also demonstrates how to choose a custom version of NPM. Whiskey will install that version for you using the version of NPM that shipped with the version of Node you're using.
 
    ## Example 8
 
        Build:
        - Npm:
            Command: config
            Argument:
            - set
            - registry
            - https://proget.example.com
 
    Demonstrates how to set the default registry in the current user's .npmrc file (the config command's default behavior).
 
    ## Example 9
 
        Build:
        - Npm:
            Command: config
            Argument:
            - set
            - registry
            - https://proget.example.com
            - --global
 
    Demonstrates how to set make a global NPM configuration change.
 
    ## Example 10
 
        Build:
        - Npm:
            Command: config
            Argument:
            - set
            - registry
            - https://proget.example.com
            - --userconfig
            - .npmrc
 
    Demonstrates how to set make an NPM configuration change in a custom .npmrc file. This will create a .npmrc file in the task's working directory (which can be set via a `WorkingDirectory` property and by default is the same directory as your whiskey.yml file).