@nu-art/commando 0.300.7 → 0.400.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/cli-params/CLIParamsResolver.d.ts +1 -1
- package/cli-params/CLIParamsResolver.js +30 -31
- package/cli-params/CLIParamsResolver.js.map +1 -0
- package/cli-params/consts.d.ts +1 -1
- package/cli-params/consts.js +11 -15
- package/cli-params/consts.js.map +1 -0
- package/cli-params/types.d.ts +1 -0
- package/cli-params/types.js +2 -2
- package/cli-params/types.js.map +1 -0
- package/package.json +17 -13
- package/shell/core/BaseCommando.d.ts +2 -2
- package/shell/core/BaseCommando.js +12 -14
- package/shell/core/BaseCommando.js.map +1 -0
- package/shell/core/CliError.js +10 -8
- package/shell/core/CliError.js.map +1 -0
- package/shell/core/CommandBuilder.js +41 -40
- package/shell/core/CommandBuilder.js.map +1 -0
- package/shell/core/CommandoPool.d.ts +9 -0
- package/shell/core/CommandoPool.js +15 -0
- package/shell/core/CommandoPool.js.map +1 -0
- package/shell/core/class-merger.js +3 -6
- package/shell/core/class-merger.js.map +1 -0
- package/shell/index.d.ts +2 -2
- package/shell/index.js +3 -18
- package/shell/index.js.map +1 -0
- package/shell/interactive/CommandoInteractive.d.ts +12 -15
- package/shell/interactive/CommandoInteractive.js +88 -72
- package/shell/interactive/CommandoInteractive.js.map +1 -0
- package/shell/interactive/InteractiveShell.d.ts +14 -16
- package/shell/interactive/InteractiveShell.js +135 -88
- package/shell/interactive/InteractiveShell.js.map +1 -0
- package/shell/plugins/basic.d.ts +2 -2
- package/shell/plugins/basic.js +8 -11
- package/shell/plugins/basic.js.map +1 -0
- package/shell/plugins/git.d.ts +3 -3
- package/shell/plugins/git.js +30 -36
- package/shell/plugins/git.js.map +1 -0
- package/shell/plugins/nvm.d.ts +3 -3
- package/shell/plugins/nvm.js +22 -28
- package/shell/plugins/nvm.js.map +1 -0
- package/shell/plugins/pnpm.d.ts +4 -4
- package/shell/plugins/pnpm.js +8 -11
- package/shell/plugins/pnpm.js.map +1 -0
- package/shell/plugins/programming.d.ts +2 -2
- package/shell/plugins/programming.js +3 -6
- package/shell/plugins/programming.js.map +1 -0
- package/shell/plugins/python.d.ts +3 -3
- package/shell/plugins/python.js +9 -12
- package/shell/plugins/python.js.map +1 -0
- package/shell/services/nvm.d.ts +1 -1
- package/shell/services/nvm.js +62 -88
- package/shell/services/nvm.js.map +1 -0
- package/shell/services/pnpm.d.ts +3 -3
- package/shell/services/pnpm.js +54 -56
- package/shell/services/pnpm.js.map +1 -0
- package/shell/simple/Commando.d.ts +2 -2
- package/shell/simple/Commando.js +15 -18
- package/shell/simple/Commando.js.map +1 -0
- package/shell/simple/SimpleShell.js +34 -33
- package/shell/simple/SimpleShell.js.map +1 -0
- package/shell/tools.js +4 -30
- package/shell/tools.js.map +1 -0
- package/shell/types.d.ts +1 -1
- package/shell/types.js +2 -2
- package/shell/types.js.map +1 -0
- package/console/ConsoleContainer.d.ts +0 -89
- package/console/ConsoleContainer.js +0 -145
- package/console/ConsoleScreen.d.ts +0 -21
- package/console/ConsoleScreen.js +0 -21
- package/console/types.d.ts +0 -61
- package/console/types.js +0 -72
- package/tsconfig.json +0 -23
package/shell/services/pnpm.js
CHANGED
|
@@ -1,59 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Cli_PNPM extends ts_common_1.Logger {
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { Logger, LogLevel } from '@nu-art/ts-common';
|
|
3
|
+
import { convertToFullPath } from '../tools.js';
|
|
4
|
+
export class Cli_PNPM extends Logger {
|
|
5
|
+
_expectedVersion = '10.7.0';
|
|
6
|
+
_homeEnvVar = 'PNPM_HOME';
|
|
8
7
|
constructor() {
|
|
9
8
|
super();
|
|
10
|
-
this.
|
|
11
|
-
this._homeEnvVar = 'PNPM_HOME';
|
|
12
|
-
this.install = async (commando) => {
|
|
13
|
-
if (this.isInstalled()) {
|
|
14
|
-
const version = (await commando.getVersion());
|
|
15
|
-
if (this._expectedVersion === version)
|
|
16
|
-
return;
|
|
17
|
-
await this.uninstall();
|
|
18
|
-
}
|
|
19
|
-
this.logDebug(`installing PNPM version ${this._expectedVersion}`);
|
|
20
|
-
await commando.install(this._expectedVersion);
|
|
21
|
-
return this;
|
|
22
|
-
};
|
|
23
|
-
this.isInstalled = () => !!process.env[this._homeEnvVar];
|
|
24
|
-
this.installPackages = async (commando) => {
|
|
25
|
-
return await commando.installPackages();
|
|
26
|
-
};
|
|
27
|
-
this.uninstall = async () => {
|
|
28
|
-
this.logDebug('Uninstalling PNPM');
|
|
29
|
-
const absolutePathToPNPM_Home = process.env[this._homeEnvVar];
|
|
30
|
-
if (!absolutePathToPNPM_Home)
|
|
31
|
-
return;
|
|
32
|
-
return fs_1.promises.rm(absolutePathToPNPM_Home, { recursive: true, force: true });
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Asynchronously creates a workspace file with a list of packages.
|
|
36
|
-
* Each package is listed under the 'packages:' section in the file.
|
|
37
|
-
*
|
|
38
|
-
* @param listOfLibs An array of library names to include in the workspace.
|
|
39
|
-
* @param pathToWorkspaceFile The filesystem path where the workspace file will be written.
|
|
40
|
-
* @example
|
|
41
|
-
* await createWorkspace(['pack1', 'pack2'], './path/to/workspace.yaml');
|
|
42
|
-
*/
|
|
43
|
-
this.createWorkspace = async (listOfLibs, pathToWorkspaceFile = (0, tools_1.convertToFullPath)('./pnpm-workspace.yaml')) => {
|
|
44
|
-
try {
|
|
45
|
-
let workspace = 'packages:\n';
|
|
46
|
-
listOfLibs.forEach(lib => {
|
|
47
|
-
workspace += ` - '${lib}'\n`;
|
|
48
|
-
});
|
|
49
|
-
await fs_1.promises.writeFile(pathToWorkspaceFile, workspace, 'utf8');
|
|
50
|
-
this.logDebug(`Workspace file created at ${pathToWorkspaceFile}`);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
this.logError('Failed to create workspace file:', error);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
this.setMinLevel(ts_common_1.LogLevel.Verbose);
|
|
9
|
+
this.setMinLevel(LogLevel.Verbose);
|
|
57
10
|
}
|
|
58
11
|
get homeEnvVar() {
|
|
59
12
|
return this._homeEnvVar;
|
|
@@ -67,6 +20,51 @@ class Cli_PNPM extends ts_common_1.Logger {
|
|
|
67
20
|
set expectedVersion(value) {
|
|
68
21
|
this._expectedVersion = value;
|
|
69
22
|
}
|
|
23
|
+
install = async (commando) => {
|
|
24
|
+
if (this.isInstalled()) {
|
|
25
|
+
const version = (await commando.getVersion());
|
|
26
|
+
if (this._expectedVersion === version)
|
|
27
|
+
return;
|
|
28
|
+
await this.uninstall();
|
|
29
|
+
}
|
|
30
|
+
this.logDebug(`installing PNPM version ${this._expectedVersion}`);
|
|
31
|
+
await commando.install(this._expectedVersion);
|
|
32
|
+
return this;
|
|
33
|
+
};
|
|
34
|
+
isInstalled = () => !!process.env[this._homeEnvVar];
|
|
35
|
+
installPackages = async (commando) => {
|
|
36
|
+
return await commando.installPackages();
|
|
37
|
+
};
|
|
38
|
+
uninstall = async () => {
|
|
39
|
+
this.logDebug('Uninstalling PNPM');
|
|
40
|
+
const absolutePathToPNPM_Home = process.env[this._homeEnvVar];
|
|
41
|
+
if (!absolutePathToPNPM_Home)
|
|
42
|
+
return;
|
|
43
|
+
return fs.rm(absolutePathToPNPM_Home, { recursive: true, force: true });
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Asynchronously creates a workspace file with a list of packages.
|
|
47
|
+
* Each package is listed under the 'packages:' section in the file.
|
|
48
|
+
*
|
|
49
|
+
* @param listOfLibs An array of library names to include in the workspace.
|
|
50
|
+
* @param pathToWorkspaceFolder The filesystem path where the workspace file will be written.
|
|
51
|
+
* @example
|
|
52
|
+
* await createWorkspace(['pack1', 'pack2'], './path/to/workspace.yaml');
|
|
53
|
+
*/
|
|
54
|
+
createWorkspace = async (listOfLibs, pathToWorkspaceFolder = process.cwd()) => {
|
|
55
|
+
try {
|
|
56
|
+
let workspace = 'packages:\n';
|
|
57
|
+
listOfLibs.forEach(lib => {
|
|
58
|
+
workspace += ` - '${lib}'\n`;
|
|
59
|
+
});
|
|
60
|
+
const pathToPnpmWorkspace = convertToFullPath('./pnpm-workspace.yaml', pathToWorkspaceFolder);
|
|
61
|
+
await fs.writeFile(pathToPnpmWorkspace, workspace, 'utf8');
|
|
62
|
+
this.logDebug(`Workspace file created at ${pathToPnpmWorkspace}`);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
this.logError('Failed to create workspace file:', error);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
70
68
|
}
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
export const PNPM = new Cli_PNPM();
|
|
70
|
+
//# sourceMappingURL=pnpm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpm.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/services/pnpm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,IAAI,EAAE,EAAC,MAAM,IAAI,CAAC;AAClC,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAI9C,MAAM,OAAO,QACZ,SAAQ,MAAM;IAEN,gBAAgB,GAAG,QAAQ,CAAC;IAC5B,WAAW,GAAG,WAAW,CAAC;IAElC;QACC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAI,UAAU,CAAC,KAAa;QAC3B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,IAAI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oB,EAAE,wBAAgC,OAAO,CAAC,GAAG,EAAE,EAAiB,EAAE;QAC9G,IAAI,CAAC;YACJ,IAAI,SAAS,GAAG,aAAa,CAAC;YAC9B,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACxB,SAAS,IAAI,QAAQ,GAAG,KAAK,CAAC;YAC/B,CAAC,CAAC,CAAC;YAEH,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;YAC9F,MAAM,EAAE,CAAC,SAAS,CAAC,mBAAmB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,CAAC,6BAA6B,mBAAmB,EAAE,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,IAAI,CAAC,QAAQ,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Constructor } from '@nu-art/ts-common';
|
|
2
|
-
import { BaseCommando } from '../core/BaseCommando';
|
|
2
|
+
import { BaseCommando } from '../core/BaseCommando.js';
|
|
3
3
|
export declare class Commando extends BaseCommando {
|
|
4
4
|
private uid?;
|
|
5
|
-
static create<T extends Constructor<any>[]>(...plugins: T): (import("../core/class-merger").MergeTypes<[typeof BaseCommando, typeof Commando, ...T]> & BaseCommando) & Commando;
|
|
5
|
+
static create<T extends Constructor<any>[]>(...plugins: T): (import("../core/class-merger.js").MergeTypes<[typeof BaseCommando, typeof Commando, ...T]> & BaseCommando) & Commando;
|
|
6
6
|
constructor();
|
|
7
7
|
setUID(uid: string): this;
|
|
8
8
|
executeFile(filePath: string, interpreter?: string): Promise<{
|
package/shell/simple/Commando.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const CliError_1 = require("../core/CliError");
|
|
8
|
-
class Commando extends BaseCommando_1.BaseCommando {
|
|
1
|
+
import { ThisShouldNotHappenException } from '@nu-art/ts-common';
|
|
2
|
+
import { SimpleShell } from './SimpleShell.js';
|
|
3
|
+
import { BaseCommando } from '../core/BaseCommando.js';
|
|
4
|
+
import { CliError } from '../core/CliError.js';
|
|
5
|
+
export class Commando extends BaseCommando {
|
|
6
|
+
uid;
|
|
9
7
|
static create(...plugins) {
|
|
10
|
-
const _commando =
|
|
8
|
+
const _commando = BaseCommando._create(Commando, ...plugins);
|
|
11
9
|
return _commando;
|
|
12
10
|
}
|
|
13
11
|
constructor() {
|
|
@@ -23,29 +21,28 @@ class Commando extends BaseCommando_1.BaseCommando {
|
|
|
23
21
|
if (interpreter) {
|
|
24
22
|
command = `${interpreter} ${filePath}`;
|
|
25
23
|
}
|
|
26
|
-
return new
|
|
24
|
+
return new SimpleShell().execute(command);
|
|
27
25
|
}
|
|
28
26
|
executeRemoteFile(pathToFile, interpreter) {
|
|
29
27
|
const command = `curl -o- "${pathToFile}" | ${interpreter}`;
|
|
30
|
-
return new
|
|
28
|
+
return new SimpleShell().execute(command);
|
|
31
29
|
}
|
|
32
30
|
async execute(callback) {
|
|
33
|
-
var _a;
|
|
34
31
|
const command = this.builder.reset();
|
|
35
|
-
const simpleShell = new
|
|
32
|
+
const simpleShell = new SimpleShell().debug(this._debug);
|
|
36
33
|
try {
|
|
37
34
|
if (this.uid)
|
|
38
35
|
simpleShell.setUID(this.uid);
|
|
39
36
|
const { stdout, stderr } = await simpleShell.execute(command);
|
|
40
|
-
return callback
|
|
37
|
+
return callback?.(stdout, stderr, 0);
|
|
41
38
|
}
|
|
42
39
|
catch (_error) {
|
|
43
40
|
simpleShell.logError(_error);
|
|
44
41
|
const cliError = _error;
|
|
45
|
-
if ('isInstanceOf' in cliError && cliError.isInstanceOf(
|
|
46
|
-
return callback
|
|
47
|
-
throw new
|
|
42
|
+
if ('isInstanceOf' in cliError && cliError.isInstanceOf(CliError))
|
|
43
|
+
return callback?.(cliError.stdout, cliError.stderr, cliError.cause.code ?? -1);
|
|
44
|
+
throw new ThisShouldNotHappenException('Unhandled error', _error);
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
|
|
48
|
+
//# sourceMappingURL=Commando.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Commando.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/simple/Commando.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,4BAA4B,EAAC,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAG7C,MAAM,OAAO,QACZ,SAAQ,YAAY;IACZ,GAAG,CAAU;IAErB,MAAM,CAAC,MAAM,CAA+B,GAAG,OAAU;QACxD,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC;QAC7D,OAAO,SAAwC,CAAC;IACjD,CAAC;IAED;QACC,KAAK,EAAE,CAAC;IACT,CAAC;IAED,MAAM,CAAC,GAAW;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,OAAO,IAAI,CAAC;IACb,CAAC;IAED,WAAW,CAAC,QAAgB,EAAE,WAAoB;QACjD,IAAI,OAAO,GAAG,QAAQ,CAAC;QAEvB,6DAA6D;QAC7D,IAAI,WAAW,EAAE,CAAC;YACjB,OAAO,GAAG,GAAG,WAAW,IAAI,QAAQ,EAAE,CAAC;QACxC,CAAC;QACD,OAAO,IAAI,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAA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8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { Logger } from '@nu-art/ts-common';
|
|
3
|
+
import { CliError } from '../core/CliError.js';
|
|
4
|
+
function toStringWithNewlines(input) {
|
|
5
|
+
if (typeof input === 'string')
|
|
6
|
+
return input;
|
|
7
|
+
return Buffer.isBuffer(input)
|
|
8
|
+
? input.toString('utf8')
|
|
9
|
+
: Buffer.from(input).toString('utf8');
|
|
10
|
+
}
|
|
11
|
+
export class SimpleShell extends Logger {
|
|
12
|
+
_debug = false;
|
|
13
|
+
cliOptions = { shell: '/bin/bash' };
|
|
14
|
+
/**
|
|
15
|
+
* Executes the accumulated commands in the command list.
|
|
16
|
+
* @returns {Promise<string>} A promise that resolves with the standard output of the executed command.
|
|
17
|
+
*/
|
|
18
|
+
execute = async (command) => {
|
|
19
|
+
if (this._debug)
|
|
20
|
+
this.logDebug(`executing: `, `"""\n${command}\n"""`);
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
exec(command, this.cliOptions, (error, stdout, stderr) => {
|
|
23
|
+
if (error) {
|
|
24
|
+
return reject(new CliError(`executing:\n${command}\n`, toStringWithNewlines(stdout), toStringWithNewlines(stderr), error));
|
|
25
|
+
}
|
|
26
|
+
if (stdout)
|
|
27
|
+
this.logInfo(stdout);
|
|
28
|
+
if (stderr)
|
|
29
|
+
this.logError(stderr);
|
|
30
|
+
resolve({ stdout: toStringWithNewlines(stdout), stderr: toStringWithNewlines(stderr) });
|
|
30
31
|
});
|
|
31
|
-
};
|
|
32
|
-
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
33
34
|
debug(debug) {
|
|
34
|
-
this._debug = debug
|
|
35
|
+
this._debug = debug ?? !this._debug;
|
|
35
36
|
return this;
|
|
36
37
|
}
|
|
37
38
|
setShell(shell) {
|
|
@@ -45,4 +46,4 @@ class SimpleShell extends ts_common_1.Logger {
|
|
|
45
46
|
return this;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
//# sourceMappingURL=SimpleShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleShell.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/simple/SimpleShell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAc,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAM7C,SAAS,oBAAoB,CAAC,KAAuC;IACpE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC5B,OAAO,KAAK,CAAC;IAEd,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC5B,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACxB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAwB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,OAAO,WACZ,SAAQ,MAAM;IACN,MAAM,GAAY,KAAK,CAAC;IAExB,UAAU,GAAwB,EAAC,KAAK,EAAE,WAAW,EAAC,CAAC;IAE/D;;;OAGG;IACH,OAAO,GAAG,KAAK,EAAE,OAAe,EAA+C,EAAE;QAChF,IAAI,IAAI,CAAC,MAAM;YACd,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,OAAO,OAAO,CAAC,CAAC;QAEtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAA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|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.removeAnsiCodes = removeAnsiCodes;
|
|
27
|
-
exports.convertToFullPath = convertToFullPath;
|
|
28
|
-
const path = __importStar(require("path"));
|
|
29
|
-
function removeAnsiCodes(text) {
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
export function removeAnsiCodes(text) {
|
|
30
3
|
// This regular expression matches the escape codes and removes them
|
|
31
4
|
return text.replace(/\x1B\[\d+;?\d*m/g, '');
|
|
32
5
|
}
|
|
33
|
-
function convertToFullPath(pathToFile, assetParentPath = process.cwd()) {
|
|
6
|
+
export function convertToFullPath(pathToFile, assetParentPath = process.cwd()) {
|
|
34
7
|
if (!pathToFile)
|
|
35
8
|
throw new Error('Path not provided');
|
|
36
9
|
if (pathToFile === '')
|
|
@@ -42,3 +15,4 @@ function convertToFullPath(pathToFile, assetParentPath = process.cwd()) {
|
|
|
42
15
|
// throw new Error(`Found path: '${absolutePath}' which is out of the scope of the assert directory: '${assetParentPath}'`);
|
|
43
16
|
return absolutePath;
|
|
44
17
|
}
|
|
18
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAM,IAAI,MAAM,MAAM,CAAC;AAG9B,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,oEAAoE;IACpE,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;IACpF,IAAI,CAAC,UAAU;QACd,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAEtC,IAAI,UAAU,KAAK,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAE3C,OAAO,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC;QAChC,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAEtC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC/D,iDAAiD;IACjD,6HAA6H;IAE7H,OAAO,YAA4B,CAAC;AACrC,CAAC"}
|
package/shell/types.d.ts
CHANGED
package/shell/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Logger, ResolvableContent } from '@nu-art/ts-common';
|
|
2
|
-
import { BlessedWidget, BlessedWidgetOptions, BlessedWidgetsType } from './types';
|
|
3
|
-
type KeyBinding = {
|
|
4
|
-
keys: string[];
|
|
5
|
-
callback: VoidFunction;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* An abstract class representing a container for Blessed widgets with state management and key bindings.
|
|
9
|
-
*
|
|
10
|
-
* @template Type - The type of the Blessed widget.
|
|
11
|
-
* @template State - The type of the state object.
|
|
12
|
-
*/
|
|
13
|
-
export declare abstract class ConsoleContainer<Type extends BlessedWidgetsType, State extends object = {}> extends Logger {
|
|
14
|
-
private readonly containerProps?;
|
|
15
|
-
private readonly keyBinding;
|
|
16
|
-
private enabled;
|
|
17
|
-
protected state: State;
|
|
18
|
-
protected container: BlessedWidget[Type];
|
|
19
|
-
protected type: Type;
|
|
20
|
-
protected readonly widgets: BlessedWidget[BlessedWidgetsType][];
|
|
21
|
-
/**
|
|
22
|
-
* Creates an instance of ConsoleContainer.
|
|
23
|
-
*
|
|
24
|
-
* @param {Type} type - The type of the container widget.
|
|
25
|
-
* @param {BlessedWidgetOptions[Type]} [containerProps] - The properties to apply to the container widget.
|
|
26
|
-
* @param {KeyBinding[]} [keyBinding] - An array of key bindings for the container widget.
|
|
27
|
-
*/
|
|
28
|
-
protected constructor(type: Type, containerProps?: BlessedWidgetOptions[Type], keyBinding?: KeyBinding[]);
|
|
29
|
-
/**
|
|
30
|
-
* Sets the state of the container and triggers a re-render.
|
|
31
|
-
*
|
|
32
|
-
* @param {ResolvableContent<Partial<State>>} state - The new state to set.
|
|
33
|
-
* @returns {this} The current instance for method chaining.
|
|
34
|
-
*/
|
|
35
|
-
setState(state: ResolvableContent<Partial<State>>): this;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a Blessed widget of the specified type and adds it to the container.
|
|
38
|
-
*
|
|
39
|
-
* @template WidgetType - The type of the widget to create.
|
|
40
|
-
* @param {WidgetType} type - The type of the widget to create.
|
|
41
|
-
* @param {BlessedWidgetOptions[WidgetType]} props - The properties to apply to the widget.
|
|
42
|
-
* @returns {BlessedWidget[WidgetType]} The created widget.
|
|
43
|
-
*/
|
|
44
|
-
createWidget<WidgetType extends BlessedWidgetsType>(type: WidgetType, props: BlessedWidgetOptions[WidgetType]): BlessedWidget[WidgetType];
|
|
45
|
-
/**
|
|
46
|
-
* Gets the currently focused widget within the container.
|
|
47
|
-
*
|
|
48
|
-
* @returns {Widgets.Node} The focused widget.
|
|
49
|
-
*/
|
|
50
|
-
getFocusedWidget(): BlessedWidget[BlessedWidgetsType];
|
|
51
|
-
private createContainer;
|
|
52
|
-
private _createWidgets;
|
|
53
|
-
/**
|
|
54
|
-
* Creates the widgets within the container.
|
|
55
|
-
* This method should be implemented by subclasses to define the specific widgets to create.
|
|
56
|
-
*/
|
|
57
|
-
protected abstract createContent(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Creates the container and its widgets, and resumes rendering if not already enabled.
|
|
60
|
-
*
|
|
61
|
-
* @returns {this} The current instance for method chaining.
|
|
62
|
-
*/
|
|
63
|
-
create(): this;
|
|
64
|
-
/**
|
|
65
|
-
* Resumes rendering and enables focus on the widgets.
|
|
66
|
-
*
|
|
67
|
-
* @returns {this} The current instance for method chaining.
|
|
68
|
-
*/
|
|
69
|
-
readonly resume: () => this;
|
|
70
|
-
private _render;
|
|
71
|
-
/**
|
|
72
|
-
* Renders the container.
|
|
73
|
-
* This method should be implemented by subclasses to define the specific rendering logic.
|
|
74
|
-
*/
|
|
75
|
-
protected abstract render(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Pauses rendering and disables focus on the widgets.
|
|
78
|
-
*
|
|
79
|
-
* @returns {this} The current instance for method chaining.
|
|
80
|
-
*/
|
|
81
|
-
readonly pause: () => this;
|
|
82
|
-
/**
|
|
83
|
-
* Disposes of the container and its widgets.
|
|
84
|
-
*
|
|
85
|
-
* @returns {this} The current instance for method chaining.
|
|
86
|
-
*/
|
|
87
|
-
readonly dispose: () => this;
|
|
88
|
-
}
|
|
89
|
-
export {};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConsoleContainer = void 0;
|
|
4
|
-
const ts_common_1 = require("@nu-art/ts-common");
|
|
5
|
-
const types_1 = require("./types");
|
|
6
|
-
/**
|
|
7
|
-
* An abstract class representing a container for Blessed widgets with state management and key bindings.
|
|
8
|
-
*
|
|
9
|
-
* @template Type - The type of the Blessed widget.
|
|
10
|
-
* @template State - The type of the state object.
|
|
11
|
-
*/
|
|
12
|
-
class ConsoleContainer extends ts_common_1.Logger {
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of ConsoleContainer.
|
|
15
|
-
*
|
|
16
|
-
* @param {Type} type - The type of the container widget.
|
|
17
|
-
* @param {BlessedWidgetOptions[Type]} [containerProps] - The properties to apply to the container widget.
|
|
18
|
-
* @param {KeyBinding[]} [keyBinding] - An array of key bindings for the container widget.
|
|
19
|
-
*/
|
|
20
|
-
constructor(type, containerProps, keyBinding = []) {
|
|
21
|
-
super(containerProps === null || containerProps === void 0 ? void 0 : containerProps.name);
|
|
22
|
-
this.enabled = false;
|
|
23
|
-
this.state = {};
|
|
24
|
-
this.widgets = [];
|
|
25
|
-
/**
|
|
26
|
-
* Resumes rendering and enables focus on the widgets.
|
|
27
|
-
*
|
|
28
|
-
* @returns {this} The current instance for method chaining.
|
|
29
|
-
*/
|
|
30
|
-
this.resume = () => {
|
|
31
|
-
this.enabled = true;
|
|
32
|
-
this.widgets.forEach(widget => {
|
|
33
|
-
widget.focusable = true;
|
|
34
|
-
});
|
|
35
|
-
this._render();
|
|
36
|
-
return this;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Pauses rendering and disables focus on the widgets.
|
|
40
|
-
*
|
|
41
|
-
* @returns {this} The current instance for method chaining.
|
|
42
|
-
*/
|
|
43
|
-
this.pause = () => {
|
|
44
|
-
this.enabled = false;
|
|
45
|
-
this.widgets.forEach(widget => {
|
|
46
|
-
widget.focusable = false;
|
|
47
|
-
});
|
|
48
|
-
return this;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Disposes of the container and its widgets.
|
|
52
|
-
*
|
|
53
|
-
* @returns {this} The current instance for method chaining.
|
|
54
|
-
*/
|
|
55
|
-
this.dispose = () => {
|
|
56
|
-
if (!this.container)
|
|
57
|
-
return this;
|
|
58
|
-
this.widgets.forEach(widget => widget.detach());
|
|
59
|
-
this.widgets.length = 0;
|
|
60
|
-
this._render();
|
|
61
|
-
if (this.enabled)
|
|
62
|
-
this.pause();
|
|
63
|
-
this.container.detach();
|
|
64
|
-
this.container.destroy();
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
this.container = null;
|
|
67
|
-
return this;
|
|
68
|
-
};
|
|
69
|
-
this.type = type;
|
|
70
|
-
this.keyBinding = keyBinding;
|
|
71
|
-
this.containerProps = containerProps;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Sets the state of the container and triggers a re-render.
|
|
75
|
-
*
|
|
76
|
-
* @param {ResolvableContent<Partial<State>>} state - The new state to set.
|
|
77
|
-
* @returns {this} The current instance for method chaining.
|
|
78
|
-
*/
|
|
79
|
-
setState(state) {
|
|
80
|
-
this.state = (0, ts_common_1.mergeObject)(this.state, state);
|
|
81
|
-
this._render();
|
|
82
|
-
return this;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Creates a Blessed widget of the specified type and adds it to the container.
|
|
86
|
-
*
|
|
87
|
-
* @template WidgetType - The type of the widget to create.
|
|
88
|
-
* @param {WidgetType} type - The type of the widget to create.
|
|
89
|
-
* @param {BlessedWidgetOptions[WidgetType]} props - The properties to apply to the widget.
|
|
90
|
-
* @returns {BlessedWidget[WidgetType]} The created widget.
|
|
91
|
-
*/
|
|
92
|
-
createWidget(type, props) {
|
|
93
|
-
const widget = (0, types_1.createBlessedWidget)(type, props, this.container);
|
|
94
|
-
this.widgets.push(widget);
|
|
95
|
-
return widget;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Gets the currently focused widget within the container.
|
|
99
|
-
*
|
|
100
|
-
* @returns {Widgets.Node} The focused widget.
|
|
101
|
-
*/
|
|
102
|
-
getFocusedWidget() {
|
|
103
|
-
return this.container.screen.focused;
|
|
104
|
-
}
|
|
105
|
-
createContainer() {
|
|
106
|
-
if (this.container) {
|
|
107
|
-
return this.logWarning('Container already exists!');
|
|
108
|
-
}
|
|
109
|
-
try {
|
|
110
|
-
this.container = (0, types_1.createBlessedWidget)(this.type, this.containerProps, this.container);
|
|
111
|
-
this.keyBinding.forEach(keyBinding => {
|
|
112
|
-
this.container.key(keyBinding.keys, keyBinding.callback);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
this.logError('Failed to create container:', error);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
_createWidgets() {
|
|
120
|
-
if (this.widgets.length > 0) {
|
|
121
|
-
this.logWarning(`Widgets already created (${this.widgets.length} widgets)!`);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
this.createContent();
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Creates the container and its widgets, and resumes rendering if not already enabled.
|
|
128
|
-
*
|
|
129
|
-
* @returns {this} The current instance for method chaining.
|
|
130
|
-
*/
|
|
131
|
-
create() {
|
|
132
|
-
this.createContainer();
|
|
133
|
-
this._createWidgets();
|
|
134
|
-
if (!this.enabled)
|
|
135
|
-
this.resume();
|
|
136
|
-
return this;
|
|
137
|
-
}
|
|
138
|
-
_render() {
|
|
139
|
-
if (!this.enabled)
|
|
140
|
-
return;
|
|
141
|
-
this.render();
|
|
142
|
-
this.container.screen.render();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
exports.ConsoleContainer = ConsoleContainer;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ConsoleContainer } from './ConsoleContainer';
|
|
2
|
-
import { BlessedWidgetOptions } from './types';
|
|
3
|
-
type ScreenKeyBinding = {
|
|
4
|
-
keys: string[];
|
|
5
|
-
callback: VoidFunction;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* An abstract class representing a screen container for Blessed widgets with state management and key bindings.
|
|
9
|
-
*
|
|
10
|
-
* @template State - The type of the state object.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class ConsoleScreen<State extends object> extends ConsoleContainer<'screen', State> {
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of ConsoleScreen.
|
|
15
|
-
*
|
|
16
|
-
* @param {Widgets.IScreenOptions} [props] - The properties to apply to the screen widget.
|
|
17
|
-
* @param {ScreenKeyBinding[]} [keyBinding] - An array of key bindings for the screen widget.
|
|
18
|
-
*/
|
|
19
|
-
constructor(props?: BlessedWidgetOptions['screen'], keyBinding?: ScreenKeyBinding[]);
|
|
20
|
-
}
|
|
21
|
-
export {};
|
package/console/ConsoleScreen.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConsoleScreen = void 0;
|
|
4
|
-
const ConsoleContainer_1 = require("./ConsoleContainer");
|
|
5
|
-
/**
|
|
6
|
-
* An abstract class representing a screen container for Blessed widgets with state management and key bindings.
|
|
7
|
-
*
|
|
8
|
-
* @template State - The type of the state object.
|
|
9
|
-
*/
|
|
10
|
-
class ConsoleScreen extends ConsoleContainer_1.ConsoleContainer {
|
|
11
|
-
/**
|
|
12
|
-
* Creates an instance of ConsoleScreen.
|
|
13
|
-
*
|
|
14
|
-
* @param {Widgets.IScreenOptions} [props] - The properties to apply to the screen widget.
|
|
15
|
-
* @param {ScreenKeyBinding[]} [keyBinding] - An array of key bindings for the screen widget.
|
|
16
|
-
*/
|
|
17
|
-
constructor(props, keyBinding = []) {
|
|
18
|
-
super('screen', props, keyBinding);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.ConsoleScreen = ConsoleScreen;
|