Install dependencies with control πͺ
Sometimes, you need nuance and control over your npm dependencies.
You might want to minimize your
node_modulefolder 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.
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'
},
})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-devListed 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 commandInstall an additional list of dependencies.
install-perfection --include {"playwright-core": "latest"}' '{"react": "latest"}Ignore an array of dependencies.
install-perfection --ignore playwright reactIgnore 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 playwrightAdd a custom path to the package.json file you're installing perfection for.
install-perfection --path ./path/to/package.json --ignore playwrightAdd a custom path to install your node_modules.
install-perfection --dest ./path/to/node_modules_dest --ignore playwrightUse a custom runner (dependence manager)
install-perfection --runner pnpm --ignore playwrightMake it fast by inputting your config to your command.
install-perfection --config ./path/to/.installrc --ignore playwrightGet debugging information.
install-perfection --debug --ignore playwrightThe node API works exactly the same as the CLI API.
import { install } from 'install-perfection'
install({
include: {
'playwright-core': 'latest'
},
ignore: {
'playwright': 'latest'
},
})Yes. Just like your node_module folder. π Use Install Perfection to make your node_modules a bit less.
Made by @yowainwright, MIT 2023