handpick

Handpick conditional dependencies like a boss

Usage no npm install needed!

<script type="module">
  import handpick from 'https://cdn.skypack.dev/handpick';
</script>

README

Handpick

Handpick conditional dependencies like a boss.

Build Status Coverage Status NPM Version License

Preview

Terminal Session

Installation

Install on your system:

npm install handpick --global

Setup

Create a .handpick file to override configuration:

{
    "manager": "npm",
    "managerObject":
    {
        "npm":
        [
            "install",
            "--no-package-lock"
        ],
        "pnpm":
        [
            "install",
            "--no-lockfile"
        ],
        "yarn":
        [
            "--no-lockfile"
        ]
    },
    "range": "dirty",
    "rangeArray":
    [
        "dirty",
        "exact",
        "patch",
        "minor"
    ],
    "ignorePrefix": "__",
    "ignoreArray":
    [
        "dependencies",
        "devDependencies"
    ],
    "targetArray":
    [
        "dependencies",
        "devDependencies"
    ],
    "filterArray": [],
    "path": ".",
    "packageFile": "package.json",
    "packageDirectory": "node_modules"
}

Usage

Run the command:

handpick [options]

-V, --version
-C, --config <config>
-T, --target <target>
-F, --filter <filter>
-M, --manager <manager>
-R, --range <range>
-P, --path <path>
-h, --help

Options

Name Type Default Mandatory
config string .handpick optional
target string dependencies / devDependencies optional
filter string optional
manager string npm optional
range string dirty optional
path string . optional

Examples

Define unofficial dependencies inside package.json file:

{
    "lintDependencies":
    {
        "eslint": "6.8.0",
        "eslint-config-redaxmedia": "2.1.0"
    },
    "testDependencies":
    {
        "chai": "4.2.0",
        "mocha": "7.2.0"
    }
}

Install the lintDependencies:

handpick --target=lintDependencies

Install the devDependencies and lintDependencies via YARN:

handpick --target=devDependencies --target=lintDependencies --manager=yarn

Install the devDependencies without testDependencies:

handpick --target=devDependencies --filter=testDependencies

Install the dependencies and devDependencies within path:

handpick --path=../shared

Install the dependencies with exact range:

handpick --target=dependencies --range=exact

Managers

Name Value
NPM npm
PNPM pnpm
YARN yarn