Skip to content

Commit

Permalink
feat: add README
Browse files Browse the repository at this point in the history
  • Loading branch information
jase88 committed Jul 23, 2023
1 parent ad8aa55 commit 42e4424
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '20.x'
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
Expand Down
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
# modify-package-json
# filter-npm-deps
![npm](https://img.shields.io/npm/v/filter-npm-deps?style=flat-square)

filter-npm-deps is a convenient Node.js CLI script designed to filter a given list of dependencies from your `package.json`.

It supports filtering dependencies from all three commonly used dependency fields: *dependencies*, *devDependencies*, and *optionalDependencies*.

## 🚀 Usage

To use filter-npm-deps, you can easily invoke it with npx as follows:

```bash
npx filter-npm-deps -d [dependencies]
```

For example, if you want to only keep "lodash" and "axios" with the given version from your package.json, you can run:

```bash
npx filter-npm-deps -d "lodash, axios"
```


## 💡 Alternatives

While filter-npm-deps serves as a simple solution for filtering dependencies, there are other tools available that you might find useful:

- [jq](https://jqlang.github.io/jq/manual/) is a powerful command-line tool for processing JSON data. It can be used to filter for nested properties, but it requires explicit handling of all three dependency fields.
- [install-subset](https://github.com/tabrindle/install-subset) offers a different approach by enabling you to define specific subsets of npm dependencies that should be installed. This allows you to have more fine-grained control over your project's dependencies.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "filter-npm-deps",
"version": "0.0.1",
"version": "0.1.0",
"description": "",
"engines": {
"node": ">=18"
},
"bin": {
"filter-npm-deps": "./filter-npm-deps.mjs"
},
Expand Down

0 comments on commit 42e4424

Please sign in to comment.