@dephub/write 1.0.0 → 1.0.2
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/LICENSE +1 -1
- package/README.md +0 -1
- package/dist/cli.js +19 -15
- package/dist/package.json.js +1 -1
- package/dist/utils/pkg.d.ts +1 -1
- package/dist/utils/pkg.js +4 -4
- package/package.json +20 -9
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://npmjs.org/package/@dephub/write)
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
|
-
[](https://nodejs.org/)
|
|
8
7
|
|
|
9
8
|
---
|
|
10
9
|
|
package/dist/cli.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { writeFile as
|
|
5
|
-
import { name as
|
|
6
|
-
|
|
7
|
-
const [e, i] = n;
|
|
2
|
+
import { Command as s, CommandError as a } from "@dephub/command";
|
|
3
|
+
import { logger as o } from "@dephub/logger";
|
|
4
|
+
import { writeFile as d } from "./core/write.js";
|
|
5
|
+
import { name as m, version as c, description as p } from "./utils/pkg.js";
|
|
6
|
+
const i = new s().name(m.split("/")[1] ?? "write").version(c).description(p).argument("filePath", "Path where the file will be written").argument("content", "Content to write (if not provided, reads from stdin)").handler(async ({ args: { content: r, filePath: t } }) => {
|
|
8
7
|
try {
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
8
|
+
let e = r;
|
|
9
|
+
r || (e = await f(), e || (o.error("No content provided and stdin is empty"), process.exit(1))), await d(t, e), o.success(`Written to ${t}`);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
o.error(`Failed to write to ${t}: ${e.message}`), process.exit(1);
|
|
13
12
|
}
|
|
13
|
+
}), f = () => new Promise((r, t) => {
|
|
14
|
+
let e = "";
|
|
15
|
+
process.stdin.setEncoding("utf8"), process.stdin.on("data", (n) => e += n), process.stdin.on("end", () => r(e.trim())), process.stdin.on("error", t), process.stdin.isTTY && setTimeout(() => r(""), 100);
|
|
14
16
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
try {
|
|
18
|
+
await i.run();
|
|
19
|
+
} catch (r) {
|
|
20
|
+
throw r instanceof a && (o.error(`
|
|
21
|
+
Error: ${r.message}
|
|
22
|
+
`), i.help(), process.exit(1)), r;
|
|
23
|
+
}
|
package/dist/package.json.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const t = "@dephub/write", i = "1.0.
|
|
1
|
+
const t = "@dephub/write", i = "1.0.2", o = "File writing utility with automatic directory creation for Node.js", e = {
|
|
2
2
|
name: t,
|
|
3
3
|
version: i,
|
|
4
4
|
description: o
|
package/dist/utils/pkg.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const description: string, name: string, version: string;
|
package/dist/utils/pkg.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "../package.json.js";
|
|
2
|
-
const {
|
|
2
|
+
const { description: e, name: i, version: n } = o ?? {};
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
e as description,
|
|
5
|
+
i as name,
|
|
6
|
+
n as version
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dephub/write",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "File writing utility with automatic directory creation for Node.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -34,27 +34,38 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"homepage": "https://github.com/
|
|
37
|
+
"homepage": "https://github.com/dephub-js/write#readme",
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/
|
|
41
|
-
"directory": "packages/write"
|
|
40
|
+
"url": "https://github.com/dephub-js/write.git"
|
|
42
41
|
},
|
|
43
42
|
"bugs": {
|
|
44
|
-
"url": "https://github.com/
|
|
43
|
+
"url": "https://github.com/dephub-js/write/issues"
|
|
45
44
|
},
|
|
46
45
|
"publishConfig": {
|
|
47
46
|
"access": "public"
|
|
48
47
|
},
|
|
49
48
|
"dependencies": {
|
|
50
|
-
"@dephub/
|
|
51
|
-
"@dephub/
|
|
49
|
+
"@dephub/command": "^1.0.1",
|
|
50
|
+
"@dephub/logger": "^1.2.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@dephub/eslint-ts": "^1.0.2",
|
|
54
|
+
"@dephub/glob": "^1.0.2",
|
|
55
|
+
"@dephub/path": "^1.0.2",
|
|
56
|
+
"@types/node": "^25.3.3",
|
|
57
|
+
"eslint": "^10.0.2",
|
|
58
|
+
"prettier": "^3.8.1",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"vite": "^7.3.1",
|
|
61
|
+
"vite-plugin-dts": "^4.5.4"
|
|
52
62
|
},
|
|
53
63
|
"scripts": {
|
|
54
64
|
"release": "pnpm publish",
|
|
65
|
+
"docs": "lineo md 'src/**/*.ts' --outFile code.md --outDir temp",
|
|
55
66
|
"check-types": "tsc --noEmit --skipLibCheck",
|
|
56
|
-
"lint": "
|
|
57
|
-
"
|
|
67
|
+
"lint": "eslint . --fix --max-warnings 0",
|
|
68
|
+
"fmt": "prettier --write .",
|
|
58
69
|
"clean": "rm -rf dist",
|
|
59
70
|
"build": "vite build",
|
|
60
71
|
"dev": "vite build -w --mode development"
|