starship-butler-utils 0.3.3 → 0.3.4
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/dist/index.d.ts +10 -1
- package/dist/index.js +18 -2
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -69,4 +69,13 @@ declare const highlight: {
|
|
|
69
69
|
reset: ansis0.Ansis;
|
|
70
70
|
};
|
|
71
71
|
//#endregion
|
|
72
|
-
|
|
72
|
+
//#region src/stringify.d.ts
|
|
73
|
+
/**
|
|
74
|
+
* Stringify an object to a JSON string with functions support.
|
|
75
|
+
*
|
|
76
|
+
* @param obj - The object to stringify.
|
|
77
|
+
* @returns The JSON string.
|
|
78
|
+
*/
|
|
79
|
+
declare function stringify(obj: any): string;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { fs_d_exports as fs, highlight, stringify, upsertUserRc };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __export } from "./chunk-Bp6m_JJh.js";
|
|
2
2
|
import { readUser, updateUser, writeUser } from "rc9";
|
|
3
3
|
import { constants, copyFileSync, lstatSync, mkdirSync, promises, renameSync, unlinkSync } from "node:fs";
|
|
4
|
-
import { dirname } from "node:path";
|
|
5
4
|
import consola from "consola";
|
|
5
|
+
import { dirname } from "pathe";
|
|
6
6
|
import { bold, cyan, green, magenta, red, reset } from "ansis";
|
|
7
7
|
|
|
8
8
|
//#region src/config.ts
|
|
@@ -154,4 +154,20 @@ function removeSymlink(targetPath) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
//#endregion
|
|
157
|
-
|
|
157
|
+
//#region src/stringify.ts
|
|
158
|
+
function replacer(key, value) {
|
|
159
|
+
if (typeof value === "function") return `${value.toString()}`.replace(/\s+/g, " ").replace(/"/g, "'");
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Stringify an object to a JSON string with functions support.
|
|
164
|
+
*
|
|
165
|
+
* @param obj - The object to stringify.
|
|
166
|
+
* @returns The JSON string.
|
|
167
|
+
*/
|
|
168
|
+
function stringify(obj) {
|
|
169
|
+
return JSON.stringify(obj, replacer, 2);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
export { fs_exports as fs, highlight, stringify, upsertUserRc };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starship-butler-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.4",
|
|
5
5
|
"description": "Your best starship butler.",
|
|
6
6
|
"author": "Lumirelle <shabbyacc@outlook.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"ansis": "^4.2.0",
|
|
32
32
|
"consola": "^3.4.2",
|
|
33
|
+
"pathe": "^2.0.3",
|
|
33
34
|
"rc9": "^2.1.2"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|