@nu-art/commando 0.401.0 → 0.401.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.
Files changed (71) hide show
  1. package/{shell/core → core}/BaseCommando.d.ts +37 -6
  2. package/{shell/core → core}/BaseCommando.js +40 -6
  3. package/core/CliError.d.ts +49 -0
  4. package/core/CliError.js +58 -0
  5. package/{shell/core → core}/CommandBuilder.d.ts +27 -2
  6. package/{shell/core → core}/CommandBuilder.js +32 -3
  7. package/core/CommandoPool.d.ts +42 -0
  8. package/core/CommandoPool.js +48 -0
  9. package/core/class-merger.d.ts +39 -0
  10. package/core/class-merger.js +50 -0
  11. package/index.d.ts +11 -0
  12. package/index.js +16 -0
  13. package/{shell/interactive → interactive}/CommandoInteractive.d.ts +67 -7
  14. package/{shell/interactive → interactive}/CommandoInteractive.js +69 -6
  15. package/{shell/interactive → interactive}/InteractiveShell.d.ts +38 -0
  16. package/{shell/interactive → interactive}/InteractiveShell.js +25 -0
  17. package/package.json +24 -15
  18. package/plugins/basic.d.ts +140 -0
  19. package/plugins/basic.js +179 -0
  20. package/plugins/git.d.ts +169 -0
  21. package/plugins/git.js +219 -0
  22. package/plugins/nvm.d.ts +59 -0
  23. package/{shell/plugins → plugins}/nvm.js +47 -0
  24. package/plugins/pnpm.d.ts +42 -0
  25. package/{shell/plugins → plugins}/pnpm.js +31 -0
  26. package/{shell/plugins → plugins}/programming.d.ts +23 -3
  27. package/{shell/plugins → plugins}/programming.js +23 -3
  28. package/plugins/python.d.ts +41 -0
  29. package/plugins/python.js +58 -0
  30. package/services/nvm.d.ts +76 -0
  31. package/{shell/services → services}/nvm.js +67 -6
  32. package/services/pnpm.d.ts +67 -0
  33. package/{shell/services → services}/pnpm.js +41 -0
  34. package/simple/Commando.d.ts +92 -0
  35. package/simple/Commando.js +122 -0
  36. package/simple/SimpleShell.d.ts +48 -0
  37. package/{shell/simple → simple}/SimpleShell.js +32 -2
  38. package/tools.d.ts +33 -0
  39. package/tools.js +47 -0
  40. package/types.d.ts +17 -0
  41. package/cli-params/CLIParamsResolver.d.ts +0 -27
  42. package/cli-params/CLIParamsResolver.js +0 -97
  43. package/cli-params/consts.d.ts +0 -6
  44. package/cli-params/consts.js +0 -27
  45. package/cli-params/types.d.ts +0 -28
  46. package/shell/core/CliError.d.ts +0 -14
  47. package/shell/core/CliError.js +0 -23
  48. package/shell/core/CommandoPool.d.ts +0 -9
  49. package/shell/core/CommandoPool.js +0 -14
  50. package/shell/core/class-merger.d.ts +0 -20
  51. package/shell/core/class-merger.js +0 -35
  52. package/shell/index.d.ts +0 -2
  53. package/shell/index.js +0 -2
  54. package/shell/plugins/basic.d.ts +0 -59
  55. package/shell/plugins/basic.js +0 -98
  56. package/shell/plugins/git.d.ts +0 -54
  57. package/shell/plugins/git.js +0 -104
  58. package/shell/plugins/nvm.d.ts +0 -12
  59. package/shell/plugins/pnpm.d.ts +0 -11
  60. package/shell/plugins/python.d.ts +0 -10
  61. package/shell/plugins/python.js +0 -26
  62. package/shell/services/nvm.d.ts +0 -18
  63. package/shell/services/pnpm.d.ts +0 -26
  64. package/shell/simple/Commando.d.ts +0 -17
  65. package/shell/simple/Commando.js +0 -47
  66. package/shell/simple/SimpleShell.d.ts +0 -21
  67. package/shell/tools.d.ts +0 -3
  68. package/shell/tools.js +0 -17
  69. package/shell/types.d.ts +0 -3
  70. package/shell/types.js +0 -1
  71. /package/{cli-params/types.js → types.js} +0 -0
