@sorrell/cli-utilities 1.0.43 → 1.0.46
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/Distribution/FileSystem/FileSystem.Internal.Types.d.ts +27 -0
- package/Distribution/FileSystem/FileSystem.Internal.Types.d.ts.map +1 -0
- package/Distribution/FileSystem/FileSystem.Internal.Types.js +8 -0
- package/Distribution/FileSystem/FileSystem.Internal.Types.js.map +1 -0
- package/Distribution/FileSystem/FileSystem.Internal.d.ts +35 -0
- package/Distribution/FileSystem/FileSystem.Internal.d.ts.map +1 -0
- package/Distribution/FileSystem/FileSystem.Internal.js +178 -0
- package/Distribution/FileSystem/FileSystem.Internal.js.map +1 -0
- package/Distribution/FileSystem/FileSystem.Types.Internal.d.ts +23 -0
- package/Distribution/FileSystem/FileSystem.Types.Internal.d.ts.map +1 -0
- package/Distribution/FileSystem/FileSystem.Types.Internal.js +8 -0
- package/Distribution/FileSystem/FileSystem.Types.Internal.js.map +1 -0
- package/Distribution/FileSystem/FileSystem.Types.d.ts +21 -0
- package/Distribution/FileSystem/FileSystem.Types.d.ts.map +1 -0
- package/Distribution/FileSystem/FileSystem.Types.js +8 -0
- package/Distribution/FileSystem/FileSystem.Types.js.map +1 -0
- package/Distribution/FileSystem/FileSystem.d.ts +20 -0
- package/Distribution/FileSystem/FileSystem.d.ts.map +1 -0
- package/Distribution/FileSystem/FileSystem.js +76 -0
- package/Distribution/FileSystem/FileSystem.js.map +1 -0
- package/Distribution/FileSystem/index.d.ts +9 -0
- package/Distribution/FileSystem/index.d.ts.map +1 -0
- package/Distribution/FileSystem/index.js +9 -0
- package/Distribution/FileSystem/index.js.map +1 -0
- package/Distribution/PackageConfig/PackageConfig.d.ts.map +1 -1
- package/Distribution/PackageConfig/PackageConfig.js.map +1 -1
- package/Distribution/index.d.ts +0 -2
- package/Distribution/index.d.ts.map +1 -1
- package/Distribution/index.js +0 -2
- package/Distribution/index.js.map +1 -1
- package/ReadMe.md +17 -0
- package/package.json +11 -11
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file FileSystem.Types.Internal.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
export type FDeletePhase = "Scanning" | "Deleting" | "Done";
|
|
8
|
+
export type FDeleteEntryKind = "File" | "Directory" | "Other";
|
|
9
|
+
export type FDeleteEntry = {
|
|
10
|
+
EntryPath: string;
|
|
11
|
+
Kind: FDeleteEntryKind;
|
|
12
|
+
Size: number;
|
|
13
|
+
};
|
|
14
|
+
export type FDeleteProgress = {
|
|
15
|
+
Phase: FDeletePhase;
|
|
16
|
+
CurrentPath: string | null;
|
|
17
|
+
DiscoveredEntries: number;
|
|
18
|
+
TotalEntries: number;
|
|
19
|
+
DeletedEntries: number;
|
|
20
|
+
TotalBytes: number;
|
|
21
|
+
DeletedBytes: number;
|
|
22
|
+
};
|
|
23
|
+
export type FTerminalDeleteProgressRenderer = {
|
|
24
|
+
Update: (Progress: FDeleteProgress) => void;
|
|
25
|
+
Error: (ErrorValue: unknown) => void;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=FileSystem.Internal.Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Internal.Types.d.ts","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Internal.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,YAAY,GAClB,UAAU,GACV,UAAU,GACV,MAAM,CAAC;AAEb,MAAM,MAAM,gBAAgB,GACtB,MAAM,GACN,WAAW,GACX,OAAO,CAAC;AAEd,MAAM,MAAM,YAAY,GACpB;IACI,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEN,MAAM,MAAM,eAAe,GACvB;IACI,KAAK,EAAE,YAAY,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AAEN,MAAM,MAAM,+BAA+B,GACvC;IACI,MAAM,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,KAAK,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Internal.Types.js","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Internal.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file FileSystem.Internal.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import type { FDeleteEntry, FDeleteProgress, FTerminalDeleteProgressRenderer } from "./FileSystem.Internal.Types.js";
|
|
8
|
+
import type { FDeleteWithProgressOptions } from "./FileSystem.Types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Determines whether a given {@link ErrorValue} represents a missing file error.
|
|
11
|
+
*
|
|
12
|
+
* @param ErrorValue - The value to test.
|
|
13
|
+
*
|
|
14
|
+
* @returns {boolean} Whether the given {@link ErrorValue} is an object representing
|
|
15
|
+
* a missing file error.
|
|
16
|
+
*/
|
|
17
|
+
export declare function IsMissingFileError(ErrorValue: unknown): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Build a plan of files to delete, so that the deletion progress
|
|
20
|
+
* can be displayed to the user.
|
|
21
|
+
*
|
|
22
|
+
* @param RootPath - The root path of the files to delete.
|
|
23
|
+
* @param Progress - The {@link FDeleteProgress} object tracking the deletion.
|
|
24
|
+
* @param Options - The options for this deletion.
|
|
25
|
+
*
|
|
26
|
+
* @returns {Promise<Array<FDeleteEntry>>} The entries to delete.
|
|
27
|
+
*/
|
|
28
|
+
export declare function BuildDeletionPlan(RootPath: string, Progress: FDeleteProgress, Options: FDeleteWithProgressOptions): Promise<Array<FDeleteEntry>>;
|
|
29
|
+
export declare function CreateScanningMessage(Progress: FDeleteProgress): string;
|
|
30
|
+
export declare function CreateDeletingMessage(Progress: FDeleteProgress): string;
|
|
31
|
+
export declare function CreateDoneMessage(Progress: FDeleteProgress): string;
|
|
32
|
+
export declare function CreateErrorMessage(ErrorValue: unknown): string;
|
|
33
|
+
export declare function FormatBytes(Bytes: number): string;
|
|
34
|
+
export declare function CreateTerminalDeleteProgressRenderer(Options: FDeleteWithProgressOptions): FTerminalDeleteProgressRenderer;
|
|
35
|
+
//# sourceMappingURL=FileSystem.Internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Internal.d.ts","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACR,YAAY,EACZ,eAAe,EACf,+BAA+B,EAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAQ/D;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACnC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,0BAA0B,GACpC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAmE9B;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAGvE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAWvE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAGnE;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,CAQ9D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAajD;AAED,wBAAgB,oCAAoC,CAChD,OAAO,EAAE,0BAA0B,GACpC,+BAA+B,CAuGjC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file FileSystem.Internal.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import * as Path from "path";
|
|
8
|
+
import { progress as CreateProgress, spinner as CreateSpinner } from "@clack/prompts";
|
|
9
|
+
import { promises as Fs } from "fs";
|
|
10
|
+
/**
|
|
11
|
+
* Determines whether a given {@link ErrorValue} represents a missing file error.
|
|
12
|
+
*
|
|
13
|
+
* @param ErrorValue - The value to test.
|
|
14
|
+
*
|
|
15
|
+
* @returns {boolean} Whether the given {@link ErrorValue} is an object representing
|
|
16
|
+
* a missing file error.
|
|
17
|
+
*/
|
|
18
|
+
export function IsMissingFileError(ErrorValue) {
|
|
19
|
+
return (typeof ErrorValue === "object" &&
|
|
20
|
+
ErrorValue !== null &&
|
|
21
|
+
"code" in ErrorValue &&
|
|
22
|
+
ErrorValue.code === "ENOENT");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build a plan of files to delete, so that the deletion progress
|
|
26
|
+
* can be displayed to the user.
|
|
27
|
+
*
|
|
28
|
+
* @param RootPath - The root path of the files to delete.
|
|
29
|
+
* @param Progress - The {@link FDeleteProgress} object tracking the deletion.
|
|
30
|
+
* @param Options - The options for this deletion.
|
|
31
|
+
*
|
|
32
|
+
* @returns {Promise<Array<FDeleteEntry>>} The entries to delete.
|
|
33
|
+
*/
|
|
34
|
+
export async function BuildDeletionPlan(RootPath, Progress, Options) {
|
|
35
|
+
const Entries = [];
|
|
36
|
+
/* eslint-disable-next-line jsdoc/require-jsdoc */
|
|
37
|
+
async function Visit(CurrentPath) {
|
|
38
|
+
Options.Signal?.throwIfAborted();
|
|
39
|
+
Progress.Phase = "Scanning";
|
|
40
|
+
Progress.CurrentPath = CurrentPath;
|
|
41
|
+
Options.OnProgress?.({ ...Progress });
|
|
42
|
+
let Stats;
|
|
43
|
+
try {
|
|
44
|
+
Stats = await Fs.lstat(CurrentPath);
|
|
45
|
+
}
|
|
46
|
+
catch (ErrorValue) {
|
|
47
|
+
if (IsMissingFileError(ErrorValue)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
throw ErrorValue;
|
|
51
|
+
}
|
|
52
|
+
if (Stats.isDirectory()) {
|
|
53
|
+
const Children = await Fs.readdir(CurrentPath, { withFileTypes: true });
|
|
54
|
+
for (const Child of Children) {
|
|
55
|
+
await Visit(Path.join(CurrentPath, Child.name));
|
|
56
|
+
}
|
|
57
|
+
Entries.push({
|
|
58
|
+
EntryPath: CurrentPath,
|
|
59
|
+
Kind: "Directory",
|
|
60
|
+
Size: 0
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const Size = Stats.isFile() ? Stats.size : 0;
|
|
65
|
+
Entries.push({
|
|
66
|
+
EntryPath: CurrentPath,
|
|
67
|
+
Kind: Stats.isFile() ? "File" : "Other",
|
|
68
|
+
Size
|
|
69
|
+
});
|
|
70
|
+
Progress.TotalBytes += Size;
|
|
71
|
+
}
|
|
72
|
+
Progress.DiscoveredEntries = Entries.length;
|
|
73
|
+
Options.OnProgress?.({ ...Progress });
|
|
74
|
+
}
|
|
75
|
+
await Visit(RootPath);
|
|
76
|
+
return Entries;
|
|
77
|
+
}
|
|
78
|
+
export function CreateScanningMessage(Progress) {
|
|
79
|
+
return `Scanning... ${Progress.DiscoveredEntries} entries, ${FormatBytes(Progress.TotalBytes)} found`;
|
|
80
|
+
}
|
|
81
|
+
export function CreateDeletingMessage(Progress) {
|
|
82
|
+
const Percent = Progress.TotalEntries === 0
|
|
83
|
+
? 100
|
|
84
|
+
: (Progress.DeletedEntries / Progress.TotalEntries) * 100;
|
|
85
|
+
return (`Deleting... ${Progress.DeletedEntries}/${Progress.TotalEntries} entries ` +
|
|
86
|
+
`(${Percent.toFixed(1)}%), ` +
|
|
87
|
+
`${FormatBytes(Progress.DeletedBytes)} / ${FormatBytes(Progress.TotalBytes)}`);
|
|
88
|
+
}
|
|
89
|
+
export function CreateDoneMessage(Progress) {
|
|
90
|
+
return `Deleted ${Progress.DeletedEntries} entries, ${FormatBytes(Progress.DeletedBytes)}.`;
|
|
91
|
+
}
|
|
92
|
+
export function CreateErrorMessage(ErrorValue) {
|
|
93
|
+
if (ErrorValue instanceof Error) {
|
|
94
|
+
return `Delete failed: ${ErrorValue.message}`;
|
|
95
|
+
}
|
|
96
|
+
return "Delete failed.";
|
|
97
|
+
}
|
|
98
|
+
export function FormatBytes(Bytes) {
|
|
99
|
+
const Units = ["B", "KB", "MB", "GB", "TB"];
|
|
100
|
+
let Value = Bytes;
|
|
101
|
+
let UnitIndex = 0;
|
|
102
|
+
while (Value >= 1024 && UnitIndex < Units.length - 1) {
|
|
103
|
+
Value /= 1024;
|
|
104
|
+
UnitIndex += 1;
|
|
105
|
+
}
|
|
106
|
+
return `${Value.toFixed(UnitIndex === 0 ? 0 : 1)} ${Units[UnitIndex]}`;
|
|
107
|
+
}
|
|
108
|
+
export function CreateTerminalDeleteProgressRenderer(Options) {
|
|
109
|
+
if (Options.ShouldRenderTerminalProgress === false) {
|
|
110
|
+
return {
|
|
111
|
+
Error() {
|
|
112
|
+
return;
|
|
113
|
+
},
|
|
114
|
+
Update() {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const ScanningSpinner = CreateSpinner({ indicator: "timer" });
|
|
120
|
+
let HasStartedScanningSpinner = false;
|
|
121
|
+
let HasStoppedScanningSpinner = false;
|
|
122
|
+
let DeletionProgress = null;
|
|
123
|
+
let LastRenderedDeletedEntries = 0;
|
|
124
|
+
return {
|
|
125
|
+
Error(ErrorValue) {
|
|
126
|
+
const Message = CreateErrorMessage(ErrorValue);
|
|
127
|
+
if (DeletionProgress !== null) {
|
|
128
|
+
DeletionProgress.error(Message);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (HasStartedScanningSpinner && !HasStoppedScanningSpinner) {
|
|
132
|
+
ScanningSpinner.stop(Message);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
Update(Progress) {
|
|
136
|
+
if (Progress.Phase === "Scanning") {
|
|
137
|
+
const Message = CreateScanningMessage(Progress);
|
|
138
|
+
if (!HasStartedScanningSpinner) {
|
|
139
|
+
ScanningSpinner.start(Message);
|
|
140
|
+
HasStartedScanningSpinner = true;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
ScanningSpinner.message(Message);
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (!HasStoppedScanningSpinner) {
|
|
148
|
+
if (HasStartedScanningSpinner) {
|
|
149
|
+
ScanningSpinner.stop(`Scanned ${Progress.DiscoveredEntries} entries ` +
|
|
150
|
+
`(${FormatBytes(Progress.TotalBytes)}).`);
|
|
151
|
+
}
|
|
152
|
+
HasStoppedScanningSpinner = true;
|
|
153
|
+
}
|
|
154
|
+
if (Progress.Phase === "Deleting") {
|
|
155
|
+
if (DeletionProgress === null) {
|
|
156
|
+
DeletionProgress = CreateProgress({
|
|
157
|
+
max: Math.max(Progress.TotalEntries, 1),
|
|
158
|
+
style: "block"
|
|
159
|
+
});
|
|
160
|
+
DeletionProgress.start(CreateDeletingMessage(Progress));
|
|
161
|
+
}
|
|
162
|
+
const DeletedEntryDelta = Progress.DeletedEntries - LastRenderedDeletedEntries;
|
|
163
|
+
if (DeletedEntryDelta > 0) {
|
|
164
|
+
DeletionProgress.advance(DeletedEntryDelta, CreateDeletingMessage(Progress));
|
|
165
|
+
LastRenderedDeletedEntries = Progress.DeletedEntries;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
DeletionProgress.message(CreateDeletingMessage(Progress));
|
|
169
|
+
}
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (DeletionProgress !== null) {
|
|
173
|
+
DeletionProgress.stop(CreateDoneMessage(Progress));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=FileSystem.Internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Internal.js","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,OAAO,IAAI,aAAa,EAAsB,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAe,QAAQ,IAAI,EAAE,EAAc,MAAM,IAAI,CAAC;AAQ7D;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAmB;IAElD,OAAO,CACH,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,MAAM,IAAI,UAAU;QACpB,UAAU,CAAC,IAAI,KAAK,QAAQ,CAC/B,CAAC;AACN,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,QAAgB,EAChB,QAAyB,EACzB,OAAmC;IAGnC,MAAM,OAAO,GAAwB,EAAG,CAAC;IAEzC,kDAAkD;IAClD,KAAK,UAAU,KAAK,CAAC,WAAmB;QAEpC,OAAO,C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B,GAAG,QAAQ,CAAC,cAAc,CAAC;gBACzD,CAAC;qBAED,CAAC;oBACG,gBAAgB,CAAC,OAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC9D,CAAC;gBAED,OAAO;YACX,CAAC;YAED,IAAI,gBAAgB,KAAK,IAAI,EAC7B,CAAC;gBACG,gBAAgB,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;YACvD,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file FileSystem.Types.Internal.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
export type FDeletePhase = "Scanning" | "Deleting" | "Done";
|
|
8
|
+
export type FDeleteEntryKind = "File" | "Directory" | "Other";
|
|
9
|
+
export type FDeleteEntry = {
|
|
10
|
+
EntryPath: string;
|
|
11
|
+
Kind: FDeleteEntryKind;
|
|
12
|
+
Size: number;
|
|
13
|
+
};
|
|
14
|
+
export type FDeleteProgress = {
|
|
15
|
+
Phase: FDeletePhase;
|
|
16
|
+
CurrentPath: string | null;
|
|
17
|
+
DiscoveredEntries: number;
|
|
18
|
+
TotalEntries: number;
|
|
19
|
+
DeletedEntries: number;
|
|
20
|
+
TotalBytes: number;
|
|
21
|
+
DeletedBytes: number;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=FileSystem.Types.Internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Types.Internal.d.ts","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Types.Internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,YAAY,GAClB,UAAU,GACV,UAAU,GACV,MAAM,CAAC;AAEb,MAAM,MAAM,gBAAgB,GACtB,MAAM,GACN,WAAW,GACX,OAAO,CAAC;AAEd,MAAM,MAAM,YAAY,GACpB;IACI,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEN,MAAM,MAAM,eAAe,GACvB;IACI,KAAK,EAAE,YAAY,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Types.Internal.js","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Types.Internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file FileSystem.Types.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import type { FDeleteProgress } from "./FileSystem.Internal.Types.js";
|
|
8
|
+
import type { TFunction } from "@sorrell/utilities/functional";
|
|
9
|
+
/**
|
|
10
|
+
* @property {TFunction<FDeleteProgress>} OnProgress - The callback that is called
|
|
11
|
+
* upon deleting files.
|
|
12
|
+
* @property {boolean} ShouldRenderTerminalProgress - Should the progress be rendered
|
|
13
|
+
* in the terminal (default is `true`).
|
|
14
|
+
* @property {AbortSignal} Signal - A signal to abort the deletion.
|
|
15
|
+
*/
|
|
16
|
+
export type FDeleteWithProgressOptions = {
|
|
17
|
+
OnProgress?: TFunction<FDeleteProgress>;
|
|
18
|
+
ShouldRenderTerminalProgress?: boolean;
|
|
19
|
+
Signal?: AbortSignal;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=FileSystem.Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Types.d.ts","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAClC;IACI,UAAU,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IACxC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,MAAM,CAAC,EAAE,WAAW,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.Types.js","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file FileSystem.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import type { FDeleteWithProgressOptions } from "./FileSystem.Types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Recursively delete a given {@link RootPath}, and display the progress in
|
|
10
|
+
* the terminal.
|
|
11
|
+
*
|
|
12
|
+
* @param RootPath - The path to recursively delete.
|
|
13
|
+
* @param Options - The {@link FDeleteWithProgressOptions} object specifying
|
|
14
|
+
* options for this deletion.
|
|
15
|
+
*
|
|
16
|
+
* @returns {Promise<void>} The {@link Promise} that is fulfilled upon the deletion
|
|
17
|
+
* of the given {@link RootPath}.
|
|
18
|
+
*/
|
|
19
|
+
export declare function DeleteWithProgress(RootPath: string, Options?: FDeleteWithProgressOptions): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=FileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAKxE;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,0BAAgC,GAC1C,OAAO,CAAC,IAAI,CAAC,CA4Ef"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file FileSystem.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import { BuildDeletionPlan, CreateTerminalDeleteProgressRenderer, IsMissingFileError } from "./FileSystem.Internal.js";
|
|
8
|
+
import { promises as Fs } from "fs";
|
|
9
|
+
/* eslint-disable jsdoc/require-example */
|
|
10
|
+
/**
|
|
11
|
+
* Recursively delete a given {@link RootPath}, and display the progress in
|
|
12
|
+
* the terminal.
|
|
13
|
+
*
|
|
14
|
+
* @param RootPath - The path to recursively delete.
|
|
15
|
+
* @param Options - The {@link FDeleteWithProgressOptions} object specifying
|
|
16
|
+
* options for this deletion.
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<void>} The {@link Promise} that is fulfilled upon the deletion
|
|
19
|
+
* of the given {@link RootPath}.
|
|
20
|
+
*/
|
|
21
|
+
export async function DeleteWithProgress(RootPath, Options = {}) {
|
|
22
|
+
const TerminalProgressRenderer = CreateTerminalDeleteProgressRenderer(Options);
|
|
23
|
+
const ProgressOptions = {
|
|
24
|
+
...Options,
|
|
25
|
+
OnProgress(Progress) {
|
|
26
|
+
TerminalProgressRenderer.Update(Progress);
|
|
27
|
+
Options.OnProgress?.({ ...Progress });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const Progress = {
|
|
31
|
+
CurrentPath: null,
|
|
32
|
+
DeletedBytes: 0,
|
|
33
|
+
DeletedEntries: 0,
|
|
34
|
+
DiscoveredEntries: 0,
|
|
35
|
+
Phase: "Scanning",
|
|
36
|
+
TotalBytes: 0,
|
|
37
|
+
TotalEntries: 0
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
const Entries = await BuildDeletionPlan(RootPath, Progress, ProgressOptions);
|
|
41
|
+
Progress.Phase = "Deleting";
|
|
42
|
+
Progress.TotalEntries = Entries.length;
|
|
43
|
+
Progress.CurrentPath = null;
|
|
44
|
+
ProgressOptions.OnProgress?.({ ...Progress });
|
|
45
|
+
for (const Entry of Entries) {
|
|
46
|
+
ProgressOptions.Signal?.throwIfAborted();
|
|
47
|
+
Progress.CurrentPath = Entry.EntryPath;
|
|
48
|
+
ProgressOptions.OnProgress?.({ ...Progress });
|
|
49
|
+
try {
|
|
50
|
+
if (Entry.Kind === "Directory") {
|
|
51
|
+
await Fs.rmdir(Entry.EntryPath);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
await Fs.unlink(Entry.EntryPath);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (ErrorValue) {
|
|
58
|
+
if (!IsMissingFileError(ErrorValue)) {
|
|
59
|
+
throw ErrorValue;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
Progress.DeletedEntries += 1;
|
|
63
|
+
Progress.DeletedBytes += Entry.Size;
|
|
64
|
+
ProgressOptions.OnProgress?.({ ...Progress });
|
|
65
|
+
}
|
|
66
|
+
Progress.Phase = "Done";
|
|
67
|
+
Progress.CurrentPath = null;
|
|
68
|
+
ProgressOptions.OnProgress?.({ ...Progress });
|
|
69
|
+
}
|
|
70
|
+
catch (ErrorValue) {
|
|
71
|
+
TerminalProgressRenderer.Error(ErrorValue);
|
|
72
|
+
throw ErrorValue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/* eslint-enable jsdoc/require-example */
|
|
76
|
+
//# sourceMappingURL=FileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../Source/FileSystem/FileSystem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACH,iBAAiB,EACjB,oCAAoC,EACpC,kBAAkB,EACrB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC,0CAA0C;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACpC,QAAgB,EAChB,UAAsC,EAAG;IAGzC,MAAM,wBAAwB,GAC1B,oCAAoC,CAAC,OAAO,CAAC,CAAC;IAElD,MAAM,eAAe,GACjB;QACI,GAAG,OAAO;QACV,UAAU,CAAC,QAAyB;YAEhC,wBAAwB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1C,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;QAC1C,CAAC;KACJ,CAAC;IAEN,MAAM,QAAQ,GACV;QACI,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,CAAC;QACjB,iBAAiB,EAAE,CAAC;QACpB,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;KAClB,CAAC;IAEN,IACA,CAAC;QACG,MAAM,OAAO,GAAwB,MAAM,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QAElG,QAAQ,CAAC,KAAK,GAAG,UAAU,CAAC;QAC5B,QAAQ,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;QACvC,QAAQ,CAAC,WAAW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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Source/FileSystem/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Source/FileSystem/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageConfig.d.ts","sourceRoot":"","sources":["../../Source/PackageConfig/PackageConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAmC,cAAc,IAAI,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AACjG,OAAO,KAAK,EAAyB,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGhG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAC1B,YAAY,SAAS,eAAe,EACpC,WAAW,EAEX,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,EAAE,KAAK,CAAC,EAC/D,eAAe,CAAC,EAAE,GAAI,MAAO,OAAO,GACrC,oBAAoB,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"PackageConfig.d.ts","sourceRoot":"","sources":["../../Source/PackageConfig/PackageConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAmC,cAAc,IAAI,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AACjG,OAAO,KAAK,EAAyB,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGhG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAC1B,YAAY,SAAS,eAAe,EACpC,WAAW,EAEX,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,EAAE,KAAK,CAAC,EAC/D,eAAe,CAAC,EAAE,GAAI,MAAO,OAAO,GACrC,oBAAoB,CAAC,cAAc,CAgDrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageConfig.js","sourceRoot":"","sources":["../../Source/PackageConfig/PackageConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,cAAc,CAI1B,WAAmB,EACnB,cAA+D,EAC/D,eAAoC;IAGpC,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"PackageConfig.js","sourceRoot":"","sources":["../../Source/PackageConfig/PackageConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,cAAc,CAI1B,WAAmB,EACnB,cAA+D,EAC/D,eAAoC;IAGpC,MAAM,oBAAoB,GACtB,2BAA2B,CACvB,WAAW,EACX,cAAc,EACd,eAAe,CAClB,CAAC;IAEN,OAAO,oBAAoB,CAAC,IAAI,CAC5B;QACI,IAAI,EAAE,CAAQ,aAAmC,EAAE,EAAE;YAEjD,OAAO,oBAAoB,CAAC,IAAI,CAC5B,MAAM,CAAC,OAAO,CAAC,CAAC,QAA6C,EAAE,EAAE,CAC7D,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CACpC,CAAC;QACN,CAAC;QAED,SAAS,EAAE,oBAAoB,CAAC,QAAQ,CACpC;YACI,KAAK,EAAE,uBAAuB,CAAC,KAAK;YAEpC,IAAI,EAAE,CACF,YAAmC,EACnC,aAA6C,EAC7C,KAAc,EAChB,EAAE;gBAEA,OAAO,oBAAoB,CAAC,IAAI,CAC5B,MAAM,CAAC,OAAO,CAAC,CAAC,QAA6C,EAAE,EAAE,CAC7D,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,CAC9D,CACJ,CAAC;YACN,CAAC;YAED,iBAAiB,EAAE,CAAC,YAAmC,EAAE,EAAE;gBAEvD,OAAO,oBAAoB,CAAC,IAAI,CAC5B,MAAM,CAAC,OAAO,CAAC,CAAC,QAA6C,EAAE,EAAE,CAC7D,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC,YAAY,CAAC,CACrD,CACJ,CAAC;YACN,CAAC;SACJ,CACJ;KACJ,CACJ,CAAC;AACN,CAAC"}
|
package/Distribution/index.d.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
* @copyright (c) 2026 Gage Sorrell
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
export * from "./Inquirer/Confirm.js";
|
|
8
7
|
export * as Command from "./Command/index.js";
|
|
9
8
|
export * as Listr from "./Listr/index.js";
|
|
10
|
-
export * as Inquirer from "./Inquirer/index.js";
|
|
11
9
|
export * as PseudoTerminal from "./PseudoTerminal/index.js";
|
|
12
10
|
export * as Format from "./Format/index.js";
|
|
13
11
|
export * as Ora from "./Ora/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
|
package/Distribution/index.js
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
* @copyright (c) 2026 Gage Sorrell
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
export * from "./Inquirer/Confirm.js";
|
|
8
7
|
export * as Command from "./Command/index.js";
|
|
9
8
|
export * as Listr from "./Listr/index.js";
|
|
10
|
-
export * as Inquirer from "./Inquirer/index.js";
|
|
11
9
|
export * as PseudoTerminal from "./PseudoTerminal/index.js";
|
|
12
10
|
export * as Format from "./Format/index.js";
|
|
13
11
|
export * as Ora from "./Ora/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
|
package/ReadMe.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
*Copyright © 2026 Gage Sorrell. Released under the [MIT license](./License.md).*
|
|
2
|
+
|
|
3
|
+
# `@sorrell/cli-utilities`
|
|
4
|
+
|
|
5
|
+
**Purpose.** General-purpose utilities for CLI applications, written in TypeScript.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
In your NodeJS project,
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @sorrell/cli-utilities
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
`@TODO` [Documentation is available here.](https://link.sorrell.sh/cli-utils)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sorrell/cli-utilities",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Utilities
|
|
3
|
+
"version": "1.0.46",
|
|
4
|
+
"description": "Utilities developing CLI tools with TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
7
|
"utility",
|
|
@@ -40,6 +40,12 @@
|
|
|
40
40
|
"require": "./Distribution/Format/index.js",
|
|
41
41
|
"types": "./Distribution/Format/index.d.ts"
|
|
42
42
|
},
|
|
43
|
+
"./fs": {
|
|
44
|
+
"default": "./Distribution/FileSystem/index.js",
|
|
45
|
+
"import": "./Distribution/FileSystem/index.js",
|
|
46
|
+
"require": "./Distribution/FileSystem/index.js",
|
|
47
|
+
"types": "./Distribution/FileSystem/index.d.ts"
|
|
48
|
+
},
|
|
43
49
|
"./inquirer": {
|
|
44
50
|
"default": "./Distribution/Inquirer/index.js",
|
|
45
51
|
"import": "./Distribution/Inquirer/index.js",
|
|
@@ -65,24 +71,18 @@
|
|
|
65
71
|
"types": "./Distribution/PseudoTerminal/index.d.ts"
|
|
66
72
|
}
|
|
67
73
|
},
|
|
68
|
-
"main": "./Distribution/index.js",
|
|
69
|
-
"types": "./Distribution/index.d.ts",
|
|
70
74
|
"scripts": {
|
|
71
75
|
"build": "tsc -p tsconfig.json"
|
|
72
76
|
},
|
|
73
77
|
"devDependencies": {
|
|
74
|
-
"@types/node": "^
|
|
75
|
-
"@typescript/native-preview": "^7.0.0-dev.20260326.1",
|
|
78
|
+
"@types/node": "^24.12.2",
|
|
76
79
|
"package-json-type": "^1.1.2"
|
|
77
80
|
},
|
|
78
81
|
"dependencies": {
|
|
82
|
+
"@clack/prompts": "^1.4.0",
|
|
79
83
|
"@effect/platform": "^0.96.0",
|
|
80
|
-
"@inquirer/core": "^11.1.7",
|
|
81
|
-
"@inquirer/prompts": "^8.3.2",
|
|
82
|
-
"@inquirer/type": "^4.0.4",
|
|
83
84
|
"@listr2/prompt-adapter-enquirer": "^4.2.1",
|
|
84
|
-
"@sorrell/
|
|
85
|
-
"@sorrell/utilities": "^1.1.60",
|
|
85
|
+
"@sorrell/utilities": "^1.2.4",
|
|
86
86
|
"chalk": "^5.6.2",
|
|
87
87
|
"cli-table3": "^0.6.5",
|
|
88
88
|
"clipboardy": "^5.3.1",
|