@aneuhold/core-ts-lib 1.0.8 → 1.0.10
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/lib/helperFunctions/dateFunctions.d.ts +9 -9
- package/lib/helperFunctions/dateFunctions.js +15 -15
- package/lib/helperFunctions/sleep.d.ts +6 -6
- package/lib/helperFunctions/sleep.js +12 -12
- package/lib/helperFunctions/stringFunctions.d.ts +8 -8
- package/lib/helperFunctions/stringFunctions.js +13 -13
- package/lib/index.d.ts +12 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +54 -52
- package/lib/services/CLIService.d.ts +68 -68
- package/lib/services/CLIService.js +194 -194
- package/lib/services/StringService.d.ts +13 -13
- package/lib/services/StringService.js +18 -18
- package/lib/services/applications/ChromeService.d.ts +19 -19
- package/lib/services/applications/ChromeService.js +60 -60
- package/lib/services/applications/DockerService.d.ts +20 -20
- package/lib/services/applications/DockerService.js +88 -88
- package/lib/services/applications/FileSystemService.d.ts +18 -17
- package/lib/services/applications/FileSystemService.d.ts.map +1 -1
- package/lib/services/applications/FileSystemService.js +97 -87
- package/lib/services/applications/ITermService.d.ts +8 -0
- package/lib/services/applications/ITermService.d.ts.map +1 -0
- package/lib/services/applications/ITermService.js +45 -0
- package/lib/services/applications/OsaScriptService.d.ts +4 -0
- package/lib/services/applications/OsaScriptService.d.ts.map +1 -0
- package/lib/services/applications/OsaScriptService.js +31 -0
- package/lib/utils/CurrentEnv.d.ts +62 -61
- package/lib/utils/CurrentEnv.d.ts.map +1 -1
- package/lib/utils/CurrentEnv.js +137 -133
- package/lib/utils/Logger.d.ts +67 -67
- package/lib/utils/Logger.js +112 -112
- package/lib/utils/OsaScriptBuilder.d.ts +45 -0
- package/lib/utils/OsaScriptBuilder.d.ts.map +1 -0
- package/lib/utils/OsaScriptBuilder.js +53 -0
- package/package.json +1 -1
- package/lib/helperFunctions/applications/applications.d.ts +0 -21
- package/lib/helperFunctions/applications/applications.d.ts.map +0 -1
- package/lib/helperFunctions/applications/applications.js +0 -26
- package/lib/helperFunctions/applications/chromeApplication.d.ts +0 -8
- package/lib/helperFunctions/applications/chromeApplication.d.ts.map +0 -1
- package/lib/helperFunctions/applications/chromeApplication.js +0 -63
- package/lib/helperFunctions/applications/fileSystemApplication.d.ts +0 -8
- package/lib/helperFunctions/applications/fileSystemApplication.d.ts.map +0 -1
- package/lib/helperFunctions/applications/fileSystemApplication.js +0 -51
- package/lib/helperFunctions/cmd.d.ts +0 -54
- package/lib/helperFunctions/cmd.d.ts.map +0 -1
- package/lib/helperFunctions/cmd.js +0 -177
- package/lib/helperFunctions/fileFunctions.d.ts +0 -10
- package/lib/helperFunctions/fileFunctions.d.ts.map +0 -1
- package/lib/helperFunctions/fileFunctions.js +0 -43
- package/lib/helperFunctions/input.d.ts +0 -8
- package/lib/helperFunctions/input.d.ts.map +0 -1
- package/lib/helperFunctions/input.js +0 -48
- package/lib/utils/Log.d.ts +0 -69
- package/lib/utils/Log.d.ts.map +0 -1
- package/lib/utils/Log.js +0 -112
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determines if the dates are on the same day.
|
|
3
|
-
*
|
|
4
|
-
* @param first the first date
|
|
5
|
-
* @param second the second date
|
|
6
|
-
* @returns true if they are on the same day
|
|
7
|
-
*/
|
|
8
|
-
declare function datesAreOnSameDay(first: Date, second: Date): boolean;
|
|
9
|
-
export default datesAreOnSameDay;
|
|
1
|
+
/**
|
|
2
|
+
* Determines if the dates are on the same day.
|
|
3
|
+
*
|
|
4
|
+
* @param first the first date
|
|
5
|
+
* @param second the second date
|
|
6
|
+
* @returns true if they are on the same day
|
|
7
|
+
*/
|
|
8
|
+
declare function datesAreOnSameDay(first: Date, second: Date): boolean;
|
|
9
|
+
export default datesAreOnSameDay;
|
|
10
10
|
//# sourceMappingURL=dateFunctions.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Determines if the dates are on the same day.
|
|
5
|
-
*
|
|
6
|
-
* @param first the first date
|
|
7
|
-
* @param second the second date
|
|
8
|
-
* @returns true if they are on the same day
|
|
9
|
-
*/
|
|
10
|
-
function datesAreOnSameDay(first, second) {
|
|
11
|
-
return (first.getFullYear() === second.getFullYear() &&
|
|
12
|
-
first.getMonth() === second.getMonth() &&
|
|
13
|
-
first.getDate() === second.getDate());
|
|
14
|
-
}
|
|
15
|
-
exports.default = datesAreOnSameDay;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Determines if the dates are on the same day.
|
|
5
|
+
*
|
|
6
|
+
* @param first the first date
|
|
7
|
+
* @param second the second date
|
|
8
|
+
* @returns true if they are on the same day
|
|
9
|
+
*/
|
|
10
|
+
function datesAreOnSameDay(first, second) {
|
|
11
|
+
return (first.getFullYear() === second.getFullYear() &&
|
|
12
|
+
first.getMonth() === second.getMonth() &&
|
|
13
|
+
first.getDate() === second.getDate());
|
|
14
|
+
}
|
|
15
|
+
exports.default = datesAreOnSameDay;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sleeps for the given amount of milliseconds, and resolves once finished.
|
|
3
|
-
*
|
|
4
|
-
* @param ms the number of milliseconds to sleep
|
|
5
|
-
*/
|
|
6
|
-
export default function sleep(ms: number): Promise<void>;
|
|
1
|
+
/**
|
|
2
|
+
* Sleeps for the given amount of milliseconds, and resolves once finished.
|
|
3
|
+
*
|
|
4
|
+
* @param ms the number of milliseconds to sleep
|
|
5
|
+
*/
|
|
6
|
+
export default function sleep(ms: number): Promise<void>;
|
|
7
7
|
//# sourceMappingURL=sleep.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Sleeps for the given amount of milliseconds, and resolves once finished.
|
|
5
|
-
*
|
|
6
|
-
* @param ms the number of milliseconds to sleep
|
|
7
|
-
*/
|
|
8
|
-
function sleep(ms) {
|
|
9
|
-
// eslint-disable-next-line no-promise-executor-return
|
|
10
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
-
}
|
|
12
|
-
exports.default = sleep;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Sleeps for the given amount of milliseconds, and resolves once finished.
|
|
5
|
+
*
|
|
6
|
+
* @param ms the number of milliseconds to sleep
|
|
7
|
+
*/
|
|
8
|
+
function sleep(ms) {
|
|
9
|
+
// eslint-disable-next-line no-promise-executor-return
|
|
10
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
+
}
|
|
12
|
+
exports.default = sleep;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the file extension of the provided file name.
|
|
3
|
-
*
|
|
4
|
-
* @param fileName the full name of the file or the entire file path
|
|
5
|
-
* @returns a string containing the extension of the file name or undefined
|
|
6
|
-
* if there is no extension
|
|
7
|
-
*/
|
|
8
|
-
export default function getFileNameExtension(fileName: string): string | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* Gets the file extension of the provided file name.
|
|
3
|
+
*
|
|
4
|
+
* @param fileName the full name of the file or the entire file path
|
|
5
|
+
* @returns a string containing the extension of the file name or undefined
|
|
6
|
+
* if there is no extension
|
|
7
|
+
*/
|
|
8
|
+
export default function getFileNameExtension(fileName: string): string | undefined;
|
|
9
9
|
//# sourceMappingURL=stringFunctions.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Gets the file extension of the provided file name.
|
|
5
|
-
*
|
|
6
|
-
* @param fileName the full name of the file or the entire file path
|
|
7
|
-
* @returns a string containing the extension of the file name or undefined
|
|
8
|
-
* if there is no extension
|
|
9
|
-
*/
|
|
10
|
-
function getFileNameExtension(fileName) {
|
|
11
|
-
return fileName.split('.').pop();
|
|
12
|
-
}
|
|
13
|
-
exports.default = getFileNameExtension;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Gets the file extension of the provided file name.
|
|
5
|
+
*
|
|
6
|
+
* @param fileName the full name of the file or the entire file path
|
|
7
|
+
* @returns a string containing the extension of the file name or undefined
|
|
8
|
+
* if there is no extension
|
|
9
|
+
*/
|
|
10
|
+
function getFileNameExtension(fileName) {
|
|
11
|
+
return fileName.split('.').pop();
|
|
12
|
+
}
|
|
13
|
+
exports.default = getFileNameExtension;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import datesAreOnSameDay from './helperFunctions/dateFunctions';
|
|
2
|
-
import sleep from './helperFunctions/sleep';
|
|
3
|
-
import getFileNameExtension from './helperFunctions/stringFunctions';
|
|
4
|
-
import ChromeService from './services/applications/ChromeService';
|
|
5
|
-
import DockerService from './services/applications/DockerService';
|
|
6
|
-
import FileSystemService from './services/applications/FileSystemService';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
1
|
+
import datesAreOnSameDay from './helperFunctions/dateFunctions';
|
|
2
|
+
import sleep from './helperFunctions/sleep';
|
|
3
|
+
import getFileNameExtension from './helperFunctions/stringFunctions';
|
|
4
|
+
import ChromeService from './services/applications/ChromeService';
|
|
5
|
+
import DockerService from './services/applications/DockerService';
|
|
6
|
+
import FileSystemService from './services/applications/FileSystemService';
|
|
7
|
+
import ITermService from './services/applications/ITermService';
|
|
8
|
+
import CLIService from './services/CLIService';
|
|
9
|
+
import StringService from './services/StringService';
|
|
10
|
+
import CurrentEnv, { OperatingSystemType, ShellType, TerminalType } from './utils/CurrentEnv';
|
|
11
|
+
import Logger from './utils/Logger';
|
|
12
|
+
export { CLIService, StringService, CurrentEnv, ChromeService, DockerService, FileSystemService, sleep, OperatingSystemType, ShellType, Logger, TerminalType, datesAreOnSameDay, getFileNameExtension, ITermService };
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,oBAAoB,MAAM,mCAAmC,CAAC;AACrE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,iBAAiB,MAAM,2CAA2C,CAAC;AAC1E,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,UAAU,EAAE,EACjB,mBAAmB,EACnB,SAAS,EACT,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,gBAAgB,CAAC;AAGpC,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,oBAAoB,MAAM,mCAAmC,CAAC;AACrE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,iBAAiB,MAAM,2CAA2C,CAAC;AAC1E,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,UAAU,EAAE,EACjB,mBAAmB,EACnB,SAAS,EACT,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,gBAAgB,CAAC;AAGpC,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACb,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getFileNameExtension = exports.datesAreOnSameDay = exports.TerminalType = exports.Logger = exports.ShellType = exports.OperatingSystemType = exports.sleep = exports.FileSystemService = exports.DockerService = exports.ChromeService = exports.CurrentEnv = exports.StringService = exports.CLIService = void 0;
|
|
30
|
-
const dateFunctions_1 = __importDefault(require("./helperFunctions/dateFunctions"));
|
|
31
|
-
exports.datesAreOnSameDay = dateFunctions_1.default;
|
|
32
|
-
const sleep_1 = __importDefault(require("./helperFunctions/sleep"));
|
|
33
|
-
exports.sleep = sleep_1.default;
|
|
34
|
-
const stringFunctions_1 = __importDefault(require("./helperFunctions/stringFunctions"));
|
|
35
|
-
exports.getFileNameExtension = stringFunctions_1.default;
|
|
36
|
-
const ChromeService_1 = __importDefault(require("./services/applications/ChromeService"));
|
|
37
|
-
exports.ChromeService = ChromeService_1.default;
|
|
38
|
-
const DockerService_1 = __importDefault(require("./services/applications/DockerService"));
|
|
39
|
-
exports.DockerService = DockerService_1.default;
|
|
40
|
-
const FileSystemService_1 = __importDefault(require("./services/applications/FileSystemService"));
|
|
41
|
-
exports.FileSystemService = FileSystemService_1.default;
|
|
42
|
-
const
|
|
43
|
-
exports.
|
|
44
|
-
const
|
|
45
|
-
exports.
|
|
46
|
-
const
|
|
47
|
-
exports.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Object.defineProperty(exports, "
|
|
51
|
-
|
|
52
|
-
exports
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ITermService = exports.getFileNameExtension = exports.datesAreOnSameDay = exports.TerminalType = exports.Logger = exports.ShellType = exports.OperatingSystemType = exports.sleep = exports.FileSystemService = exports.DockerService = exports.ChromeService = exports.CurrentEnv = exports.StringService = exports.CLIService = void 0;
|
|
30
|
+
const dateFunctions_1 = __importDefault(require("./helperFunctions/dateFunctions"));
|
|
31
|
+
exports.datesAreOnSameDay = dateFunctions_1.default;
|
|
32
|
+
const sleep_1 = __importDefault(require("./helperFunctions/sleep"));
|
|
33
|
+
exports.sleep = sleep_1.default;
|
|
34
|
+
const stringFunctions_1 = __importDefault(require("./helperFunctions/stringFunctions"));
|
|
35
|
+
exports.getFileNameExtension = stringFunctions_1.default;
|
|
36
|
+
const ChromeService_1 = __importDefault(require("./services/applications/ChromeService"));
|
|
37
|
+
exports.ChromeService = ChromeService_1.default;
|
|
38
|
+
const DockerService_1 = __importDefault(require("./services/applications/DockerService"));
|
|
39
|
+
exports.DockerService = DockerService_1.default;
|
|
40
|
+
const FileSystemService_1 = __importDefault(require("./services/applications/FileSystemService"));
|
|
41
|
+
exports.FileSystemService = FileSystemService_1.default;
|
|
42
|
+
const ITermService_1 = __importDefault(require("./services/applications/ITermService"));
|
|
43
|
+
exports.ITermService = ITermService_1.default;
|
|
44
|
+
const CLIService_1 = __importDefault(require("./services/CLIService"));
|
|
45
|
+
exports.CLIService = CLIService_1.default;
|
|
46
|
+
const StringService_1 = __importDefault(require("./services/StringService"));
|
|
47
|
+
exports.StringService = StringService_1.default;
|
|
48
|
+
const CurrentEnv_1 = __importStar(require("./utils/CurrentEnv"));
|
|
49
|
+
exports.CurrentEnv = CurrentEnv_1.default;
|
|
50
|
+
Object.defineProperty(exports, "OperatingSystemType", { enumerable: true, get: function () { return CurrentEnv_1.OperatingSystemType; } });
|
|
51
|
+
Object.defineProperty(exports, "ShellType", { enumerable: true, get: function () { return CurrentEnv_1.ShellType; } });
|
|
52
|
+
Object.defineProperty(exports, "TerminalType", { enumerable: true, get: function () { return CurrentEnv_1.TerminalType; } });
|
|
53
|
+
const Logger_1 = __importDefault(require("./utils/Logger"));
|
|
54
|
+
exports.Logger = Logger_1.default;
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
type ExecCmdReturnType = {
|
|
2
|
-
didComplete: boolean;
|
|
3
|
-
output: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* A service which can be used to interact with the command line on the current
|
|
7
|
-
* system.
|
|
8
|
-
*/
|
|
9
|
-
export default class CLIService {
|
|
10
|
-
private static POWERSHELL_PREFIX;
|
|
11
|
-
/**
|
|
12
|
-
* Executes the given command in a shell environment. Spins up a separate
|
|
13
|
-
* process to execute the command and returns a promise once it is completely
|
|
14
|
-
* finished.
|
|
15
|
-
*
|
|
16
|
-
* The shell environment chosen is determined by the `CurrentEnv` class.
|
|
17
|
-
*
|
|
18
|
-
* @param cmd the command to run. This is ran as a normal execution where the
|
|
19
|
-
* output is all returned at once after completion. For example this could be
|
|
20
|
-
* `ls -a`.
|
|
21
|
-
*
|
|
22
|
-
* @param logError if set to false, it will not output a log if an error
|
|
23
|
-
* occurs in `stderr` when executing the function. This can be useful if
|
|
24
|
-
* a command regularly outputs an error even when it succeeds. This only
|
|
25
|
-
* applies to commands ran with normal execution.
|
|
26
|
-
*
|
|
27
|
-
* @param cwd the current working directory to run the command in. If not
|
|
28
|
-
* provided, it will use the current working directory of the process.
|
|
29
|
-
*
|
|
30
|
-
* @param useProfile if set to true will use the current profile or zshrc of
|
|
31
|
-
* the shell environment. By default this is false.
|
|
32
|
-
*
|
|
33
|
-
* @returns an object that holds the output and true if the command completed
|
|
34
|
-
* successfully or false if it did not.
|
|
35
|
-
*/
|
|
36
|
-
static execCmd(cmd: string, logError?: boolean, cwd?: string, useProfile?: boolean): Promise<ExecCmdReturnType>;
|
|
37
|
-
/**
|
|
38
|
-
* Executes the given command but fulfills the
|
|
39
|
-
* promise when either the command completes, or the given number of ms have
|
|
40
|
-
* passed. Whichever comes first.
|
|
41
|
-
*
|
|
42
|
-
* @param command the command to execute
|
|
43
|
-
* @param ms the number of milliseconds to wait. This is 5 seconds by default.
|
|
44
|
-
*/
|
|
45
|
-
static execCmdWithTimeout(command: string, ms?: number): Promise<ExecCmdReturnType>;
|
|
46
|
-
/**
|
|
47
|
-
* Spawns a new process where the command is ran as a stream where all
|
|
48
|
-
* output is streamed to the console.
|
|
49
|
-
* This is helpful for long-running commands or commands
|
|
50
|
-
* that output a lot of data. For example `yarn` or `npm install`.
|
|
51
|
-
* All of the output from this is logged by default because of the listeners
|
|
52
|
-
* involved. This could be changed in the future though.
|
|
53
|
-
*
|
|
54
|
-
* @param cmd the command to run. This is the the first argument passed to the
|
|
55
|
-
* `spawn` function. For example this could be `npm`.
|
|
56
|
-
* @param args the arguments to pass to the command. For example this could be
|
|
57
|
-
* `['install', 'react']`.
|
|
58
|
-
*/
|
|
59
|
-
static spawnCmd(cmd: string, args?: string[], currentWorkingDirectory?: string): Promise<ExecCmdReturnType>;
|
|
60
|
-
/**
|
|
61
|
-
* Gets input from the user on command line.
|
|
62
|
-
*
|
|
63
|
-
* @param promptToUser the prompt that should be provided to the user. Include
|
|
64
|
-
* a newline at the end if you want there to be one.
|
|
65
|
-
*/
|
|
66
|
-
static getUserInput(promptToUser: string): Promise<string>;
|
|
67
|
-
}
|
|
68
|
-
export {};
|
|
1
|
+
type ExecCmdReturnType = {
|
|
2
|
+
didComplete: boolean;
|
|
3
|
+
output: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* A service which can be used to interact with the command line on the current
|
|
7
|
+
* system.
|
|
8
|
+
*/
|
|
9
|
+
export default class CLIService {
|
|
10
|
+
private static POWERSHELL_PREFIX;
|
|
11
|
+
/**
|
|
12
|
+
* Executes the given command in a shell environment. Spins up a separate
|
|
13
|
+
* process to execute the command and returns a promise once it is completely
|
|
14
|
+
* finished.
|
|
15
|
+
*
|
|
16
|
+
* The shell environment chosen is determined by the `CurrentEnv` class.
|
|
17
|
+
*
|
|
18
|
+
* @param cmd the command to run. This is ran as a normal execution where the
|
|
19
|
+
* output is all returned at once after completion. For example this could be
|
|
20
|
+
* `ls -a`.
|
|
21
|
+
*
|
|
22
|
+
* @param logError if set to false, it will not output a log if an error
|
|
23
|
+
* occurs in `stderr` when executing the function. This can be useful if
|
|
24
|
+
* a command regularly outputs an error even when it succeeds. This only
|
|
25
|
+
* applies to commands ran with normal execution.
|
|
26
|
+
*
|
|
27
|
+
* @param cwd the current working directory to run the command in. If not
|
|
28
|
+
* provided, it will use the current working directory of the process.
|
|
29
|
+
*
|
|
30
|
+
* @param useProfile if set to true will use the current profile or zshrc of
|
|
31
|
+
* the shell environment. By default this is false.
|
|
32
|
+
*
|
|
33
|
+
* @returns an object that holds the output and true if the command completed
|
|
34
|
+
* successfully or false if it did not.
|
|
35
|
+
*/
|
|
36
|
+
static execCmd(cmd: string, logError?: boolean, cwd?: string, useProfile?: boolean): Promise<ExecCmdReturnType>;
|
|
37
|
+
/**
|
|
38
|
+
* Executes the given command but fulfills the
|
|
39
|
+
* promise when either the command completes, or the given number of ms have
|
|
40
|
+
* passed. Whichever comes first.
|
|
41
|
+
*
|
|
42
|
+
* @param command the command to execute
|
|
43
|
+
* @param ms the number of milliseconds to wait. This is 5 seconds by default.
|
|
44
|
+
*/
|
|
45
|
+
static execCmdWithTimeout(command: string, ms?: number): Promise<ExecCmdReturnType>;
|
|
46
|
+
/**
|
|
47
|
+
* Spawns a new process where the command is ran as a stream where all
|
|
48
|
+
* output is streamed to the console.
|
|
49
|
+
* This is helpful for long-running commands or commands
|
|
50
|
+
* that output a lot of data. For example `yarn` or `npm install`.
|
|
51
|
+
* All of the output from this is logged by default because of the listeners
|
|
52
|
+
* involved. This could be changed in the future though.
|
|
53
|
+
*
|
|
54
|
+
* @param cmd the command to run. This is the the first argument passed to the
|
|
55
|
+
* `spawn` function. For example this could be `npm`.
|
|
56
|
+
* @param args the arguments to pass to the command. For example this could be
|
|
57
|
+
* `['install', 'react']`.
|
|
58
|
+
*/
|
|
59
|
+
static spawnCmd(cmd: string, args?: string[], currentWorkingDirectory?: string): Promise<ExecCmdReturnType>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets input from the user on command line.
|
|
62
|
+
*
|
|
63
|
+
* @param promptToUser the prompt that should be provided to the user. Include
|
|
64
|
+
* a newline at the end if you want there to be one.
|
|
65
|
+
*/
|
|
66
|
+
static getUserInput(promptToUser: string): Promise<string>;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
69
69
|
//# sourceMappingURL=CLIService.d.ts.map
|