@@ -1,59 +0,0 @@
1
- import { BaseCommando } from '../core/BaseCommando.js';
2
- import { CliBlock } from '../types.js';
3
- type Cli_EchoOptions = {
4
- escape?: boolean;
5
- toFile?: {
6
- name: string;
7
- append?: boolean;
8
- };
9
- };
10
- type Cli_RmdirOptions = {
11
- force?: true;
12
- recursive?: true;
13
- };
14
- type Cli_CpdirOptions = {
15
- contentOnly?: boolean;
16
- };
17
- /**
18
- * Represents a Command Line Interface (CLI) to build and execute shell commands.
19
- */
20
- export declare class Commando_Basic extends BaseCommando {
21
- /**
22
- * Changes directory and optionally executes a block of commands in that directory.
23
- * @param {string} folderName - Name of the directory to change to.
24
- * @param {CliBlock} [toRun] - Optional block of commands to execute in the directory.
25
- * @returns {this} - The Cli instance for method chaining.
26
- */
27
- cd(folderName: string, toRun?: CliBlock<this>): this;
28
- custom(command: string): this;
29
- /**
30
- * Changes directory back to the previous directory.
31
- * @returns {this} - The Cli instance for method chaining.
32
- */
33
- cd_(): this;
34
- /**
35
- * Appends an 'ls' command with optional parameters.
36
- * @param {string} [params] - Optional parameters for the 'ls' command.
37
- * @returns {this} - The Cli instance for method chaining.
38
- */
39
- ls(params?: string): this;
40
- mkdir(dirName: string): this;
41
- rm(dirPath: string, options?: Cli_RmdirOptions): this;
42
- rmdir(dirPath: string, options?: Cli_RmdirOptions): this;
43
- cpdir(srcPath: string, destPath: string, options?: Cli_CpdirOptions): this;
44
- cat(fileName: string): this;
45
- echo(log: string, options?: Cli_EchoOptions): this;
46
- /**
47
- * Appends a 'pwd' command to print the current directory.
48
- * @returns {this} - The Cli instance for method chaining.
49
- */
50
- pwd(): this;
51
- /**
52
- * Assigns a value to a variable in the script.
53
- * @param {string} varName - The name of the variable.
54
- * @param {string | string[]} value - The value to assign to the variable.
55
- * @returns {this} - The Cli instance for method chaining.
56
- */
57
- assignVar(varName: string, value: string | string[]): this;
58
- }
59
- export {};
@@ -1,98 +0,0 @@
1
- import { BaseCommando } from '../core/BaseCommando.js';
2
- /**
3
- * Represents a Command Line Interface (CLI) to build and execute shell commands.
4
- */
5
- export class Commando_Basic extends BaseCommando {
6
- /**
7
- * Changes directory and optionally executes a block of commands in that directory.
8
- * @param {string} folderName - Name of the directory to change to.
9
- * @param {CliBlock} [toRun] - Optional block of commands to execute in the directory.
10
- * @returns {this} - The Cli instance for method chaining.
11
- */
12
- cd(folderName, toRun) {
13
- this.append(`cd ${folderName}`);
14
- this.indentIn();
15
- if (toRun) {
16
- toRun(this);
17
- this.cd_();
18
- }
19
- return this;
20
- }
21
- custom(command) {
22
- this.append(command);
23
- return this;
24
- }
25
- /**
26
- * Changes directory back to the previous directory.
27
- * @returns {this} - The Cli instance for method chaining.
28
- */
29
- cd_() {
30
- this.indentOut();
31
- this.append(`cd -`);
32
- return this;
33
- }
34
- /**
35
- * Appends an 'ls' command with optional parameters.
36
- * @param {string} [params] - Optional parameters for the 'ls' command.
37
- * @returns {this} - The Cli instance for method chaining.
38
- */
39
- ls(params = '') {
40
- this.append(`ls ${params}`);
41
- return this;
42
- }
43
- mkdir(dirName) {
44
- this.append(`mkdir -p ${dirName}`);
45
- return this;
46
- }
47
- rm(dirPath, options) {
48
- let command = 'rm';
49
- if (options?.force)
50
- command += ' -f';
51
- this.append(`${command} ${dirPath}`);
52
- return this;
53
- }
54
- rmdir(dirPath, options) {
55
- let command = 'rm -r';
56
- if (options?.force)
57
- command += ' -f';
58
- this.append(`${command} ${dirPath}`);
59
- return this;
60
- }
61
- cpdir(srcPath, destPath, options) {
62
- let command = `cp -r ${srcPath}`;
63
- if (options?.contentOnly)
64
- command += '/*';
65
- command += ` ${destPath}`;
66
- this.append(command);
67
- return this;
68
- }
69
- cat(fileName) {
70
- this.append(`cat ${fileName}`);
71
- return this;
72
- }
73
- echo(log, options) {
74
- const _escape = options?.escape ? '-e' : '';
75
- const _toFile = options?.toFile ? `>${options.toFile.append ? '>' : ''} ${options.toFile.name}` : '';
76
- const escapedLog = log.replace(/\\/g, '\\\\').replace(/\n/g, '\\\\n').replace(/\t/g, '\\\t');
77
- this.append(`echo ${_escape} "${escapedLog}" ${_toFile}`);
78
- return this;
79
- }
80
- /**
81
- * Appends a 'pwd' command to print the current directory.
82
- * @returns {this} - The Cli instance for method chaining.
83
- */
84
- pwd() {
85
- this.append('pwd');
86
- return this;
87
- }
88
- /**
89
- * Assigns a value to a variable in the script.
90
- * @param {string} varName - The name of the variable.
91
- * @param {string | string[]} value - The value to assign to the variable.
92
- * @returns {this} - The Cli instance for method chaining.
93
- */
94
- assignVar(varName, value) {
95
- this.append(`${varName}=(${Array.isArray(value) ? value : [value].join(' ')})`);
96
- return this;
97
- }
98
- }
@@ -1,54 +0,0 @@
1
- import { Commando_Programming } from './programming.js';
2
- import { Commando_Basic } from './basic.js';
3
- import { BaseCommando } from '../core/BaseCommando.js';
4
- declare const Super: import("@nu-art/ts-common").Constructor<BaseCommando & Commando_Programming & Commando_Basic>;
5
- type GitCloneParams = {
6
- outputFolder?: string;
7
- branch?: string;
8
- recursive?: boolean;
9
- };
10
- type GitPushParams = {
11
- remote: string;
12
- branch: string;
13
- tags?: boolean;
14
- force?: boolean;
15
- };
16
- export declare class Commando_Git extends Super {
17
- git(): {
18
- clone: (url: string, options?: GitCloneParams) => this;
19
- checkout: (branch: string) => this;
20
- createTag: (tagName: string) => this;
21
- gitCommit: (commitMessage: string) => this;
22
- add: (file: string) => this;
23
- addAll: () => this;
24
- addAndCommit: (commitMessage: string) => this;
25
- push: (options?: GitPushParams) => this;
26
- pushTags: () => this;
27
- fetch: () => this;
28
- resetHard: (tag?: string) => this;
29
- getCurrentBranch: () => this;
30
- pull: (params: string) => this;
31
- merge: (mergeFrom: string) => this;
32
- createBranch: (branch: string) => this;
33
- gsui: (modules?: string) => this;
34
- status: () => this;
35
- };
36
- git_clone(url: string, options?: GitCloneParams): this;
37
- git_checkout(branch: string): this;
38
- git_createTag(tagName: string): this;
39
- git_gitCommit(commitMessage: string): this;
40
- git_add(file: string): this;
41
- git_addAll(): this;
42
- git_addAndCommit(commitMessage: string): this;
43
- git_push(options?: GitPushParams): this;
44
- git_pushTags(): this;
45
- git_fetch(): this;
46
- git_resetHard(tag?: string): this;
47
- git_getCurrentBranch(): this;
48
- git_pull(params: string): this;
49
- git_merge(mergeFrom: string): this;
50
- git_createBranch(branch: string): this;
51
- git_gsui(modules?: string): this;
52
- git_status(): this;
53
- }
54
- export {};
@@ -1,104 +0,0 @@
1
- import { Commando_Programming } from './programming.js';
2
- import { Commando_Basic } from './basic.js';
3
- import { MergeClass } from '../core/class-merger.js';
4
- import { BaseCommando } from '../core/BaseCommando.js';
5
- const Super = MergeClass(BaseCommando, Commando_Programming, Commando_Basic);
6
- export class Commando_Git extends Super {
7
- git() {
8
- return {
9
- clone: this.git_clone,
10
- checkout: this.git_checkout,
11
- createTag: this.git_createTag,
12
- gitCommit: this.git_gitCommit,
13
- add: this.git_add,
14
- addAll: this.git_addAll,
15
- addAndCommit: this.git_addAndCommit,
16
- push: this.git_push,
17
- pushTags: this.git_pushTags,
18
- fetch: this.git_fetch,
19
- resetHard: this.git_resetHard,
20
- getCurrentBranch: this.git_getCurrentBranch,
21
- pull: this.git_pull,
22
- merge: this.git_merge,
23
- createBranch: this.git_createBranch,
24
- gsui: this.git_gsui,
25
- status: this.git_status,
26
- };
27
- }
28
- ;
29
- git_clone(url, options) {
30
- const branch = `${options?.branch ? ` -b ${options?.branch}` : ''}`;
31
- const recursive = `${options?.recursive ? ` --recursive` : ''}`;
32
- const outputFolder = `${options?.outputFolder ? ` ${options.outputFolder}` : ''}`;
33
- const command = `git clone${recursive}${branch} ${url}${outputFolder}`;
34
- return this.append(command);
35
- }
36
- // git_cloneAssert(url: string, options?: GitCloneParams) {
37
- // return new Promise<void>((resolve, reject) => {
38
- // const branch = `${options?.branch ? ` -b ${options?.branch}` : ''}`;
39
- // const recursive = `${options?.recursive ? ` --recursive` : ''}`;
40
- // const outputFolder = `${options?.outputFolder ? ` ${options.outputFolder}` : ''}`;
41
- // const command = `git clone${recursive}${branch} ${url}${outputFolder}`;
42
- // this.echo(command);
43
- // this.append(command)
44
- // .execute((stdout: string, stderr: string, exitCode: number) => {
45
- // if (exitCode === 0)
46
- // return resolve();
47
- //
48
- // if (exitCode === 128)
49
- // return reject(new Error(`No access to repo: ${url}`));
50
- //
51
- // return reject(new Error(`Got unexpected exit code(${exitCode}) while cloning: ${url}`));
52
- // });
53
- // });
54
- // }
55
- git_checkout(branch) {
56
- return this.append(`git checkout ${branch}`);
57
- }
58
- git_createTag(tagName) {
59
- return this.append(`git tag -f ${tagName}`);
60
- }
61
- git_gitCommit(commitMessage) {
62
- return this.append(`git commit -m "${commitMessage}"`);
63
- }
64
- git_add(file) {
65
- return this.append(`git add "${file}"`);
66
- }
67
- git_addAll() {
68
- return this.append(`git add .`);
69
- }
70
- git_addAndCommit(commitMessage) {
71
- return this.append(`git commit -am "${commitMessage}"`);
72
- }
73
- git_push(options) {
74
- return this.append(`git push ${options?.remote ?? ''} ${options?.branch ?? ''}`);
75
- }
76
- git_pushTags() {
77
- return this.append('git push --tags --force');
78
- }
79
- git_fetch() {
80
- return this.append('git fetch');
81
- }
82
- git_resetHard(tag = '') {
83
- return this.append('git reset --hard ${tag}');
84
- }
85
- git_getCurrentBranch() {
86
- return this.append('git status | grep "On branch" | sed -E "s');
87
- }
88
- git_pull(params) {
89
- return this.append('git pull ${params}');
90
- }
91
- git_merge(mergeFrom) {
92
- return this.append(`git merge ${mergeFrom}`);
93
- }
94
- git_createBranch(branch) {
95
- return this.append(`git checkout - b ${branch}`)
96
- .append(`git push-- set -upstream origin ${branch}`);
97
- }
98
- git_gsui(modules = '') {
99
- return this.append('git submodule update --recursive --init ${modules}');
100
- }
101
- git_status() {
102
- return this.append('git status');
103
- }
104
- }
@@ -1,12 +0,0 @@
1
- import { BaseCommando } from '../core/BaseCommando.js';
2
- import { Commando_Programming } from './programming.js';
3
- import { Commando_Basic } from './basic.js';
4
- declare const Super: import("@nu-art/ts-common").Constructor<BaseCommando & Commando_Programming & Commando_Basic>;
5
- export declare class Commando_NVM extends Super {
6
- applyNVM(): this;
7
- install(version: string): Promise<this>;
8
- getVersion(): Promise<string>;
9
- installNodeVersion(requiredVersion: string): Promise<this>;
10
- getInstalledNodeVersions: () => Promise<(string | undefined)[]>;
11
- }
12
- export {};
@@ -1,11 +0,0 @@
1
- import { BaseCommando } from '../core/BaseCommando.js';
2
- import { Commando_Basic } from './basic.js';
3
- import { Commando_Programming } from './programming.js';
4
- import { Commando_NVM } from './nvm.js';
5
- declare const Super: import("@nu-art/ts-common").Constructor<BaseCommando & Commando_Programming & Commando_Basic & Commando_NVM>;
6
- export declare class Commando_PNPM extends Super {
7
- installPackages(): Promise<this>;
8
- install(version: string): Promise<this>;
9
- getVersion(): Promise<string>;
10
- }
11
- export {};
@@ -1,10 +0,0 @@
1
- import { BaseCommando } from '../core/BaseCommando.js';
2
- import { Commando_Programming } from './programming.js';
3
- import { Commando_Basic } from './basic.js';
4
- declare const Super: import("@nu-art/ts-common").Constructor<BaseCommando & Commando_Programming & Commando_Basic>;
5
- export declare class Commando_Python3 extends Super {
6
- sourceVenv(venvFolder?: string): this;
7
- installVenv(venvFolder?: string): Promise<this>;
8
- installRequirements(pathToRequirementsFile?: string): Promise<this>;
9
- }
10
- export {};
@@ -1,26 +0,0 @@
1
- import { BaseCommando } from '../core/BaseCommando.js';
2
- import { Commando_Programming } from './programming.js';
3
- import { MergeClass } from '../core/class-merger.js';
4
- import { Commando_Basic } from './basic.js';
5
- import { Exception } from '@nu-art/ts-common';
6
- const Super = MergeClass(BaseCommando, Commando_Programming, Commando_Basic);
7
- const DefaultVenvFolder = '.venv';
8
- export class Commando_Python3 extends Super {
9
- sourceVenv(venvFolder = DefaultVenvFolder) {
10
- this.append(`source ${venvFolder}/bin/activate`);
11
- return this;
12
- }
13
- async installVenv(venvFolder = DefaultVenvFolder) {
14
- this.append(`python3 -m venv ${venvFolder}`);
15
- await this.execute((stdout, stderr, exitCode) => {
16
- if (exitCode !== 0)
17
- throw new Exception(`Error installing VENV - exit code (${exitCode})`);
18
- });
19
- return this;
20
- }
21
- async installRequirements(pathToRequirementsFile = './requirements.txt') {
22
- await this.append(`pip3 install -r ${pathToRequirementsFile}`)
23
- .execute();
24
- return this;
25
- }
26
- }
@@ -1,18 +0,0 @@
1
- import { Logger } from '@nu-art/ts-common';
2
- import { Commando_NVM } from '../plugins/nvm.js';
3
- export declare class Cli_NVM extends Logger {
4
- private _expectedVersion;
5
- private _homeEnvVar;
6
- constructor();
7
- get homeEnvVar(): string;
8
- set homeEnvVar(value: string);
9
- get expectedVersion(): string;
10
- set expectedVersion(value: string);
11
- install: (commando: Commando_NVM) => Promise<boolean | this | undefined>;
12
- isInstalled: () => boolean;
13
- getRequiredNode_Version: () => Promise<string>;
14
- installRequiredVersionIfNeeded: (commando: Commando_NVM) => Promise<boolean>;
15
- uninstall: () => Promise<void>;
16
- private installVersion;
17
- }
18
- export declare const NVM: Cli_NVM;
@@ -1,26 +0,0 @@
1
- import { Logger } from '@nu-art/ts-common';
2
- import { Commando_PNPM } from '../plugins/pnpm.js';
3
- export declare class Cli_PNPM extends Logger {
4
- private _expectedVersion;
5
- private _homeEnvVar;
6
- constructor();
7
- get homeEnvVar(): string;
8
- set homeEnvVar(value: string);
9
- get expectedVersion(): string;
10
- set expectedVersion(value: string);
11
- install: (commando: Commando_PNPM) => Promise<this | undefined>;
12
- isInstalled: () => boolean;
13
- installPackages: (commando: Commando_PNPM) => Promise<Commando_PNPM>;
14
- uninstall: () => Promise<void>;
15
- /**
16
- * Asynchronously creates a workspace file with a list of packages.
17
- * Each package is listed under the 'packages:' section in the file.
18
- *
19
- * @param listOfLibs An array of library names to include in the workspace.
20
- * @param pathToWorkspaceFolder The filesystem path where the workspace file will be written.
21
- * @example
22
- * await createWorkspace(['pack1', 'pack2'], './path/to/workspace.yaml');
23
- */
24
- createWorkspace: (listOfLibs: string[], pathToWorkspaceFolder?: string) => Promise<void>;
25
- }
26
- export declare const PNPM: Cli_PNPM;
@@ -1,17 +0,0 @@
1
- import { Constructor } from '@nu-art/ts-common';
2
- import { BaseCommando } from '../core/BaseCommando.js';
3
- export declare class Commando extends BaseCommando {
4
- private uid?;
5
- static create<T extends Constructor<any>[]>(...plugins: T): (import("../core/class-merger.js").MergeTypes<[typeof BaseCommando, typeof Commando, ...T]> & BaseCommando) & Commando;
6
- constructor();
7
- setUID(uid: string): this;
8
- executeFile(filePath: string, interpreter?: string): Promise<{
9
- stdout: string;
10
- stderr: string;
11
- }>;
12
- executeRemoteFile(pathToFile: string, interpreter: string): Promise<{
13
- stdout: string;
14
- stderr: string;
15
- }>;
16
- execute<T>(callback?: (stdout: string, stderr: string, exitCode: number) => T): Promise<T | void>;
17
- }
@@ -1,47 +0,0 @@
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;
7
- static create(...plugins) {
8
- const _commando = BaseCommando._create(Commando, ...plugins);
9
- return _commando;
10
- }
11
- constructor() {
12
- super();
13
- }
14
- setUID(uid) {
15
- this.uid = uid;
16
- return this;
17
- }
18
- executeFile(filePath, interpreter) {
19
- let command = filePath;
20
- // If an interpreter is provided, prefix the command with it.
21
- if (interpreter) {
22
- command = `${interpreter} ${filePath}`;
23
- }
24
- return new SimpleShell().execute(command);
25
- }
26
- executeRemoteFile(pathToFile, interpreter) {
27
- const command = `curl -o- "${pathToFile}" | ${interpreter}`;
28
- return new SimpleShell().execute(command);
29
- }
30
- async execute(callback) {
31
- const command = this.builder.reset();
32
- const simpleShell = new SimpleShell().debug(this._debug);
33
- try {
34
- if (this.uid)
35
- simpleShell.setUID(this.uid);
36
- const { stdout, stderr } = await simpleShell.execute(command);
37
- return callback?.(stdout, stderr, 0);
38
- }
39
- catch (_error) {
40
- simpleShell.logError(_error);
41
- const cliError = _error;
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);
45
- }
46
- }
47
- }
@@ -1,21 +0,0 @@
1
- import { ExecOptions } from 'child_process';
2
- import { Logger } from '@nu-art/ts-common';
3
- export type CliOptions = ExecOptions & {
4
- encoding: BufferEncoding | string | null;
5
- };
6
- export declare class SimpleShell extends Logger {
7
- private _debug;
8
- private cliOptions;
9
- /**
10
- * Executes the accumulated commands in the command list.
11
- * @returns {Promise<string>} A promise that resolves with the standard output of the executed command.
12
- */
13
- execute: (command: string) => Promise<{
14
- stdout: string;
15
- stderr: string;
16
- }>;
17
- debug(debug?: boolean): this;
18
- setShell(shell: string): void;
19
- setOptions(options: Partial<CliOptions>): void;
20
- setUID(uid: string): this;
21
- }
package/shell/tools.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { AbsolutePath } from '@nu-art/ts-common';
2
- export declare function removeAnsiCodes(text: string): string;
3
- export declare function convertToFullPath(pathToFile: string, assetParentPath?: string): AbsolutePath;
package/shell/tools.js DELETED
@@ -1,17 +0,0 @@
1
- import * as path from 'path';
2
- export function removeAnsiCodes(text) {
3
- // This regular expression matches the escape codes and removes them
4
- return text.replace(/\x1B\[\d+;?\d*m/g, '');
5
- }
6
- export function convertToFullPath(pathToFile, assetParentPath = process.cwd()) {
7
- if (!pathToFile)
8
- throw new Error('Path not provided');
9
- if (pathToFile === '')
10
- throw new Error('Empty path not allowed');
11
- while (pathToFile.startsWith('/'))
12
- pathToFile = pathToFile.substring(1);
13
- const absolutePath = path.resolve(assetParentPath, pathToFile);
14
- // if (!absolutePath.startsWith(assetParentPath))
15
- // throw new Error(`Found path: '${absolutePath}' which is out of the scope of the assert directory: '${assetParentPath}'`);
16
- return absolutePath;
17
- }
package/shell/types.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { BaseCommando } from './core/BaseCommando.js';
2
- export type LogTypes = 'out' | 'err';
3
- export type CliBlock<Commando extends BaseCommando> = (cli: Commando) => void;
package/shell/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
File without changes