Skip to content

Commit ee11183

Browse files
committed
Merge branch 'main' into feat/move-get-folder-size-to-workers
2 parents e197807 + a850785 commit ee11183

17 files changed

Lines changed: 11082 additions & 20149 deletions

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, windows-latest]
15-
node-version: [14, 16, 18, 22]
15+
node-version: [18, 20, 22, 24]
1616
include:
1717
- os: macos-latest
1818
node-version: 21

.husky/commit-msg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
npx --no -- commitlint --edit

.husky/pre-commit

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
npx lint-staged

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.12.0

README.es.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717

1818
Esta herramienta te permite listar cualquier directorio _node_modules_ que haya en tu sistema, además del espacio que ocupa. Entonces puedes seleccionar los que quieras borrar para liberar espacio. ¡Yay!
1919

20+
## i18n
21+
22+
Nos estamos esforzando por internacionalizar la documentación de Npkill. Aquí tienes una lista de las traducciones disponibles:
23+
24+
- [Español](./README.es.md)
25+
- [Português](./README.pt.md)
26+
2027
## Table of Contents
2128

2229
- [Características](#features)
@@ -132,7 +139,7 @@ npkill --target dist -e
132139
- Muestra el cursor de color magenta... ¡Porque me gusta el magenta!
133140

134141
```bash
135-
npkill --color magenta
142+
npkill --bg-color magenta
136143
```
137144

138145
- Lista los directorios **vendor** en un directorio _projects_, ordenados por tamaño y mostrando el tamaño en gb:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This tool allows you to list any _node_modules_ directories in your system, as w
2222
We're making an effort to internationalize the Npkill docs. Here's a list of the available translations:
2323

2424
- [Español](./README.es.md)
25+
- [Português](./README.pt.md)
2526
- [Indonesian](./README.id.md)
2627

2728
## Table of Contents
@@ -138,7 +139,7 @@ npkill --target dist -e
138139
- Displays the magenta color cursor... because I like magenta!
139140

140141
```bash
141-
npkill --color magenta
142+
npkill --bg-color magenta
142143
```
143144

144145
- List **vendor** directories in your _projects_ directory, sort by size, and show size in gb:

README.pt.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<img src="/docs/npkill-demo-0.10.0.gif" alt="npkill demo GIF" />
1616
</p>
1717

18-
Esta ferramenta permite que você liste as pastas _node_modules_ em seu sistema, bem como o espaço que ocupam. Então você pode selecionar quais deles deseja apagar para liberar espaço!
18+
Esta ferramenta permite que você liste as pastas _node_modules_ em seu sistema, bem como o espaço que ocupam. Então você pode selecionar quais deles deseja apagar para liberar espaço. ¡Yay!
1919

2020
## i18n
2121

@@ -138,7 +138,7 @@ npkill --target dist -e
138138
- Exibe o cursor na cor magenta... porque eu gosto de magenta!
139139

140140
```bash
141-
npkill --color magenta
141+
npkill --bg-color magenta
142142
```
143143

144144
- Listar pastas **vendor** no seu diretório de _projetos_, ordenar por tamanho e mostrar o tamanho em GB:

__tests__/files.service.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('File Service', () => {
7070
statSyncReturnMock = () => {
7171
throw new Error('ENOENT');
7272
};
73-
expect(() => fileService.isValidRootFolder(path)).toThrowError(
73+
expect(() => fileService.isValidRootFolder(path)).toThrow(
7474
'The path does not exist.',
7575
);
7676
});
@@ -80,7 +80,7 @@ describe('File Service', () => {
8080
isDirectory: () => false,
8181
});
8282

83-
expect(() => fileService.isValidRootFolder(path)).toThrowError(
83+
expect(() => fileService.isValidRootFolder(path)).toThrow(
8484
'The path must point to a directory.',
8585
);
8686
});
@@ -93,7 +93,7 @@ describe('File Service', () => {
9393
throw new Error();
9494
};
9595

96-
expect(() => fileService.isValidRootFolder(path)).toThrowError(
96+
expect(() => fileService.isValidRootFolder(path)).toThrow(
9797
'Cannot read the specified path.',
9898
);
9999
});
@@ -181,7 +181,7 @@ describe('File Service', () => {
181181
it('#getFileContent should read file content with utf8 encoding', () => {
182182
const path = 'file.json';
183183
fileService.getFileContent(path);
184-
expect(readFileSyncSpy).toBeCalledWith(path, 'utf8');
184+
expect(readFileSyncSpy).toHaveBeenCalledWith(path, 'utf8');
185185
});
186186

187187
xdescribe('Functional test for #deleteDir', () => {

__tests__/files.worker.service.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('FileWorkerService', () => {
9393

9494
it('should emit "explore" and parameters to the worker', () => {
9595
fileWorkerService.startScan(stream$, params);
96-
expect(messageChannelPort1Mock).toBeCalledWith({
96+
expect(messageChannelPort1Mock).toHaveBeenCalledWith({
9797
type: EVENTS.explore,
9898
value: { path: params.path },
9999
});
@@ -159,7 +159,7 @@ describe('FileWorkerService', () => {
159159
},
160160
} as WorkerMessage);
161161

162-
expect(messageChannelPort1Mock).toBeCalledWith({
162+
expect(messageChannelPort1Mock).toHaveBeenCalledWith({
163163
type: EVENTS.explore,
164164
value: { path: val[0] },
165165
});
@@ -210,15 +210,15 @@ describe('FileWorkerService', () => {
210210
fileWorkerService.startScan(stream$, params);
211211
workerEmitter.emit('error');
212212
expect(searchStatus.workerStatus).toBe('dead');
213-
}).toThrowError();
213+
}).toThrow();
214214
});
215215

216216
it('should register worker exit on "exit"', () => {
217217
fileWorkerService.startScan(stream$, params);
218218

219219
logger.info.mockReset();
220220
workerEmitter.emit('exit');
221-
expect(logger.info).toBeCalledTimes(1);
221+
expect(logger.info).toHaveBeenCalledTimes(1);
222222
});
223223
});
224224
});
@@ -240,7 +240,7 @@ describe('FileWorkerService', () => {
240240
// mockRandom(randomNumber);
241241

242242
// fileWorkerService.getSize(stream$, path);
243-
// expect(workerPostMessageMock).toBeCalledWith({
243+
// expect(workerPostMessageMock).toHaveBeenCalledWith({
244244
// type: 'start-getSize',
245245
// value: { path: path, id: randomNumber },
246246
// });

__tests__/logger.service.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ describe('LoggerService', () => {
112112
existsSyncMock.mockReturnValue(false);
113113
const path = logger.getSuggestLogFilePath();
114114
logger.saveToFile(path);
115-
expect(renameFileSyncMock).not.toBeCalled();
115+
expect(renameFileSyncMock).not.toHaveBeenCalled();
116116
});
117117

118118
it('should rotate file if exist', () => {
119119
existsSyncMock.mockReturnValue(true);
120120
const path = logger.getSuggestLogFilePath();
121121
logger.saveToFile(path);
122122
const expectedOldPath = path.replace('latest', 'old');
123-
expect(renameFileSyncMock).toBeCalledWith(path, expectedOldPath);
123+
expect(renameFileSyncMock).toHaveBeenCalledWith(path, expectedOldPath);
124124
});
125125
});
126126

@@ -136,7 +136,7 @@ describe('LoggerService', () => {
136136
'[1767225600000](info) world\n';
137137

138138
logger.saveToFile(path);
139-
expect(writeFileSyncMock).toBeCalledWith(path, expected);
139+
expect(writeFileSyncMock).toHaveBeenCalledWith(path, expected);
140140
});
141141
});
142142
});

0 commit comments

Comments
 (0)