0.1.3 • Published 4 months ago

install-perfection v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Install Perfection

Typed with TypeScript npm version ci Github

Install dependencies with control 💪

Sometimes, you need nuance and control over your npm dependencies.

You might want to minimize your node_module folder size when shipping to production. Or, you might want to switch dependencies on the fly. For this, Install Perfection might be the tool you need.


How easy is Install Perfection to set up?

Very easy!

If not, submit an issue!

You can use Install Perfection as a CLI only.

npx install-perfection --include {"playwright-core": "latest"} --ignore {"playwright": "latest"}

If you'd like to use it a bit more explicitly, you can configure it in your package.json.

// package.json
{
  ...
  "install": {
    // include this dependency
    "include": {
      "playwright-core": "latest"
    },
    // but don't include this one!
    "ignore": {
      "playwright": "latest"
    }
  }
  ...
}

Or, if you like to keep your package.json pure, you can create a .installrc file with the same configuration.

// .installrc
{
  "include": {
    "playwright-core": "latest"
  },
  "ignore": {
    "playwright": "latest"
  }
}

If you'd like to build something custom, you can copy it's functionality into your own project or you can use the exported functions directly—as they're typed and tested.

import { install } from 'install-perfection'

install({
  include: {
    'playwright-core': 'latest'
  },
  ignore: {
    'playwright': 'latest'
  },
})

How do I use Install Perfection?

Install Perfection is built to be used as a CLI first and foremost. It also exports node functions which can be used to preform the same install operation.


Install or reference Install Perfection in your project.

npm install install-perfection --save-dev

CLI API

Listed below are the CLI options and arguments to execute install-perfection. To *view all cli options, run install-perfection --help!

Usage: install-perfection [options]

Install dependencies with control, perfectly 💪

Options:
  -V, --version               output the version number
  -c, --config <config>       config path
  --debug                     enables debug mode
  -d, --dest <string>         dest path
  -f, --file <file>           path to package.json file
  --has-lockfile              use lock file
  -p, --path <path>           path to package.json file
  -r, --runner <runner>       npm, pnpm, or yarn (bun support coming; use npm for bun now)
  -i, --include [include...]  include dependencies, include an array of json parseable string
                              wrapped objects, e.g. `--include '{"foo": "bar"}' '{"biz": "baz"}'
                              `
  --ignore [exclude...]       exclude dependencies, e.g. `--exclude foo bar`
  -h, --help                  display help for command

Recipes

Install an additional list of dependencies.

install-perfection --include {"playwright-core": "latest"}' '{"react": "latest"}

Ignore an array of dependencies.

install-perfection --ignore playwright react

Ignore and install dependencies for Install Perfection.

install-perfection --ignore playwright react --include {"playwright-core": "latest"} {"react": "latest"}

Install while including a lock file.

install-perfection --has-lockfile --ignore playwright

Add a custom path to the package.json file you're installing perfection for.

install-perfection --path ./path/to/package.json --ignore playwright

Add a custom path to install your node_modules.

install-perfection --dest ./path/to/node_modules_dest --ignore playwright

Use a custom runner (dependence manager)

install-perfection --runner pnpm --ignore playwright

Make it fast by inputting your config to your command.

install-perfection --config ./path/to/.installrc --ignore playwright

Get debugging information.

install-perfection --debug --ignore playwright

Node API

The node API works exactly the same as the CLI API.

import { install } from 'install-perfection'

install({
  include: {
    'playwright-core': 'latest'
  },
  ignore: {
    'playwright': 'latest'
  },
})

Is the name, "Install Perfection", a bit much?

Yes. Just like your node_module folder. 😜 Use Install Perfection to make your nodemodules _a bit less.


Made by @yowainwright, MIT 2023