@thi.ng/file-io 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/delete.d.ts +9 -0
- package/delete.js +8 -1
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-04-
|
|
3
|
+
- **Last updated**: 2024-04-23T07:02:17Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/file-io@2.1.0) (2024-04-23)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add deleteDir() ([06b4ffc](https://github.com/thi-ng/umbrella/commit/06b4ffc))
|
|
17
|
+
|
|
12
18
|
### [2.0.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/file-io@2.0.3) (2024-04-20)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/delete.d.ts
CHANGED
|
@@ -9,4 +9,13 @@ import type { ILogger } from "@thi.ng/logger";
|
|
|
9
9
|
* @param dryRun
|
|
10
10
|
*/
|
|
11
11
|
export declare const deleteFile: (path: string, logger?: ILogger, dryRun?: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Like {@link deleteFile}, but attempts to recursively remove an entire
|
|
14
|
+
* directory at given path.
|
|
15
|
+
*
|
|
16
|
+
* @param path
|
|
17
|
+
* @param logger
|
|
18
|
+
* @param dryRun
|
|
19
|
+
*/
|
|
20
|
+
export declare const deleteDir: (path: string, logger?: ILogger, dryRun?: boolean) => void;
|
|
12
21
|
//# sourceMappingURL=delete.d.ts.map
|
package/delete.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { unlinkSync } from "node:fs";
|
|
1
|
+
import { rmSync, unlinkSync } from "node:fs";
|
|
2
2
|
const deleteFile = (path, logger, dryRun = false) => {
|
|
3
3
|
logger && logger.info(`${dryRun ? "[dryrun] " : ""}deleting file: ${path}`);
|
|
4
4
|
if (dryRun)
|
|
5
5
|
return;
|
|
6
6
|
unlinkSync(path);
|
|
7
7
|
};
|
|
8
|
+
const deleteDir = (path, logger, dryRun = false) => {
|
|
9
|
+
logger && logger.info(`${dryRun ? "[dryrun] " : ""}deleting file: ${path}`);
|
|
10
|
+
if (dryRun)
|
|
11
|
+
return;
|
|
12
|
+
rmSync(path, { recursive: true, force: true });
|
|
13
|
+
};
|
|
8
14
|
export {
|
|
15
|
+
deleteDir,
|
|
9
16
|
deleteFile
|
|
10
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/file-io",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Assorted file I/O utils (with logging support) for NodeJS/Bun",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "yarn build:esbuild && yarn build:decl",
|
|
28
28
|
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
29
29
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
30
|
-
"clean": "
|
|
30
|
+
"clean": "bun ../../tools/src/clean-package.ts",
|
|
31
31
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
32
32
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
33
33
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
@@ -36,16 +36,15 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/hex": "^2.3.
|
|
42
|
-
"@thi.ng/logger": "^3.0.
|
|
43
|
-
"@thi.ng/random": "^3.7.
|
|
39
|
+
"@thi.ng/api": "^8.11.1",
|
|
40
|
+
"@thi.ng/checks": "^3.6.3",
|
|
41
|
+
"@thi.ng/hex": "^2.3.45",
|
|
42
|
+
"@thi.ng/logger": "^3.0.11",
|
|
43
|
+
"@thi.ng/random": "^3.7.5"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@microsoft/api-extractor": "^7.43.0",
|
|
47
47
|
"esbuild": "^0.20.2",
|
|
48
|
-
"rimraf": "^5.0.5",
|
|
49
48
|
"typedoc": "^0.25.12",
|
|
50
49
|
"typescript": "^5.4.3"
|
|
51
50
|
},
|
|
@@ -124,5 +123,5 @@
|
|
|
124
123
|
"status": "stable",
|
|
125
124
|
"year": 2022
|
|
126
125
|
},
|
|
127
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
|
|
128
127
|
}
|