Skip to content
This repository was archived by the owner on Aug 4, 2022. It is now read-only.

Commit 3fa3b57

Browse files
authored
Merge pull request #20 from secure-rm/develop
4.1.0
2 parents dae84ca + 3f120d8 commit 3fa3b57

File tree

8 files changed

+108
-121
lines changed

8 files changed

+108
-121
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
<!-- ## [Unreleased] -->
1616

17+
## [4.1.0] - 2019-10-29
18+
19+
### Changed
20+
21+
- Events are now:
22+
- 'debug'
23+
- 'info'
24+
- 'notice'
25+
- 'warn'
26+
- 'error'
27+
28+
### Fixed
29+
30+
- Npm auto publisher bug.
31+
1732
## [4.0.1] - 2019-10-27
1833

1934
### Added

CONTRIBUTING.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<p align="center">
2-
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg?style=for-the-badge&logo=jest" alt="Tested with Jest"></a>
3-
<a href="https://www.npmjs.com"><img src="https://img.shields.io/librariesio/release/npm/secure-rm?style=for-the-badge&logo=npm" alt="Dependencies"></a>
4-
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/secure-rm?style=for-the-badge" alt="Node version"></a>
5-
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/language-typescript-blue?style=for-the-badge" alt="language"></a>
2+
<a href="https://libraries.io/npm/secure-rm"><img src="https://img.shields.io/librariesio/release/npm/secure-rm?style=for-the-badge&logo=npm" alt="Dependencies"></a>
3+
<img src="https://img.shields.io/github/contributors/secure-rm/core?style=for-the-badge" alt="Contributors">
4+
<img src="https://img.shields.io/github/last-commit/secure-rm/core/develop?style=for-the-badge" alt="Last commit">
5+
<img src="https://img.shields.io/npm/collaborators/secure-rm?style=for-the-badge" alt="npm collaborators">
66
</p>
77
<p align="center">
8-
<img src="https://img.shields.io/github/contributors/oganexon/secure-rm?style=for-the-badge" alt="Contributors">
9-
<img src="https://img.shields.io/github/last-commit/oganexon/secure-rm/develop?style=for-the-badge" alt="Last commit">
10-
<img src="https://img.shields.io/npm/collaborators/secure-rm?style=for-the-badge" alt="npm collaborators">
8+
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/-jest-99424f?style=for-the-badge&logo=jest" alt="Tested with Jest"></a>
9+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/-node-gray?style=for-the-badge&logo=node.js" alt="Node version"></a>
10+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/-typescript-blue?style=for-the-badge&logo=typescript" alt="language"></a>
1111
</p>
1212

1313
# Contributing / Developing
@@ -49,7 +49,7 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available,
4949

