Skip to content

JoshuaKGoldberg/remove-dependencies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Remove Dependencies

Quickly removes dependencies from your package.json file. πŸ”ͺ

πŸ‘ͺ All Contributors: 1 🀝 Code of Conduct: Kept πŸ§ͺ Coverage πŸ“ License: MIT πŸ“¦ npm version πŸ’ͺ TypeScript: Strict

Usage

You can invoke remove-dependencies on the CLI or via its programmatic Node.js API. It will remove all requested dependencies from dependencies, devDependencies, and peerDependencies.

CLI

npx remove-dependencies

npx remove-dependencies takes in any number of package names to remove from your package.json. It will remove all requested dependencies from dependencies, devDependencies, and peerDependencies.

For example, to remove the mocha and jest packages:

npx remove-dependencies mocha jest

That command may change your package.json on disk.

Node.js API

npm i remove-dependencies

remove-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, devDependencies, and peerDependencies.

import { removeDependencies } from "remove-dependencies";

const packageData = {
	dependencies: {
		// ...
	},
	// ...
};

const removedData = removeDependencies(packageData);

// { dependencies: ... }
console.log(removedData);

Why?

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, devDependencies, and peerDependencies at once.

In other words, use remove-dependencies in scripts that should quickly modify a package.json file without installing or uninstalling.

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md. Thanks! πŸ’–

Contributors

Josh Goldberg ✨
Josh Goldberg ✨

πŸ’» πŸ–‹ πŸ€” πŸš‡ 🚧 πŸ“† πŸ”§ πŸ“–

πŸ’ This package was templated with create-typescript-app using the create engine.

About

Quickly removes dependencies from your package.json file. πŸ”ͺ

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published