Comparing version 0.4.2 to 0.4.3
@@ -40,2 +40,7 @@ "use strict"; | ||
{ | ||
arg: ['-nu', '--no-check-update'], | ||
description: 'Dont check for updates on startup.', | ||
name: 'no-check-updates', | ||
}, | ||
{ | ||
arg: ['-v', '--version'], | ||
@@ -42,0 +47,0 @@ description: 'Show version.', |
@@ -13,2 +13,3 @@ "use strict"; | ||
backgroundColor: 'bgBlue', | ||
checkUpdates: true, | ||
deleteAll: false, | ||
@@ -27,3 +28,3 @@ folderSizeInGb: false, | ||
X_COMMAND_OFFSET: 3, | ||
X_DESCRIPTION_OFFSET: 25, | ||
X_DESCRIPTION_OFFSET: 27, | ||
Y_OFFSET: 2, | ||
@@ -30,0 +31,0 @@ }; |
@@ -8,2 +8,3 @@ "use strict"; | ||
DELETED_FOLDER: '[DELETED] ', | ||
DISABLED: '[-D, --delete-all] option has been disabled until future versions. Please restart npkill without this option.', | ||
HEADER_SIZE_COLUMN: 'folder size', | ||
@@ -14,2 +15,5 @@ HELP_TITLE: ' NPKILL HELP ', | ||
NEW_UPDATE_FOUND: 'New version found! npm i -g npkill for update.', | ||
NO_TTY: | ||
// tslint:disable-next-line: max-line-length | ||
'Oh no! Npkill does not support this terminal (TTY is required). This is a bug, which has to be fixed. Please try another command interpreter (for example, CMD in windows)', | ||
SEARCHING: 'searching ', | ||
@@ -19,3 +23,2 @@ SEARCH_COMPLETED: 'search completed ', | ||
TOTAL_SPACE: 'releasable space: ', | ||
DISABLED: '[-D, --delete-all] option has been disabled until future versions. Please restart npkill without this option.', | ||
}; | ||
@@ -22,0 +25,0 @@ exports.ERROR_MSG = { |
@@ -37,6 +37,10 @@ "use strict"; | ||
}; | ||
this.init(); | ||
} | ||
init() { | ||
keypress(process.stdin); | ||
this.getArguments(); | ||
this.prepareScreen(); | ||
this.checkVersion(); | ||
if (this.config.checkUpdates) | ||
this.checkVersion(); | ||
this.scan(); | ||
@@ -67,2 +71,4 @@ } | ||
this.config.folderSizeInGb = true; | ||
if (options['no-check-updates']) | ||
this.config.checkUpdates = false; | ||
if (options['bg-color']) | ||
@@ -115,6 +121,3 @@ this.setColor(options['bg-color']); | ||
prepareScreen() { | ||
if (this.isTerminalTooSmall()) { | ||
this.print(messages_constants_1.INFO_MSGS.MIN_CLI_CLOMUNS); | ||
process.exit(); | ||
} | ||
this.checkScreenRequirements(); | ||
this.setRawMode(); | ||
@@ -126,2 +129,12 @@ this.clear(); | ||
} | ||
checkScreenRequirements() { | ||
if (this.isTerminalTooSmall()) { | ||
this.print(messages_constants_1.INFO_MSGS.MIN_CLI_CLOMUNS); | ||
process.exit(); | ||
} | ||
if (!this.stdout.isTTY) { | ||
this.print(messages_constants_1.INFO_MSGS.NO_TTY); | ||
process.exit(); | ||
} | ||
} | ||
checkVersion() { | ||
@@ -128,0 +141,0 @@ this.updateService |
{ | ||
"name": "npkill", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "This tool allows you to list any node_modules directories in your system, as well as the space they take up. You can then select which ones you want to erase to free up space.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -28,7 +28,10 @@ <p align="center"> | ||
- [Roadmap](#roadmap) | ||
- [Known-bugs](#known-bugs) | ||
- [Known bugs](#known-bugs) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
# Features | ||
<a name="features"></a> | ||
# :heavy_check_mark: Features | ||
- **Clear space:** Get rid of old and dusty node_modules cluttering up your machine. | ||
@@ -42,4 +45,6 @@ | ||
# Installation | ||
<a name="installation"></a> | ||
# :cloud: Installation | ||
```bash | ||
@@ -49,6 +54,8 @@ $ npm i -g npkill | ||
_Unix users may need to run the command with sudo_ | ||
_Unix users may need to run the command with sudo. Go carefully_ | ||
# Usage | ||
<a name="usage"></a> | ||
# :clipboard: Usage | ||
```bash | ||
@@ -64,17 +71,22 @@ $ npkill | ||
<a name="options"></a> | ||
## Options | ||
| ARGUMENT | DESCRIPTION | | ||
| ----------------- | ----------------------------------------------------------------------------------------- | | ||
| -c, --bg-color | Change row highlight color. _(Available: **blue**, cyan, magenta, white, red and yellow)_ | | ||
| -d, --directory | Set the directory from which to begin searching. By default, starting-point is . | | ||
| -D, --delete-all | CURRENTLY DISABLED. Automatically delete all node_modules folders that are found. | | ||
| -e, --show-errors | Show error messages related to the search if any | | ||
| -f, --full | Start searching from the home of the user (example: "/home/user" in linux) | | ||
| -gb | Show folders in Gigabytes instead of Megabytes. | | ||
| -h, --help, ? | Show this help page and exit | | ||
| -v, --version | Show npkill version | | ||
| ARGUMENT | DESCRIPTION | | ||
| ---------------------- | ----------------------------------------------------------------------------------------- | | ||
| -c, --bg-color | Change row highlight color. _(Available: **blue**, cyan, magenta, white, red and yellow)_ | | ||
| -d, --directory | Set the directory from which to begin searching. By default, starting-point is . | | ||
| -D, --delete-all | CURRENTLY DISABLED. Automatically delete all node_modules folders that are found. | | ||
| -e, --show-errors | Show error messages related to the search if any | | ||
| -f, --full | Start searching from the home of the user (example: "/home/user" in linux) | | ||
| -gb | Show folders in Gigabytes instead of Megabytes. | | ||
| -h, --help, ? | Show this help page and exit | | ||
| -nu, --no-check-update | Dont check for updates on startup. | | ||
| -v, --version | Show npkill version | | ||
**Warning:** _In future versions some commands may change_ | ||
<a name="examples"></a> | ||
## Examples | ||
@@ -98,4 +110,6 @@ | ||
# Roadmap | ||
<a name="roadmap"></a> | ||
# :crystal_ball: Roadmap | ||
- [x] Release 0.1.0 ! | ||
@@ -105,2 +119,3 @@ - [x] Improve code | ||
- [ ] Improve performance even more! | ||
- [ ] Sort results by size and path | ||
- [ ] Reduce dependencies to be a more minimalist module | ||
@@ -113,16 +128,28 @@ - [ ] Allow the search for other types of directories (targets) | ||
# Known-bugs | ||
<a name="known-bugs"></a> | ||
# :bug: Known bugs :bug: | ||
- Sometimes, CLI is blocked while folder is deleting. | ||
- Some terminals that do not use TTY (like git bash in windows) do not work. | ||
- (SOLVED) Performance issues when searching from high level directories (like / in linux). | ||
- (SOLVED) Sometimes text collapses when updating the cli. | ||
- (SOLVED) Analyzing the size of the directories takes longer than it should. | ||
- (SOLVED) State "searching..." does not change even if search has been completed | ||
> If you find any bugs, don't hesitate and open an issue :) | ||
# Contributing | ||
<a name="contributing"></a> | ||
# :revolving_hearts: Contributing | ||
Available soon | ||
<a name="license"></a> | ||
# :scroll: License | ||
MIT © [Nya García Gallardo](https://github.com/NyaGarcia) and [Juan Torres Gómez](https://github.com/zaldih) | ||
:cat::baby_chick: | ||
--- |
2265493
1044
149