Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/3.0.0 #36

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['12', '14', '16']
node: ['18', '20', '22']
env:
OS: ${{ matrix.os }}
NODE: '${{ matrix.node }}'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
60 changes: 10 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# find-duplicate-strings

**Easy to use CLI that finds duplicate strings in a directory and stores them in a external file for easy reference**
**Easy to use CLI that finds duplicate strings in a directory or file and stores the results in a external file for easy reference**

Note that this does not find matches in files like grep does, instead it searches for quoted characters. In other words, this tool can be used by development teams that want to know if there's any duplicate string values in their project and if so, where these can be found.
Note that this does not find matches in files like grep does, instead it searches for (double/single) quoted characters. In other words, this tool can be used by development teams that want to know if there's any duplicate string values in their project and if so, where these can be found.

## Getting started

Expand All @@ -18,64 +18,24 @@ npm i -g find-duplicate-strings
Run:

```bash
find-duplicate-strings
```

When no arguments are passed, the CLI will ask you for the required information.

For more information about what arguments and flags are supported, use the -h or --help flag.

Example without passing any flags or arguments (you will be asked for input):

```bash
find-duplicate-strings
```

Example with all the supported flags and arguments:

```bash
find-duplicate-strings --exclusions node_modules,coverage --extensions ts,js,json --treshold 10 --silent ./example/path
find-duplicate-strings ./
```

Breakdown of flags:

- `--exclusions node_modules,coverage` excludes any files and directories matching `node_modules` or `coverage`
- `--extensions ts,js,json` includes any files that have one of the following extentions `.ts`, `.js` or `.json`
- `--treshold 10` only outputs matches found greater than or equal to 10
- `--silent` runs the program in silent mode
- `--exclusions` excludes any files and directories that match
- `--extensions` includes any files that match these extensions
- `--treshold` only output strings that are duplicated for at least this number of times
- `--output` this allows you to change the default filename for the output
- `--interactive` runs the program in interactive mode mode

Breakdown of arguments:

- `./example/path` this is the path to scan (can be absolute or relative)

When done, if you aren't running in silent mode it will output a table containing it's first 10 findings:

```bash
┌─────────┬───────────────────────────────────────┬───────┐
│ (index) │ 0 │ 1 │
├─────────┼───────────────────────────────────────┼───────┤
│ 0 │ './question' │ 13 │
│ 1 │ './directory' │ 7 │
│ 2 │ './output' │ 9 │
│ 3 │ 'inquirer' │ 17 │
│ 4 │ './store' │ 9 │
│ 5 │ './ifinding' │ 7 │
│ 6 │ 'File' │ 8 │
│ 7 │ 'should return the answer when it...' │ 6 │
│ 8 │ 'dummy' │ 17 │
│ 9 │ 'dummy1' │ 10 │
│ 10 │ '...' │ │
└─────────┴───────────────────────────────────────┴───────┘
```

After that, you will be asked to enter a path for a file to be created that the results can be written to (json):

```bash
? Please provide a filepath to store the output.
./output/filename
```
For information about what arguments and flags are supported, use the `--help` flag.

This will write the output to `./output/filename.json` if the output directory exists.
The result of the scan will be stored in file called fds-output.json or fds-output-<num>.json if it already exists.

## Help

Expand Down
8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
ignores: ['**/node_modules/', '**/coverage/', '**/lib/'],
});
Loading