5050
This project uses the framework [Jest](https://jestjs.io/). Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
5151

52-
Simply run `jest` to run the tests.
52+
Simply run `npm test` to run the tests.
5353

5454
There are not enough tests, you can add more.
5555

@@ -63,7 +63,8 @@ You can install a [plugin](https://standardjs.com/awesome.html#editor-plugins) f
6363

6464
### Pull request
6565

66-
Please follow the [pull request template](./github/PULL_REQUEST_TEMPLATE/pull_request_template.md).
66+
Please PR to the `develop` branch!
67+
Then follow the [pull request template](.github/PULL_REQUEST_TEMPLATE/pull_request_template.md).
6768

6869
### Deploying / Publishing
6970

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,24 @@ srm('./folder/*.js')
6868
- Respond to events,
6969
- etc.
7070

71-
### Example:
71+
### Examples:
7272
```javascript
7373
const options = {
7474
standard: 'gutmann',
7575
maxBusyTries: 5,
7676
disableGlob: true
7777
}
7878

79-
srm('./data/file*.js', options, (err) => {
79+
srm('./data/*.js', options, (err) => {
8080
if (err) throw err
8181
console.log('Files successfully deleted !')
8282
})
83+
84+
srm('./trash/dir/', { standard: 'preview' }, (err, fileTree) => {
85+
if (err) throw err
86+
console.log('Files that would be deleted:' + fileTree)
87+
})
88+
8389
```
8490

8591
## 📜 Changelog / History
@@ -94,15 +100,15 @@ See the [changelog](/CHANGELOG.md) or [releases](https://github.com/oganexon/sec
94100
## 🏗 Contributing
95101

96102
<p align="center">
97-
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg?style=flat-square&logo=jest" alt="Tested with Jest"></a>
98-
<a href="https://www.npmjs.com"><img src="https://img.shields.io/librariesio/release/npm/secure-rm?style=flat-square&logo=npm" alt="Dependencies"></a>
99-
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/secure-rm?style=flat-square" alt="Node version"></a>
100-
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/github/languages/top/oganexon/secure-rm?style=flat-square" alt="language"></a>
103+
<a href="https://libraries.io/npm/secure-rm"><img src="https://img.shields.io/librariesio/release/npm/secure-rm?style=flat-square&logo=npm" alt="Dependencies"></a>
104+
<img src="https://img.shields.io/github/contributors/secure-rm/core?style=flat-square" alt="Contributors">
105+
<img src="https://img.shields.io/github/last-commit/secure-rm/core/develop?style=flat-square" alt="Last commit">
106+
<img src="https://img.shields.io/npm/collaborators/secure-rm?style=flat-square" alt="npm collaborators">
101107
</p>
102108
<p align="center">
103-
<img src="https://img.shields.io/github/contributors/oganexon/secure-rm?style=flat-square" alt="Contributors">
104-
<img src="https://img.shields.io/github/last-commit/oganexon/secure-rm/develop?style=flat-square" alt="Last commit">
105-
<img src="https://img.shields.io/npm/collaborators/secure-rm?style=flat-square" alt="npm collaborators">
109+
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/-jest-99424f?style=flat-square&logo=jest" alt="Tested with Jest"></a>
110+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/-node-gray?style=flat-square&logo=node.js" alt="Node version"></a>
111+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/-typescript-blue?style=flat-square&logo=typescript" alt="language"></a>
106112
</p>
107113

108114
See [contributing guidelines](/CONTRIBUTING.md)

package-lock.json

Lines changed: 37 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "secure-rm",
3-
"version": "4.0.1",
3+
"version": "4.1.0",
44
"description": "Completely erases files by making recovery impossible.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -66,8 +66,5 @@
6666
"plugins": [
6767
"@typescript-eslint/eslint-plugin"
6868
]
69-
},
70-
"publishConfig": {
71-
"registry": "https://npm.pkg.github.com/"
7269
}
7370
}

src/events.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ export function eventError (err: NodeJS.ErrnoException, file: string): void {
77
if (err) {
88
switch (err.code) {
99
case 'EMFILE':
10-
eventEmitter.emit('warn', file, `Too many open files, cannot ${err.syscall || 'access'}: `)
10+
eventEmitter.emit('notice', file, `Too many open files, cannot ${err.syscall || 'access'}: `)
1111
break
1212
case 'ENOENT':
13-
eventEmitter.emit('warn', file, 'This file no longer exists: ')
13+
eventEmitter.emit('notice', file, 'This file no longer exists: ')
1414
break
1515
case 'EPERM':
16-
eventEmitter.emit('error', file, `Operation not permitted on this file (${err.syscall}): `)
16+
eventEmitter.emit('warn', file, `Operation not permitted on this file (${err.syscall}): `)
1717
break
1818
case 'ENOTEMPTY':
1919
// Work as intended
2020
break
2121
default:
2222
if (err.message === '64bit files are not yet supported.') {
23-
eventEmitter.emit('error', file, '64bit files are not yet supported.')
23+
eventEmitter.emit('warn', file, '64bit files are not yet supported.')
2424
} else {
25-
console.log(err)
26-
throw err
25+
eventEmitter.emit('error', file, err)
26+
// throw err
2727
}
2828
// break
2929
}
@@ -35,11 +35,9 @@ export const tree: { [key: string]: string[] } = {}
3535
const debug = process.argv.includes('--debug')
3636

3737
if (debug) {
38-
eventEmitter.on('start', (file) => console.log('Starting ' + file))
39-
eventEmitter.on('done', (file) => console.log('Done ' + file))
40-
41-
eventEmitter.on('verbose', (file, info) => console.log(info + file))
42-
43-
eventEmitter.on('warn', (file, err) => console.log(err + file))
44-
eventEmitter.on('error', (file, err) => console.log(err + file))
38+
eventEmitter.on('debug', (file, message) => console.log('\x1b[38;2;128;0;128m Debug \x1b[39m' + message + file))
39+
eventEmitter.on('info', (file, message) => console.log('\x1b[38;2;0;0;255m Info \x1b[39m' + message + file))
40+
eventEmitter.on('notice', (file, message) => console.log('\x1b[38;2;0;255;255m Notice \x1b[39m' + message + file))
41+
eventEmitter.on('warn', (file, message) => console.log('\x1b[38;2;255;255;0m Warn \x1b[39m' + message + file))
42+
eventEmitter.on('error', (file, message) => console.log('\x1b[38;2;255;0;0m Error \x1b[39m' + message + file))
4543
}

src/secure-rm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { standards, validIDs, Standard } from './standards' // eslint-disable-li
55
import { tree } from './events'
66

77
// to get the correct tree for each call
8-
function getUUID() {
8+
function getUUID () {
99
return crypto.randomBytes(60).toString('base64').replace(/\//g, '0').replace(/\+/g, 'a')
1010
}
1111

0 commit comments

Comments
 (0)