tnp-core 18.0.43 → 18.0.44
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/esm2022/lib/helpers.mjs +23 -28
- package/browser/esm2022/lib/utils.mjs +498 -1
- package/browser/fesm2022/tnp-core.mjs +638 -134
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/lib/helpers.d.ts +5 -3
- package/browser/lib/utils.d.ts +117 -0
- package/cli.backend.d.ts +1 -0
- package/cli.backend.js +2 -2
- package/client/esm2022/lib/helpers.mjs +23 -28
- package/client/esm2022/lib/utils.mjs +498 -1
- package/client/fesm2022/tnp-core.mjs +638 -134
- package/client/fesm2022/tnp-core.mjs.map +1 -1
- package/client/lib/helpers.d.ts +5 -3
- package/client/lib/utils.d.ts +117 -0
- package/lib/helpers.d.ts +17 -6
- package/lib/helpers.js +156 -172
- package/lib/helpers.js.map +1 -1
- package/lib/node-chalk-mock.d.ts +1 -2
- package/lib/node-chalk-mock.js +2 -2
- package/lib/node-path-mock.d.ts +1 -25
- package/lib/node-path-mock.js +2 -2
- package/lib/utils.d.ts +121 -9
- package/lib/utils.js +580 -1
- package/lib/utils.js.map +1 -1
- package/package.json +2 -2
- package/tmp-environment.json +30 -29
- package/websql/esm2022/lib/helpers.mjs +23 -28
- package/websql/esm2022/lib/utils.mjs +498 -1
- package/websql/fesm2022/tnp-core.mjs +726 -222
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/lib/helpers.d.ts +5 -3
- package/websql/lib/utils.d.ts +117 -0
package/client/lib/helpers.d.ts
CHANGED
@@ -32,6 +32,9 @@ export declare class HelpersCore extends HelpersMessages {
|
|
32
32
|
* @deprecated use UtilsOs.isRunningInLinuxGraphicEnvironment
|
33
33
|
*/
|
34
34
|
isRunningInLinuxGraphicsCapableEnvironment(): boolean;
|
35
|
+
/**
|
36
|
+
* @deprecated use UtilsTerminal.clearConsole
|
37
|
+
*/
|
35
38
|
clearConsole(): void;
|
36
39
|
/**
|
37
40
|
* get electron browser ipc renderer
|
@@ -152,11 +155,10 @@ export declare class HelpersCore extends HelpersMessages {
|
|
152
155
|
*/
|
153
156
|
unitlOutputContains(stdoutMsg: string | string[], stderMsg?: string | string[], timeout?: number, stdoutOutputContainsCallback?: () => any): any;
|
154
157
|
};
|
155
|
-
questionYesNo(message: string, callbackTrue?: () => any, callbackFalse?: () => any, defaultValue?: boolean,
|
156
158
|
/**
|
157
|
-
*
|
159
|
+
* @deprecated use UtilsTerminal.confirm
|
158
160
|
*/
|
159
|
-
|
161
|
+
questionYesNo(message: string, callbackTrue?: () => any, callbackFalse?: () => any, defaultValue?: boolean): Promise<any>;
|
160
162
|
/**
|
161
163
|
* Quick fix for object values
|
162
164
|
* @deprecated
|
package/client/lib/utils.d.ts
CHANGED
@@ -184,6 +184,27 @@ export declare namespace UtilsOs {
|
|
184
184
|
const isRunningInWsl: () => boolean;
|
185
185
|
const isRunningInDocker: () => boolean;
|
186
186
|
const isRunningInLinuxGraphicsCapableEnvironment: () => boolean;
|
187
|
+
/**
|
188
|
+
* Check whether the current process is running in CLI mode.
|
189
|
+
*/
|
190
|
+
const isRunningInCliMode: () => boolean;
|
191
|
+
/**
|
192
|
+
* Check whether the current process is running in mocha test.
|
193
|
+
*/
|
194
|
+
const isRunningInMochaTest: () => boolean;
|
195
|
+
/**
|
196
|
+
* Checks if a given port is already in use (bound by another process).
|
197
|
+
*
|
198
|
+
* @param port - The port number to check.
|
199
|
+
* @param host - The hostname or IP address to bind to (default: '127.0.0.1').
|
200
|
+
* @returns Promise<boolean> - Resolves to `true` if the port is in use, otherwise `false`.
|
201
|
+
*/
|
202
|
+
const isPortInUse: (port: number, options?: {
|
203
|
+
/**
|
204
|
+
* '127.0.0.1' etc..
|
205
|
+
*/
|
206
|
+
checkForSpecificOnlyHost?: string;
|
207
|
+
}) => Promise<boolean>;
|
187
208
|
}
|
188
209
|
export declare namespace UtilsString {
|
189
210
|
const kebabCaseNoSplitNumbers: (input: string) => string;
|
@@ -196,4 +217,100 @@ export declare namespace UtilsMigrations {
|
|
196
217
|
const getFormattedTimestampFromClassName: (className: string) => string | undefined;
|
197
218
|
const formatTimestamp: (timestamp: number) => string;
|
198
219
|
const isValidTimestamp: (value: any) => boolean;
|
220
|
+
}
|
221
|
+
export declare namespace UtilsTerminal {
|
222
|
+
export const clearConsole: () => void;
|
223
|
+
export const multiselect: <T = string>(options: {
|
224
|
+
question: string;
|
225
|
+
/**
|
226
|
+
* If true, then only one choice can be selected
|
227
|
+
*/
|
228
|
+
onlyOneChoice?: boolean;
|
229
|
+
choices: {
|
230
|
+
name: string;
|
231
|
+
value: T;
|
232
|
+
}[] | {
|
233
|
+
[choice: string]: {
|
234
|
+
name: string;
|
235
|
+
};
|
236
|
+
};
|
237
|
+
autocomplete?: boolean;
|
238
|
+
defaultSelected?: string[];
|
239
|
+
}) => Promise<T[]>;
|
240
|
+
type SelectActionChoice = {
|
241
|
+
[choice: string]: {
|
242
|
+
/**
|
243
|
+
* Title of the choice
|
244
|
+
*/
|
245
|
+
name: string;
|
246
|
+
/**
|
247
|
+
* Action to execute
|
248
|
+
*/
|
249
|
+
action?: () => any;
|
250
|
+
};
|
251
|
+
};
|
252
|
+
/**
|
253
|
+
* Similar to select but executes action if provided
|
254
|
+
* @returns selected and executed value
|
255
|
+
*/
|
256
|
+
export const selectActionAndExecute: <CHOICE extends SelectActionChoice = SelectActionChoice>(choices: CHOICE, options?: {
|
257
|
+
question?: string;
|
258
|
+
autocomplete?: boolean;
|
259
|
+
defaultSelected?: string;
|
260
|
+
hint?: string;
|
261
|
+
executeActionOnDefault?: boolean;
|
262
|
+
}) => Promise<any>;
|
263
|
+
export const select: <T = string>(options: {
|
264
|
+
question: string;
|
265
|
+
choices: {
|
266
|
+
name: string;
|
267
|
+
value: T;
|
268
|
+
}[] | {
|
269
|
+
[choice: string]: {
|
270
|
+
name: string;
|
271
|
+
};
|
272
|
+
};
|
273
|
+
autocomplete?: boolean;
|
274
|
+
defaultSelected?: string;
|
275
|
+
hint?: string;
|
276
|
+
}) => Promise<T>;
|
277
|
+
export const pipeEnterToStdin: () => void;
|
278
|
+
export const input: ({ defaultValue, question, required, }: {
|
279
|
+
defaultValue?: string;
|
280
|
+
question: string;
|
281
|
+
required?: boolean;
|
282
|
+
validate?: (value: string) => boolean;
|
283
|
+
}) => Promise<string>;
|
284
|
+
export const confirm: (options?: {
|
285
|
+
/**
|
286
|
+
* default: Are you sure?
|
287
|
+
*/
|
288
|
+
message?: string;
|
289
|
+
callbackTrue?: () => any;
|
290
|
+
callbackFalse?: () => any;
|
291
|
+
/**
|
292
|
+
* default: true
|
293
|
+
*/
|
294
|
+
defaultValue?: boolean;
|
295
|
+
engine?: "inquirer-toggle" | "prompts" | "enquirer" | "@inquirer/prompts";
|
296
|
+
}) => Promise<any>;
|
297
|
+
export const pressAnyKeyToContinueAsync: (options?: {
|
298
|
+
message?: string;
|
299
|
+
}) => Promise<void>;
|
300
|
+
/**
|
301
|
+
* @deprecated use UtilsTerminal.pressAnyKeyToContinueAsync()
|
302
|
+
*/
|
303
|
+
export const pressAnyKey: (options?: {
|
304
|
+
message?: string;
|
305
|
+
}) => any;
|
306
|
+
export const previewLongList: (list: string | string[], listName?: string) => Promise<void>;
|
307
|
+
/**
|
308
|
+
* Displays a long list in the console using a pager like `less`.
|
309
|
+
* Returns a Promise that resolves when the user exits the pager.
|
310
|
+
*
|
311
|
+
* @param {string} list - The long string content to display.
|
312
|
+
* @returns {Promise<void>} A Promise that resolves when the pager exits.
|
313
|
+
*/
|
314
|
+
export const previewLongListGitLogLike: (list: string | string[]) => Promise<void>;
|
315
|
+
export {};
|
199
316
|
}
|
package/lib/helpers.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { child_process } from './core-imports';
|
2
|
+
import { Blob } from 'buffer';
|
2
3
|
import { HelpersMessages } from './helpers-messages';
|
3
4
|
import { CoreModels } from './core-models';
|
4
5
|
import { ipcRenderer, webFrame } from 'electron';
|
5
6
|
import type { ChildProcess } from 'child_process';
|
6
|
-
import { Blob } from 'buffer';
|
7
7
|
export interface RunSyncOrAsyncOptions {
|
8
8
|
functionFn: Function;
|
9
9
|
context?: object;
|
@@ -21,8 +21,17 @@ export declare class HelpersCore extends HelpersMessages {
|
|
21
21
|
static get InstanceCore(): HelpersCore;
|
22
22
|
readonly processes: ChildProcess[];
|
23
23
|
readonly bigMaxBuffer: number;
|
24
|
+
/**
|
25
|
+
* @deprecated use UtilsOs
|
26
|
+
*/
|
24
27
|
get isRunningIn(): {
|
28
|
+
/**
|
29
|
+
* @deprecated use UtilsOs.isRunningInMochaTest()
|
30
|
+
*/
|
25
31
|
mochaTest(): boolean;
|
32
|
+
/**
|
33
|
+
* @deprecated use UtilsOs.isRunningInCliMode()
|
34
|
+
*/
|
26
35
|
cliMode(): boolean;
|
27
36
|
};
|
28
37
|
constructor();
|
@@ -38,6 +47,9 @@ export declare class HelpersCore extends HelpersMessages {
|
|
38
47
|
* @deprecated use UtilsOs.isRunningInLinuxGraphicEnvironment
|
39
48
|
*/
|
40
49
|
isRunningInLinuxGraphicsCapableEnvironment(): boolean;
|
50
|
+
/**
|
51
|
+
* @deprecated use UtilsTerminal.clearConsole
|
52
|
+
*/
|
41
53
|
clearConsole(): void;
|
42
54
|
/**
|
43
55
|
* get electron browser ipc renderer
|
@@ -163,7 +175,7 @@ export declare class HelpersCore extends HelpersMessages {
|
|
163
175
|
* start command as asynchronous nodej proces
|
164
176
|
* @param detach (default: false) - if true process will be detached
|
165
177
|
*/
|
166
|
-
async(detach?: boolean
|
178
|
+
async(detach?: boolean): ChildProcess;
|
167
179
|
/**
|
168
180
|
* start command as asynchronous nodej proces inside promise
|
169
181
|
*/
|
@@ -182,11 +194,10 @@ export declare class HelpersCore extends HelpersMessages {
|
|
182
194
|
*/
|
183
195
|
unitlOutputContains(stdoutMsg: string | string[], stderMsg?: string | string[], timeout?: number, stdoutOutputContainsCallback?: () => any): Promise<any>;
|
184
196
|
};
|
185
|
-
questionYesNo(message: string, callbackTrue?: () => any, callbackFalse?: () => any, defaultValue?: boolean,
|
186
197
|
/**
|
187
|
-
*
|
198
|
+
* @deprecated use UtilsTerminal.confirm
|
188
199
|
*/
|
189
|
-
|
200
|
+
questionYesNo(message: string, callbackTrue?: () => any, callbackFalse?: () => any, defaultValue?: boolean): Promise<boolean>;
|
190
201
|
getStdio(options?: CoreModels.RunOptions): any;
|
191
202
|
runSyncIn(command: string, options?: CoreModels.RunOptions): string;
|
192
203
|
runAsyncIn(command: string, options?: CoreModels.RunOptions): child_process.ChildProcess;
|
@@ -266,4 +277,4 @@ export declare class HelpersCore extends HelpersMessages {
|
|
266
277
|
filesFrom(pathToFolder: string | string[], recrusive?: boolean, incudeUnexistedLinks?: boolean): string[];
|
267
278
|
openFolderInFileExploer(folderPath: string): void;
|
268
279
|
hideNodeWarnings(): void;
|
269
|
-
}
|
280
|
+
}
|