Quickly removes dependencies from your package.json file.
πͺ
You can invoke remove-dependencies on the CLI or via its programmatic Node.js API.
It will remove all requested dependencies from dependencies and devDependencies.
npx remove-dependenciesnpx remove-dependencies takes in any number of package names to remove from your package.json.
It will remove all requested dependencies from dependencies and devDependencies.
For example, to remove the mocha and jest packages:
npx remove-dependencies mocha jestThat command may change your package.json on disk.
npm i remove-dependenciesremove-dependencies exports a removeDependencies function that takes in any number of package names to remove from your package.json.
It will return an object with all requested dependencies removed from dependencies and devDependencies.
import { removeDependencies } from "remove-dependencies";
const packageData = {
dependencies: {
// ...
},
// ...
};
const removedData = removeDependencies(packageData);
// { dependencies: ... }
console.log(removedData);Usually, you can npm uninstall / pnpm uninstall / yarn remove packages away.
But those fully remove dependencies, including changing your node_modules/, and will throw an error if the dependency isn't found.
remove-dependencies ignores any dependencies not found and only changes your package.json file.
It also operates on all three of dependencies and devDependencies at once.
In other words, use remove-dependencies in scripts that should quickly modify a package.json file without installing or uninstalling.
See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.
Thanks! πͺ
Josh Goldberg β¨ π» π π€ π π§ π π§ π |
π This package was templated with
create-typescript-appusing the Bingo engine.