Compare commits
114 Commits
Author | SHA1 | Date | |
---|---|---|---|
cd3675280a | |||
7c14102324 | |||
cb41dbaf1c | |||
149eb800e7 | |||
91e84c8422 | |||
ff26cd0678 | |||
acdd729e06 | |||
522fbfc42c | |||
b854715940 | |||
35f59054f8 | |||
c9a3de2207 | |||
6904097960 | |||
1474fd541f | |||
9befccefd6 | |||
415c9de553 | |||
980a2c9781 | |||
c13a0f5d48 | |||
71e239c5b1 | |||
0d7c87051b | |||
067f1a9c17 | |||
e7cf3bcb5e | |||
18cfa3e16a | |||
ea921766dc | |||
7e6d632afb | |||
25c61d7d7d | |||
d84c7a16a4 | |||
c5937da870 | |||
ec29db26ef | |||
e4e08910c7 | |||
730a4a05a4 | |||
20a2804924 | |||
d7247add7e | |||
b304b01ab6 | |||
9ba5447e72 | |||
6cb7ab8f19 | |||
efdb80ddba | |||
db712b2223 | |||
0199160013 | |||
199fa19899 | |||
23a3230f07 | |||
ad0b7ac21c | |||
c8c0cbd47a | |||
213dac474e | |||
a4c188051a | |||
62195b63d6 | |||
16ba3803a4 | |||
613241cdcb | |||
f5df21e144 | |||
ba8c2d06d8 | |||
9bb0999f0e | |||
1beb3a0bbe | |||
c1133e9131 | |||
48dd3c3cca | |||
f0a5be41ea | |||
970d28a4ad | |||
76f2126eb3 | |||
a6f164602c | |||
f8457ad58d | |||
8ceac74a1f | |||
f63c4456bf | |||
32c33cad5b | |||
0758e58fa4 | |||
e981ca6bdd | |||
2853a48708 | |||
389f8f4a52 | |||
c1a537f052 | |||
4701341c0c | |||
d5d347721a | |||
6a047d6333 | |||
6e7b4dd18e | |||
debc5f1524 | |||
8d03561762 | |||
f516a6e753 | |||
1c4f6a8bf9 | |||
4fe3775904 | |||
dcee2d6233 | |||
39d457382f | |||
e6ed457501 | |||
0a6484762c | |||
baa3e4e6e9 | |||
0d68361381 | |||
286d80328c | |||
2a71f00ab0 | |||
80a44a43cb | |||
5ea780acda | |||
7c9cf6e70d | |||
697f789b55 | |||
f452964779 | |||
f2db8dc41f | |||
2ca593297c | |||
a63ae38437 | |||
03d442bf60 | |||
901348dfe9 | |||
2e94eb5467 | |||
f2f048a40b | |||
db506a6eb1 | |||
66cdc7632e | |||
604fa228f7 | |||
e0e8e9f29a | |||
aa54912346 | |||
5457dcfc8d | |||
5c7b0fafea | |||
4470250091 | |||
5f17ca3d63 | |||
226a518369 | |||
9709920a72 | |||
b6589d0850 | |||
0f2d68cf5f | |||
01e6411c29 | |||
b356bcbaed | |||
35b81dc6d9 | |||
47321b02b8 | |||
7c0af2b0bc | |||
ced0ce7b53 |
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,4 +1,20 @@
|
|||||||
|
.nogit/
|
||||||
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
node_modules/
|
|
||||||
pages/
|
|
||||||
public/
|
public/
|
||||||
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_*/
|
||||||
|
|
||||||
|
# custom
|
@ -1,68 +0,0 @@
|
|||||||
# gitzone standard
|
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .yarn/
|
|
||||||
key: "$CI_BUILD_STAGE"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- trigger
|
|
||||||
- pages
|
|
||||||
|
|
||||||
testLEGACY:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci test legacy
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
testLTS:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci test lts
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testSTABLE:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci test stable
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: trigger
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
pages:
|
|
||||||
image: hosttoday/ht-docker-node:npmpage
|
|
||||||
stage: pages
|
|
||||||
script:
|
|
||||||
- npmci command npmpage --publish gitlab
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"command": "npm test",
|
||||||
|
"name": "Run npm test",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
.vscode/settings.json
vendored
Normal file
26
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"json.schemas": [
|
||||||
|
{
|
||||||
|
"fileMatch": ["/npmextra.json"],
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"npmci": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for npmci"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for gitzone",
|
||||||
|
"properties": {
|
||||||
|
"projectType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
28
README.md
28
README.md
@ -1,28 +0,0 @@
|
|||||||
# smartshell
|
|
||||||
shell actions designed as promises
|
|
||||||
|
|
||||||
## Availabililty
|
|
||||||
[](https://www.npmjs.com/package/smartshell)
|
|
||||||
[](https://GitLab.com/pushrocks/smartshell)
|
|
||||||
[](https://github.com/pushrocks/smartshell)
|
|
||||||
[](https://pushrocks.gitlab.io/smartshell/)
|
|
||||||
|
|
||||||
## Status for master
|
|
||||||
[](https://GitLab.com/pushrocks/smartshell/commits/master)
|
|
||||||
[](https://GitLab.com/pushrocks/smartshell/commits/master)
|
|
||||||
[](https://www.npmjs.com/package/smartshell)
|
|
||||||
[](https://david-dm.org/pushrocks/smartshell)
|
|
||||||
[](https://www.bithound.io/github/pushrocks/smartshell/master/dependencies/npm)
|
|
||||||
[](https://www.bithound.io/github/pushrocks/smartshell)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
Use TypeScript for best in class instellisense.
|
|
||||||
|
|
||||||
For further information read the linked docs at the top of this README.
|
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
|
||||||
|
|
||||||
[](https://push.rocks)
|
|
87
changelog.md
Normal file
87
changelog.md
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-02-20 - 3.2.3 - fix(core)
|
||||||
|
Refactor Smartshell class for improved code clarity and performance
|
||||||
|
|
||||||
|
- Refactored `_exec` method to improve code clarity.
|
||||||
|
- Introduced `IExecOptions` interface for better type handling.
|
||||||
|
- Replaced promise defer with native promises in command execution methods.
|
||||||
|
- Improved logging and error handling in child process execution.
|
||||||
|
- Ensured robust process management with signals handling.
|
||||||
|
|
||||||
|
## 2024-12-13 - 3.2.2 - fix(core)
|
||||||
|
Fix minor code style and formatting issues
|
||||||
|
|
||||||
|
|
||||||
|
## 2024-12-13 - 3.2.1 - fix(dependencies)
|
||||||
|
Update @types/node dependency version
|
||||||
|
|
||||||
|
- Updated @types/node dependency from version ^22.10.1 to ^22.10.2.
|
||||||
|
|
||||||
|
## 2024-12-09 - 3.2.0 - feat(SmartExecution)
|
||||||
|
Add support for scheduling restarts to SmartExecution
|
||||||
|
|
||||||
|
- Introduced the ability to handle consecutive restarts efficiently in SmartExecution.
|
||||||
|
- Ensures that multiple restart requests merge into a single additional restart request if one is already in progress.
|
||||||
|
|
||||||
|
## 2024-12-09 - 3.1.0 - feat(core)
|
||||||
|
Refactor codebase and update dependencies.
|
||||||
|
|
||||||
|
- Refactored core classes with improved structure and modularization.
|
||||||
|
- Updated tsbuild, tsrun, tapbundle, and @types/node dependencies to newer versions.
|
||||||
|
- Improved build script in package.json to use tsbuild with tsfolders.
|
||||||
|
|
||||||
|
## 2024-09-17 - 3.0.6 - fix(core)
|
||||||
|
Fix interactive shell execution and update dependencies
|
||||||
|
|
||||||
|
- Corrected the interactive shell execution logic by separating it into a dedicated method.
|
||||||
|
- Updated development dependencies for `@git.zone/tsbuild`, `@git.zone/tsrun`, `@git.zone/tstest`, `@push.rocks/tapbundle`, and `@types/node`.
|
||||||
|
- Updated runtime dependencies for `@push.rocks/smartpromise`, and `@types/which`.
|
||||||
|
- Removed legacy .gitlab-ci.yml file.
|
||||||
|
|
||||||
|
## 2024-05-29 - 3.0.5 - Documentation
|
||||||
|
update description
|
||||||
|
|
||||||
|
## 2024-04-18 - 3.0.4 to 3.0.5 - Maintenance
|
||||||
|
Bug fixes and configuration updates
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
- update tsconfig
|
||||||
|
- update npmextra.json: githost
|
||||||
|
|
||||||
|
## 2024-03-16 - 3.0.3 to 3.0.4 - Maintenance
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2023-06-22 - 2.0.30 to 3.0.3 - Major Update
|
||||||
|
Major changes including breaking changes, bug fixes, and improvements.
|
||||||
|
|
||||||
|
- BREAKING CHANGE(core): switched to ES syntax and added support for interactivity
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2021-11-07 - 2.0.27 to 2.0.30 - Maintenance
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
- fix(core): cosmetics
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2021-08-17 - 2.0.26 to 2.0.27 - Maintenance
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2020-05-22 - 2.0.25 to 2.0.26 - Maintenance
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2019-08-27 - 2.0.22 to 2.0.25 - Maintenance
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2019-05-28 - 2.0.16 to 2.0.22 - Maintenance
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
- fix(core): update
|
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
export * from './smartshell.wrap';
|
|
||||||
export * from './smartshell.classes.smartshell';
|
|
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -1,8 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
function __export(m) {
|
|
||||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
||||||
}
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
__export(require("./smartshell.wrap"));
|
|
||||||
__export(require("./smartshell.classes.smartshell"));
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHVDQUFpQztBQUNqQyxxREFBK0MifQ==
|
|
28
dist/smartshell.classes.smartshell.d.ts
vendored
28
dist/smartshell.classes.smartshell.d.ts
vendored
@ -1,28 +0,0 @@
|
|||||||
import * as smartshellWrap from './smartshell.wrap';
|
|
||||||
export declare type TExecutor = 'sh' | 'bash';
|
|
||||||
export interface ISmartshellContructorOptions {
|
|
||||||
executor: TExecutor;
|
|
||||||
sourceFilePaths: string[];
|
|
||||||
}
|
|
||||||
export declare class Smartshell {
|
|
||||||
executor: TExecutor;
|
|
||||||
sourceFileArray: string[];
|
|
||||||
constructor(optionsArg: ISmartshellContructorOptions);
|
|
||||||
addSourceFiles(sourceFilePathsArray: string[]): void;
|
|
||||||
cleanSourceFiles(): void;
|
|
||||||
/**
|
|
||||||
* executes silently and returns IExecResult
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
execSilent(commandArg: string): Promise<smartshellWrap.IExecResult>;
|
|
||||||
/**
|
|
||||||
* executes and returns IExecResult
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
exec(commandArg: string): Promise<smartshellWrap.IExecResult>;
|
|
||||||
/**
|
|
||||||
* creates the final sourcing string
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
private createExecString(commandArg);
|
|
||||||
}
|
|
66
dist/smartshell.classes.smartshell.js
vendored
66
dist/smartshell.classes.smartshell.js
vendored
@ -1,66 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const smartshellWrap = require("./smartshell.wrap");
|
|
||||||
class Smartshell {
|
|
||||||
constructor(optionsArg) {
|
|
||||||
this.sourceFileArray = [];
|
|
||||||
this.executor = optionsArg.executor;
|
|
||||||
for (let sourceFilePath of optionsArg.sourceFilePaths) {
|
|
||||||
this.sourceFileArray.push(sourceFilePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addSourceFiles(sourceFilePathsArray) {
|
|
||||||
for (let sourceFilePath of sourceFilePathsArray) {
|
|
||||||
this.sourceFileArray.push(sourceFilePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cleanSourceFiles() {
|
|
||||||
this.sourceFileArray = [];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* executes silently and returns IExecResult
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
execSilent(commandArg) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let execCommand = this.createExecString(commandArg);
|
|
||||||
return yield smartshellWrap.execSilent(execCommand);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* executes and returns IExecResult
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
exec(commandArg) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let execCommand = this.createExecString(commandArg);
|
|
||||||
return yield smartshellWrap.exec(execCommand);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* creates the final sourcing string
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
createExecString(commandArg) {
|
|
||||||
if (this.executor === 'bash') {
|
|
||||||
let sourceString = '';
|
|
||||||
for (let sourceFilePath of this.sourceFileArray) {
|
|
||||||
sourceString = sourceString + `source ${sourceFilePath} && `;
|
|
||||||
}
|
|
||||||
return `bash -c '${sourceString} ${commandArg}'`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return commandArg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Smartshell = Smartshell;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzaGVsbC5jbGFzc2VzLnNtYXJ0c2hlbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNoZWxsLmNsYXNzZXMuc21hcnRzaGVsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQ0Esb0RBQW1EO0FBVW5EO0lBR0UsWUFBYSxVQUF3QztRQURyRCxvQkFBZSxHQUFhLEVBQUUsQ0FBQTtRQUU1QixJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUE7UUFDbkMsR0FBRyxDQUFDLENBQUMsSUFBSSxjQUFjLElBQUksVUFBVSxDQUFDLGVBQWUsQ0FBQyxDQUFDLENBQUM7WUFDdEQsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUE7UUFDM0MsQ0FBQztJQUNILENBQUM7SUFFRCxjQUFjLENBQUUsb0JBQThCO1FBQzVDLEdBQUcsQ0FBQyxDQUFDLElBQUksY0FBYyxJQUFJLG9CQUFvQixDQUFDLENBQUMsQ0FBQztZQUNoRCxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQTtRQUMzQyxDQUFDO0lBQ0gsQ0FBQztJQUVELGdCQUFnQjtRQUNkLElBQUksQ0FBQyxlQUFlLEdBQUcsRUFBRSxDQUFBO0lBQzNCLENBQUM7SUFFRDs7O09BR0c7SUFDRyxVQUFVLENBQUUsVUFBa0I7O1lBQ2xDLElBQUksV0FBVyxHQUFHLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxVQUFVLENBQUMsQ0FBQTtZQUNuRCxNQUFNLENBQUMsTUFBTSxjQUFjLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxDQUFBO1FBQ3JELENBQUM7S0FBQTtJQUVEOzs7T0FHRztJQUNHLElBQUksQ0FBRSxVQUFrQjs7WUFDNUIsSUFBSSxXQUFXLEdBQUcsSUFBSSxDQUFDLGdCQUFnQixDQUFDLFVBQVUsQ0FBQyxDQUFBO1lBQ25ELE1BQU0sQ0FBQyxNQUFNLGNBQWMsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7UUFDL0MsQ0FBQztLQUFBO0lBRUQ7OztPQUdHO0lBQ0ssZ0JBQWdCLENBQUUsVUFBVTtRQUNsQyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxLQUFLLE1BQU0sQ0FBQyxDQUFDLENBQUM7WUFDN0IsSUFBSSxZQUFZLEdBQUcsRUFBRSxDQUFBO1lBQ3JCLEdBQUcsQ0FBQyxDQUFDLElBQUksY0FBYyxJQUFJLElBQUksQ0FBQyxlQUFlLENBQUMsQ0FBQyxDQUFDO2dCQUNoRCxZQUFZLEdBQUcsWUFBWSxHQUFHLFVBQVUsY0FBYyxNQUFNLENBQUE7WUFDOUQsQ0FBQztZQUNELE1BQU0sQ0FBQyxZQUFZLFlBQVksSUFBSSxVQUFVLEdBQUcsQ0FBQTtRQUNsRCxDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDTixNQUFNLENBQUMsVUFBVSxDQUFBO1FBQ25CLENBQUM7SUFDSCxDQUFDO0NBQ0Y7QUFyREQsZ0NBcURDIn0=
|
|
4
dist/smartshell.plugins.d.ts
vendored
4
dist/smartshell.plugins.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
import * as shelljs from 'shelljs';
|
|
||||||
import * as smartq from 'smartq';
|
|
||||||
import * as which from 'which';
|
|
||||||
export { shelljs, smartq, which };
|
|
9
dist/smartshell.plugins.js
vendored
9
dist/smartshell.plugins.js
vendored
@ -1,9 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const shelljs = require("shelljs");
|
|
||||||
exports.shelljs = shelljs;
|
|
||||||
const smartq = require("smartq");
|
|
||||||
exports.smartq = smartq;
|
|
||||||
const which = require("which");
|
|
||||||
exports.which = which;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzaGVsbC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzaGVsbC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQWtDO0FBS2hDLDBCQUFPO0FBSlQsaUNBQWdDO0FBSzlCLHdCQUFNO0FBSlIsK0JBQThCO0FBSzVCLHNCQUFLIn0=
|
|
48
dist/smartshell.wrap.d.ts
vendored
48
dist/smartshell.wrap.d.ts
vendored
@ -1,48 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import { ChildProcess } from 'child_process';
|
|
||||||
/**
|
|
||||||
* interface for ExecResult
|
|
||||||
*/
|
|
||||||
export interface IExecResult {
|
|
||||||
exitCode: number;
|
|
||||||
stdout: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* interface for streaming ExecResult
|
|
||||||
*/
|
|
||||||
export interface IExecResultStreaming {
|
|
||||||
childProcess: ChildProcess;
|
|
||||||
finalPromise: Promise<IExecResult>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* executes a given command async
|
|
||||||
* @param commandStringArg
|
|
||||||
*/
|
|
||||||
export declare let exec: (commandStringArg: string) => Promise<IExecResult>;
|
|
||||||
/**
|
|
||||||
* executes a given command async and silent
|
|
||||||
* @param commandStringArg
|
|
||||||
*/
|
|
||||||
export declare let execSilent: (commandStringArg: string) => Promise<IExecResult>;
|
|
||||||
/**
|
|
||||||
* executes a command and allws you to stream output
|
|
||||||
*/
|
|
||||||
export declare let execStreaming: (commandStringArg: string, silentArg?: boolean) => {
|
|
||||||
childProcess: ChildProcess;
|
|
||||||
finalPromise: Promise<IExecResult>;
|
|
||||||
};
|
|
||||||
export declare let execStreamingSilent: (commandStringArg: string) => {
|
|
||||||
childProcess: ChildProcess;
|
|
||||||
finalPromise: Promise<IExecResult>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* executes a command and returns promise that will be fullfilled once an putput line matches RegexArg
|
|
||||||
* @param commandStringArg
|
|
||||||
* @param regexArg
|
|
||||||
*/
|
|
||||||
export declare let execAndWaitForLine: (commandStringArg: string, regexArg: RegExp, silentArg?: boolean) => Promise<{}>;
|
|
||||||
export declare let execAndWaitForLineSilent: (commandStringArg: string, regexArg: RegExp) => void;
|
|
||||||
/**
|
|
||||||
* get a path
|
|
||||||
*/
|
|
||||||
export declare let which: (cmd: string) => Promise<string>;
|
|
82
dist/smartshell.wrap.js
vendored
82
dist/smartshell.wrap.js
vendored
@ -1,82 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const plugins = require("./smartshell.plugins");
|
|
||||||
/**
|
|
||||||
* executes a given command async
|
|
||||||
* @param commandStringArg
|
|
||||||
*/
|
|
||||||
exports.exec = (commandStringArg) => {
|
|
||||||
let done = plugins.smartq.defer();
|
|
||||||
plugins.shelljs.exec(commandStringArg, { async: true }, (code, stdout, stderr) => {
|
|
||||||
done.resolve({
|
|
||||||
exitCode: code,
|
|
||||||
stdout: stdout
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* executes a given command async and silent
|
|
||||||
* @param commandStringArg
|
|
||||||
*/
|
|
||||||
exports.execSilent = (commandStringArg) => {
|
|
||||||
let done = plugins.smartq.defer();
|
|
||||||
plugins.shelljs.exec(commandStringArg, { async: true, silent: true }, (code, stdout, stderr) => {
|
|
||||||
done.resolve({
|
|
||||||
exitCode: code,
|
|
||||||
stdout: stdout
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* executes a command and allws you to stream output
|
|
||||||
*/
|
|
||||||
exports.execStreaming = (commandStringArg, silentArg = false) => {
|
|
||||||
let childProcessEnded = plugins.smartq.defer();
|
|
||||||
let execChildProcess = plugins.shelljs.exec(commandStringArg, { async: true, silent: silentArg }, (code, stdout, stderr) => {
|
|
||||||
childProcessEnded.resolve({
|
|
||||||
exitCode: code,
|
|
||||||
stdout: stdout
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
childProcess: execChildProcess,
|
|
||||||
finalPromise: childProcessEnded.promise
|
|
||||||
};
|
|
||||||
};
|
|
||||||
exports.execStreamingSilent = (commandStringArg) => {
|
|
||||||
return exports.execStreaming(commandStringArg, true);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* executes a command and returns promise that will be fullfilled once an putput line matches RegexArg
|
|
||||||
* @param commandStringArg
|
|
||||||
* @param regexArg
|
|
||||||
*/
|
|
||||||
exports.execAndWaitForLine = (commandStringArg, regexArg, silentArg = false) => {
|
|
||||||
let done = plugins.smartq.defer();
|
|
||||||
let execStreamingResult = exports.execStreaming(commandStringArg, silentArg);
|
|
||||||
execStreamingResult.childProcess.stdout.on('data', (stdOutChunk) => {
|
|
||||||
if (regexArg.test(stdOutChunk)) {
|
|
||||||
done.resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
exports.execAndWaitForLineSilent = (commandStringArg, regexArg) => {
|
|
||||||
exports.execAndWaitForLine(commandStringArg, regexArg, true);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* get a path
|
|
||||||
*/
|
|
||||||
exports.which = (cmd) => {
|
|
||||||
let done = plugins.smartq.defer();
|
|
||||||
plugins.which(cmd, (err, path) => {
|
|
||||||
if (err) {
|
|
||||||
done.reject(err);
|
|
||||||
}
|
|
||||||
done.resolve(path);
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzaGVsbC53cmFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzaGVsbC53cmFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsZ0RBQStDO0FBc0IvQzs7O0dBR0c7QUFDUSxRQUFBLElBQUksR0FBRyxDQUFDLGdCQUF3QjtJQUN6QyxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBZSxDQUFBO0lBQzlDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLGdCQUFnQixFQUFFLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRSxFQUFFLENBQUMsSUFBSSxFQUFFLE1BQU0sRUFBRSxNQUFNO1FBQzNFLElBQUksQ0FBQyxPQUFPLENBQUM7WUFDWCxRQUFRLEVBQUUsSUFBSTtZQUNkLE1BQU0sRUFBRSxNQUFNO1NBQ2YsQ0FBQyxDQUFBO0lBQ0osQ0FBQyxDQUFDLENBQUE7SUFDRixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtBQUNyQixDQUFDLENBQUE7QUFFRDs7O0dBR0c7QUFDUSxRQUFBLFVBQVUsR0FBRyxDQUFDLGdCQUF3QjtJQUMvQyxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBZSxDQUFBO0lBQzlDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLGdCQUFnQixFQUFFLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLEVBQUUsQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFLE1BQU07UUFDekYsSUFBSSxDQUFDLE9BQU8sQ0FBQztZQUNYLFFBQVEsRUFBRSxJQUFJO1lBQ2QsTUFBTSxFQUFFLE1BQU07U0FDZixDQUFDLENBQUE7SUFDSixDQUFDLENBQUMsQ0FBQTtJQUNGLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3JCLENBQUMsQ0FBQTtBQUVEOztHQUVHO0FBQ1EsUUFBQSxhQUFhLEdBQUcsQ0FBQyxnQkFBd0IsRUFBRSxZQUFxQixLQUFLO0lBQzlFLElBQUksaUJBQWlCLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQWUsQ0FBQTtJQUMzRCxJQUFJLGdCQUFnQixHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLGdCQUFnQixFQUFFLEVBQUMsS0FBSyxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFDLEVBQUUsQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFLE1BQU07UUFDbkgsaUJBQWlCLENBQUMsT0FBTyxDQUFDO1lBQ3hCLFFBQVEsRUFBRSxJQUFJO1lBQ2QsTUFBTSxFQUFFLE1BQU07U0FDZixDQUFDLENBQUE7SUFDSixDQUFDLENBQUMsQ0FBQTtJQUNGLE1BQU0sQ0FBQztRQUNMLFlBQVksRUFBRSxnQkFBZ0I7UUFDOUIsWUFBWSxFQUFFLGlCQUFpQixDQUFDLE9BQU87S0FDeEMsQ0FBQTtBQUNILENBQUMsQ0FBQTtBQUVVLFFBQUEsbUJBQW1CLEdBQUcsQ0FBQyxnQkFBd0I7SUFDeEQsTUFBTSxDQUFDLHFCQUFhLENBQUMsZ0JBQWdCLEVBQUUsSUFBSSxDQUFDLENBQUE7QUFDOUMsQ0FBQyxDQUFBO0FBRUQ7Ozs7R0FJRztBQUNRLFFBQUEsa0JBQWtCLEdBQUcsQ0FBQyxnQkFBd0IsRUFBRSxRQUFnQixFQUFFLFlBQXFCLEtBQUs7SUFDckcsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsQ0FBQTtJQUNqQyxJQUFJLG1CQUFtQixHQUFHLHFCQUFhLENBQUMsZ0JBQWdCLEVBQUUsU0FBUyxDQUFDLENBQUE7SUFDcEUsbUJBQW1CLENBQUMsWUFBWSxDQUFDLE1BQU0sQ0FBQyxFQUFFLENBQUMsTUFBTSxFQUFFLENBQUMsV0FBbUI7UUFDckUsRUFBRSxDQUFDLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDL0IsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO1FBQ2hCLENBQUM7SUFDSCxDQUFDLENBQUMsQ0FBQTtJQUNGLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3JCLENBQUMsQ0FBQTtBQUVVLFFBQUEsd0JBQXdCLEdBQUcsQ0FBQyxnQkFBd0IsRUFBRSxRQUFnQjtJQUMvRSwwQkFBa0IsQ0FBQyxnQkFBZ0IsRUFBRSxRQUFRLEVBQUUsSUFBSSxDQUFDLENBQUE7QUFDdEQsQ0FBQyxDQUFBO0FBRUQ7O0dBRUc7QUFDUSxRQUFBLEtBQUssR0FBRyxDQUFDLEdBQVc7SUFDN0IsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQVUsQ0FBQTtJQUN6QyxPQUFPLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxDQUFDLEdBQUcsRUFBRSxJQUFZO1FBQ25DLEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7WUFDUixJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1FBQ2xCLENBQUM7UUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFBO0lBQ3BCLENBQUMsQ0FBQyxDQUFBO0lBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDckIsQ0FBQyxDQUFBIn0=
|
|
@ -1,8 +1,32 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"globalNpmTools": [
|
"npmGlobalTools": [],
|
||||||
"npmts",
|
"npmAccessLevel": "public",
|
||||||
"ts-node"
|
"npmRegistryUrl": "registry.npmjs.org"
|
||||||
]
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
|
"module": {
|
||||||
|
"githost": "code.foss.global",
|
||||||
|
"gitscope": "push.rocks",
|
||||||
|
"gitrepo": "smartshell",
|
||||||
|
"description": "A library for executing shell commands using promises.",
|
||||||
|
"npmPackagename": "@push.rocks/smartshell",
|
||||||
|
"license": "MIT",
|
||||||
|
"keywords": [
|
||||||
|
"shell commands",
|
||||||
|
"promises",
|
||||||
|
"asynchronous execution",
|
||||||
|
"child processes",
|
||||||
|
"environment management",
|
||||||
|
"command streaming",
|
||||||
|
"interactive commands",
|
||||||
|
"process management",
|
||||||
|
"typescript"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tsdoc": {
|
||||||
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
66
package.json
66
package.json
@ -1,35 +1,65 @@
|
|||||||
{
|
{
|
||||||
"name": "smartshell",
|
"name": "@push.rocks/smartshell",
|
||||||
"version": "1.0.9",
|
"private": false,
|
||||||
"description": "shell actions designed as promises",
|
"version": "3.2.3",
|
||||||
"main": "dist/index.js",
|
"description": "A library for executing shell commands using promises.",
|
||||||
"typings": "dist/index.d.ts",
|
"main": "dist_ts/index.js",
|
||||||
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts --notest && ts-node --compilerOptions '{\"target\":\"es6\"}' test/test.ts)"
|
"test": "(tstest test/)",
|
||||||
|
"build": "(tsbuild tsfolders --web)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+ssh://git@gitlab.com/pushrocks/smartshell.git"
|
"url": "https://code.foss.global/push.rocks/smartshell.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"shell",
|
"shell commands",
|
||||||
"promise"
|
"promises",
|
||||||
|
"asynchronous execution",
|
||||||
|
"child processes",
|
||||||
|
"environment management",
|
||||||
|
"command streaming",
|
||||||
|
"interactive commands",
|
||||||
|
"process management",
|
||||||
|
"typescript"
|
||||||
],
|
],
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/smartshell/issues"
|
"url": "https://gitlab.com/pushrocks/smartshell/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartshell#README",
|
"homepage": "https://code.foss.global/push.rocks/smartshell",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tapbundle": "^1.1.1"
|
"@git.zone/tsbuild": "^2.2.0",
|
||||||
|
"@git.zone/tsrun": "^1.3.3",
|
||||||
|
"@git.zone/tstest": "^1.0.90",
|
||||||
|
"@push.rocks/tapbundle": "^5.5.3",
|
||||||
|
"@types/node": "^22.10.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/shelljs": "^0.7.2",
|
"@push.rocks/smartdelay": "^3.0.1",
|
||||||
"@types/which": "^1.0.28",
|
"@push.rocks/smartexit": "^1.0.23",
|
||||||
"shelljs": "^0.7.8",
|
"@push.rocks/smartpromise": "^4.0.4",
|
||||||
"smartq": "^1.1.6",
|
"@types/which": "^3.0.4",
|
||||||
"typings-global": "^1.0.19",
|
"tree-kill": "^1.2.2",
|
||||||
"which": "^1.2.14"
|
"which": "^5.0.0"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/**/*",
|
||||||
|
"ts_web/**/*",
|
||||||
|
"dist/**/*",
|
||||||
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
9839
pnpm-lock.yaml
generated
Normal file
9839
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
152
readme.md
Normal file
152
readme.md
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
# @push.rocks/smartshell
|
||||||
|
shell actions designed as promises
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
To install `@push.rocks/smartshell`, use npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install @push.rocks/smartshell --save
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you prefer using Yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @push.rocks/smartshell
|
||||||
|
```
|
||||||
|
|
||||||
|
Ensure that you have TypeScript and the related dependencies installed as well since `@push.rocks/smartshell` is designed to work with TypeScript.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The `@push.rocks/smartshell` package simplifies running shell commands within Node.js applications by wrapping these commands within promises. This approach enhances the readability and maintainability of code that relies on shell execution, making it particularly useful in automation scripts, build processes, and any scenario where interaction with the system shell is required.
|
||||||
|
|
||||||
|
### Getting Started with `@push.rocks/smartshell`
|
||||||
|
|
||||||
|
First, ensure that you import `Smartshell` from `@push.rocks/smartshell` using ESM syntax in your TypeScript file:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Smartshell } from '@push.rocks/smartshell';
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating a Smartshell Instance
|
||||||
|
|
||||||
|
Before executing any shell command, you need to create an instance of `Smartshell`. The constructor accepts configuration options such as the shell executor (`bash` or `sh`), and optionally, paths to source files and directories to include in the shell’s environment.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const smartShellInstance = new Smartshell({
|
||||||
|
executor: 'bash', // or 'sh'
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Executing Commands
|
||||||
|
|
||||||
|
#### Basic Execution
|
||||||
|
|
||||||
|
To execute a shell command, use the `exec` method. This method returns a promise that resolves with an execution result object containing `exitCode` and `stdout`.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
(async () => {
|
||||||
|
const result = await smartShellInstance.exec('echo "Hello, SmartShell"');
|
||||||
|
console.log(result.stdout); // Outputs: Hello, SmartShell
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Silent Execution
|
||||||
|
|
||||||
|
If you prefer not to display the output in the console, use `execSilent`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
(async () => {
|
||||||
|
const result = await smartShellInstance.execSilent('ls');
|
||||||
|
console.log(result.stdout); // Outputs the list of files and directories
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Strict Execution
|
||||||
|
|
||||||
|
For scenarios where an execution error should immediately throw an exception, use `execStrict`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const result = await smartShellInstance.execStrict('exit 1');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Command execution failed');
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Streaming Output
|
||||||
|
|
||||||
|
Some commands benefit from streaming output as they execute, especially long-running tasks. For these cases, use `execStreaming`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
(async () => {
|
||||||
|
const execStreamingResult = await smartShellInstance.execStreaming('tail -f /var/log/system.log');
|
||||||
|
|
||||||
|
execStreamingResult.childProcess.stdout.on('data', (data) => {
|
||||||
|
console.log(data.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remember to handle the process termination as necessary.
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Advanced Usage
|
||||||
|
|
||||||
|
#### Executing With Custom Environment Variables
|
||||||
|
|
||||||
|
`smartshell` allows for the execution of commands within a modified environment, facilitating the use of custom variables or altered PATH values:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
(async () => {
|
||||||
|
smartShellInstance.shellEnv.addSourceFiles(['/path/to/envFile']);
|
||||||
|
smartShellInstance.shellEnv.pathDirArray.push('/custom/bin');
|
||||||
|
|
||||||
|
const result = await smartShellInstance.exec('echo $CUSTOM_VAR');
|
||||||
|
console.log(result.stdout); // Outputs the value of CUSTOM_VAR
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Interactive Mode
|
||||||
|
|
||||||
|
For commands that require interactive terminal input (not typically recommended for automated scripts), you can use `execInteractive`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
(async () => {
|
||||||
|
await smartShellInstance.execInteractive('npm init');
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Waiting for Specific Output
|
||||||
|
|
||||||
|
To wait for a specific line before proceeding, you might use `execAndWaitForLine`. This is useful for waiting on a process to log a certain message:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
(async () => {
|
||||||
|
await smartShellInstance.execAndWaitForLine('npm run watch', /Compilation complete./);
|
||||||
|
console.log('The watch process has finished compiling.');
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
Given the vast array of features offered by `@push.rocks/smartshell`, integrating shell operations into your TypeScript applications becomes both straightforward and powerful. By harnessing promises and async/await syntax, `smartshell` effectively streamlines shell interactions, making your code cleaner and more intuitive.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
86
test/test.ts
86
test/test.ts
@ -1,51 +1,57 @@
|
|||||||
import { expect, tap } from 'tapbundle'
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as smartshell from '../dist/index'
|
import * as smartshell from '../ts/index.js';
|
||||||
import * as smartq from 'smartq'
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
|
|
||||||
let testSmartshell: smartshell.Smartshell
|
let testSmartshell: smartshell.Smartshell;
|
||||||
|
|
||||||
tap.test('smartshell should run async', async () => {
|
|
||||||
let execResult = await smartshell.exec('npm -v')
|
|
||||||
expect(execResult.stdout).to.match(/[0-9\.]*/)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('smartshell should run async and silent', async () => {
|
|
||||||
let execResult = await smartshell.execSilent('npm -v')
|
|
||||||
expect(execResult.stdout).to.match(/[0-9\.]*/)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('smartshell should stream a shell execution', async () => {
|
|
||||||
let done = smartq.defer()
|
|
||||||
let execStreamingResponse = smartshell.execStreaming('npm -v')
|
|
||||||
execStreamingResponse.childProcess.stdout.on('data', data => {
|
|
||||||
done.resolve(data)
|
|
||||||
})
|
|
||||||
let data = await done.promise
|
|
||||||
expect(data).to.equal('5.0.4\n')
|
|
||||||
await execStreamingResponse.finalPromise
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test('it should execute and wait for a line in the output', async () => {
|
|
||||||
await smartshell.execAndWaitForLine('npm -v', /5.0.4/)
|
|
||||||
})
|
|
||||||
|
|
||||||
// Smartshell class
|
|
||||||
|
|
||||||
tap.test('smartshell should create a Smartshell instance', async () => {
|
tap.test('smartshell should create a Smartshell instance', async () => {
|
||||||
testSmartshell = new smartshell.Smartshell({
|
testSmartshell = new smartshell.Smartshell({
|
||||||
executor: 'bash',
|
executor: 'bash',
|
||||||
sourceFilePaths: []
|
sourceFilePaths: [],
|
||||||
})
|
});
|
||||||
expect(testSmartshell).to.be.instanceof(smartshell.Smartshell)
|
expect(testSmartshell).toBeInstanceOf(smartshell.Smartshell);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
tap.test('smartshell should run async', async () => {
|
||||||
|
let execResult = await testSmartshell.exec('npm -v');
|
||||||
|
expect(execResult.stdout).toMatch(/[0-9\.]*/);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('smartshell should run async and silent', async () => {
|
||||||
|
let execResult = await testSmartshell.execSilent('npm -v');
|
||||||
|
expect(execResult.stdout).toMatch(/[0-9\.]*/);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('smartshell should stream a shell execution', async () => {
|
||||||
|
let done = smartpromise.defer();
|
||||||
|
let execStreamingResponse = await testSmartshell.execStreaming('npm -v');
|
||||||
|
execStreamingResponse.childProcess.stdout.on('data', (data) => {
|
||||||
|
done.resolve(data);
|
||||||
|
});
|
||||||
|
let data = await done.promise;
|
||||||
|
expect(data).toMatch(/[0-9\.]*/);
|
||||||
|
await execStreamingResponse.finalPromise;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('it should execute and wait for a line in the output', async () => {
|
||||||
|
await testSmartshell.execAndWaitForLine('echo "5.0.4"', /5.0.4/);
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('smartshell should run async', async () => {
|
tap.test('smartshell should run async', async () => {
|
||||||
return testSmartshell.execSilent('sleep 1 && npm -v').then(async (execResult) => {
|
return testSmartshell.execSilent('sleep 1 && npm -v').then(async (execResult) => {
|
||||||
console.log(execResult.stdout)
|
console.log(execResult.stdout);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
|
tap.test('should be able to find git', async () => {
|
||||||
|
await testSmartshell.exec('git --version');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should spawn an interactive cli', async () => {
|
||||||
|
await testSmartshell.execInteractive('echo "hi"');
|
||||||
|
});
|
||||||
|
|
||||||
tap.start({
|
tap.start({
|
||||||
throwOnError: true
|
throwOnError: true,
|
||||||
})
|
});
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@push.rocks/smartshell',
|
||||||
|
version: '3.2.3',
|
||||||
|
description: 'A library for executing shell commands using promises.'
|
||||||
|
}
|
103
ts/classes.shellenv.ts
Normal file
103
ts/classes.shellenv.ts
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
export type TExecutor = 'sh' | 'bash';
|
||||||
|
|
||||||
|
export interface IShellEnvContructorOptions {
|
||||||
|
executor: TExecutor;
|
||||||
|
sourceFilePaths?: string[];
|
||||||
|
pathDirectories?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ShellEnv {
|
||||||
|
executor: TExecutor;
|
||||||
|
sourceFileArray: string[] = [];
|
||||||
|
pathDirArray: string[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor for the shellenv
|
||||||
|
*/
|
||||||
|
constructor(optionsArg: IShellEnvContructorOptions) {
|
||||||
|
this.executor = optionsArg.executor;
|
||||||
|
|
||||||
|
// add sourcefiles
|
||||||
|
if (optionsArg.sourceFilePaths) {
|
||||||
|
this.sourceFileArray = this.sourceFileArray.concat(optionsArg.sourceFilePaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add pathDirectories
|
||||||
|
if (optionsArg.pathDirectories) {
|
||||||
|
this.pathDirArray = this.pathDirArray.concat(optionsArg.pathDirectories);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* imports path into the shell from env if available and returns it with
|
||||||
|
*/
|
||||||
|
private _setPath(commandStringArg: string): string {
|
||||||
|
let commandResult = commandStringArg;
|
||||||
|
let commandPaths: string[] = [];
|
||||||
|
commandPaths = commandPaths.concat(process.env.PATH.split(':'));
|
||||||
|
if (process.env.SMARTSHELL_PATH) {
|
||||||
|
commandPaths = commandPaths.concat(process.env.SMARTSHELL_PATH.split(':'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// lets filter for unwanted paths
|
||||||
|
// Windows WSL
|
||||||
|
commandPaths = commandPaths.filter((commandPathArg) => {
|
||||||
|
const filterResult =
|
||||||
|
!commandPathArg.startsWith('/mnt/c/') &&
|
||||||
|
!commandPathArg.startsWith('Files/1E') &&
|
||||||
|
!commandPathArg.includes(' ');
|
||||||
|
if (!filterResult) {
|
||||||
|
// console.log(`${commandPathArg} will be filtered!`);
|
||||||
|
}
|
||||||
|
return filterResult;
|
||||||
|
});
|
||||||
|
|
||||||
|
commandResult = `PATH=${commandPaths.join(':')} && ${commandStringArg}`;
|
||||||
|
return commandResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add files that are going to be sourced when running a command
|
||||||
|
* @param sourceFilePathsArray
|
||||||
|
*/
|
||||||
|
addSourceFiles(sourceFilePathsArray: string[]) {
|
||||||
|
for (let sourceFilePath of sourceFilePathsArray) {
|
||||||
|
this.sourceFileArray.push(sourceFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cleans the source files array
|
||||||
|
*/
|
||||||
|
cleanSourceFiles() {
|
||||||
|
this.sourceFileArray = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public createEnvExecString(commandArg: string): string {
|
||||||
|
let commandResult = '';
|
||||||
|
let sourceString = '';
|
||||||
|
|
||||||
|
// deal with sourcestring
|
||||||
|
for (const sourceFilePath of this.sourceFileArray) {
|
||||||
|
sourceString = sourceString + `source ${sourceFilePath} && `;
|
||||||
|
}
|
||||||
|
|
||||||
|
// deal with available path
|
||||||
|
let pathString = 'PATH=$PATH';
|
||||||
|
for (const pathDir of this.pathDirArray) {
|
||||||
|
pathString += `:${pathDir}`;
|
||||||
|
}
|
||||||
|
pathString += ` && `;
|
||||||
|
|
||||||
|
switch (this.executor) {
|
||||||
|
case 'bash':
|
||||||
|
commandResult = `bash -c '${pathString}${sourceString}${commandArg}'`;
|
||||||
|
break;
|
||||||
|
case 'sh':
|
||||||
|
commandResult = `${pathString}${sourceString}${commandArg}`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
commandResult = this._setPath(commandResult);
|
||||||
|
return commandResult;
|
||||||
|
}
|
||||||
|
}
|
38
ts/classes.shelllog.ts
Normal file
38
ts/classes.shelllog.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a log handler for spawned logs
|
||||||
|
* making sure the process doesn't run out of memory
|
||||||
|
*/
|
||||||
|
export class ShellLog {
|
||||||
|
public logStore = Buffer.from('');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* log data to console
|
||||||
|
* @param dataArg
|
||||||
|
*/
|
||||||
|
public writeToConsole(dataArg: string | Buffer): void {
|
||||||
|
// make sure we have the data as string
|
||||||
|
process.stdout.write(dataArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add data to Buffer for later consumption
|
||||||
|
* @param dataArg
|
||||||
|
*/
|
||||||
|
public addToBuffer(dataArg: string | Buffer): void {
|
||||||
|
// make sure we have the data as Buffer
|
||||||
|
const dataBuffer: Buffer = (() => {
|
||||||
|
if (!Buffer.isBuffer(dataArg)) {
|
||||||
|
return Buffer.from(dataArg);
|
||||||
|
}
|
||||||
|
return dataArg;
|
||||||
|
})();
|
||||||
|
this.logStore = Buffer.concat([this.logStore, dataBuffer]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public logAndAdd(dataArg: string | Buffer): void {
|
||||||
|
this.writeToConsole(dataArg);
|
||||||
|
this.addToBuffer(dataArg);
|
||||||
|
}
|
||||||
|
}
|
55
ts/classes.smartexecution.ts
Normal file
55
ts/classes.smartexecution.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import * as plugins from './plugins.js';
|
||||||
|
import { Smartshell, type IExecResultStreaming } from './classes.smartshell.js';
|
||||||
|
|
||||||
|
export interface IDeferred<T> {
|
||||||
|
resolve: (value?: T | PromiseLike<T>) => void;
|
||||||
|
reject: (reason?: any) => void;
|
||||||
|
promise: Promise<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SmartExecution {
|
||||||
|
public smartshell: Smartshell;
|
||||||
|
public currentStreamingExecution: IExecResultStreaming;
|
||||||
|
public commandString: string;
|
||||||
|
|
||||||
|
private isRestartInProgress = false;
|
||||||
|
private isAnotherRestartRequested = false;
|
||||||
|
|
||||||
|
constructor(commandStringArg: string) {
|
||||||
|
this.commandString = commandStringArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schedules a restart. If a restart is currently in progress, any additional calls
|
||||||
|
* to restart will merge into a single additional restart request, which will only execute
|
||||||
|
* once the current restart completes.
|
||||||
|
*/
|
||||||
|
public async restart(): Promise<void> {
|
||||||
|
if (this.isRestartInProgress) {
|
||||||
|
// If there's already a restart in progress, just mark that another restart was requested
|
||||||
|
this.isAnotherRestartRequested = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isRestartInProgress = true;
|
||||||
|
try {
|
||||||
|
if (!this.smartshell) {
|
||||||
|
this.smartshell = new Smartshell({
|
||||||
|
executor: 'bash',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this.currentStreamingExecution) {
|
||||||
|
await this.currentStreamingExecution.kill();
|
||||||
|
}
|
||||||
|
this.currentStreamingExecution = await this.smartshell.execStreaming(this.commandString);
|
||||||
|
} finally {
|
||||||
|
this.isRestartInProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If another restart was requested while we were busy, we handle it now
|
||||||
|
if (this.isAnotherRestartRequested) {
|
||||||
|
this.isAnotherRestartRequested = false;
|
||||||
|
await this.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
203
ts/classes.smartshell.ts
Normal file
203
ts/classes.smartshell.ts
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
import * as plugins from './plugins.js';
|
||||||
|
import { ShellEnv } from './classes.shellenv.js';
|
||||||
|
import type { IShellEnvContructorOptions, TExecutor } from './classes.shellenv.js';
|
||||||
|
import { ShellLog } from './classes.shelllog.js';
|
||||||
|
import * as cp from 'child_process';
|
||||||
|
|
||||||
|
// -- interfaces --
|
||||||
|
export interface IExecResult {
|
||||||
|
exitCode: number;
|
||||||
|
stdout: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IExecResultStreaming {
|
||||||
|
childProcess: cp.ChildProcess;
|
||||||
|
finalPromise: Promise<IExecResult>;
|
||||||
|
kill: () => Promise<void>;
|
||||||
|
terminate: () => Promise<void>;
|
||||||
|
keyboardInterrupt: () => Promise<void>;
|
||||||
|
customSignal: (signal: plugins.smartexit.TProcessSignal) => Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IExecOptions {
|
||||||
|
commandString: string;
|
||||||
|
silent?: boolean;
|
||||||
|
strict?: boolean;
|
||||||
|
streaming?: boolean;
|
||||||
|
interactive?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Smartshell {
|
||||||
|
public shellEnv: ShellEnv;
|
||||||
|
public smartexit = new plugins.smartexit.SmartExit();
|
||||||
|
|
||||||
|
constructor(optionsArg: IShellEnvContructorOptions) {
|
||||||
|
this.shellEnv = new ShellEnv(optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a given command asynchronously.
|
||||||
|
*/
|
||||||
|
private async _exec(options: IExecOptions): Promise<IExecResult | IExecResultStreaming | void> {
|
||||||
|
if (options.interactive) {
|
||||||
|
return await this._execInteractive({ commandString: options.commandString });
|
||||||
|
}
|
||||||
|
return await this._execCommand(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes an interactive command.
|
||||||
|
*/
|
||||||
|
private async _execInteractive(options: Pick<IExecOptions, 'commandString'>): Promise<void> {
|
||||||
|
// Skip interactive execution in CI environments.
|
||||||
|
if (process.env.CI) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise<void>((resolve) => {
|
||||||
|
const shell = cp.spawn(options.commandString, {
|
||||||
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
|
detached: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.smartexit.addProcess(shell);
|
||||||
|
|
||||||
|
shell.on('close', (code) => {
|
||||||
|
console.log(`Interactive shell terminated with code ${code}`);
|
||||||
|
this.smartexit.removeProcess(shell);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a command and returns either a non-streaming result or a streaming interface.
|
||||||
|
*/
|
||||||
|
private async _execCommand(options: IExecOptions): Promise<IExecResult | IExecResultStreaming> {
|
||||||
|
const commandToExecute = this.shellEnv.createEnvExecString(options.commandString);
|
||||||
|
const shellLogInstance = new ShellLog();
|
||||||
|
|
||||||
|
const execChildProcess = cp.spawn(commandToExecute, [], {
|
||||||
|
shell: true,
|
||||||
|
cwd: process.cwd(),
|
||||||
|
env: process.env,
|
||||||
|
detached: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.smartexit.addProcess(execChildProcess);
|
||||||
|
|
||||||
|
// Capture stdout and stderr output.
|
||||||
|
execChildProcess.stdout.on('data', (data) => {
|
||||||
|
if (!options.silent) {
|
||||||
|
shellLogInstance.writeToConsole(data);
|
||||||
|
}
|
||||||
|
shellLogInstance.addToBuffer(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
execChildProcess.stderr.on('data', (data) => {
|
||||||
|
if (!options.silent) {
|
||||||
|
shellLogInstance.writeToConsole(data);
|
||||||
|
}
|
||||||
|
shellLogInstance.addToBuffer(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wrap child process termination into a Promise.
|
||||||
|
const childProcessEnded: Promise<IExecResult> = new Promise((resolve, reject) => {
|
||||||
|
execChildProcess.on('exit', (code, signal) => {
|
||||||
|
this.smartexit.removeProcess(execChildProcess);
|
||||||
|
|
||||||
|
const execResult: IExecResult = {
|
||||||
|
exitCode: typeof code === 'number' ? code : (signal ? 1 : 0),
|
||||||
|
stdout: shellLogInstance.logStore.toString(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (options.strict && code !== 0) {
|
||||||
|
reject(new Error(`Command "${options.commandString}" exited with code ${code}`));
|
||||||
|
} else {
|
||||||
|
resolve(execResult);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
execChildProcess.on('error', (error) => {
|
||||||
|
this.smartexit.removeProcess(execChildProcess);
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// If streaming mode is enabled, return a streaming interface immediately.
|
||||||
|
if (options.streaming) {
|
||||||
|
return {
|
||||||
|
childProcess: execChildProcess,
|
||||||
|
finalPromise: childProcessEnded,
|
||||||
|
kill: async () => {
|
||||||
|
console.log(`Running tree kill with SIGKILL on process ${execChildProcess.pid}`);
|
||||||
|
await plugins.smartexit.SmartExit.killTreeByPid(execChildProcess.pid, 'SIGKILL');
|
||||||
|
},
|
||||||
|
terminate: async () => {
|
||||||
|
console.log(`Running tree kill with SIGTERM on process ${execChildProcess.pid}`);
|
||||||
|
await plugins.smartexit.SmartExit.killTreeByPid(execChildProcess.pid, 'SIGTERM');
|
||||||
|
},
|
||||||
|
keyboardInterrupt: async () => {
|
||||||
|
console.log(`Running tree kill with SIGINT on process ${execChildProcess.pid}`);
|
||||||
|
await plugins.smartexit.SmartExit.killTreeByPid(execChildProcess.pid, 'SIGINT');
|
||||||
|
},
|
||||||
|
customSignal: async (signal: plugins.smartexit.TProcessSignal) => {
|
||||||
|
console.log(`Running tree kill with custom signal ${signal} on process ${execChildProcess.pid}`);
|
||||||
|
await plugins.smartexit.SmartExit.killTreeByPid(execChildProcess.pid, signal);
|
||||||
|
},
|
||||||
|
} as IExecResultStreaming;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For non-streaming mode, wait for the process to complete.
|
||||||
|
return await childProcessEnded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async exec(commandString: string): Promise<IExecResult> {
|
||||||
|
return (await this._exec({ commandString })) as IExecResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execSilent(commandString: string): Promise<IExecResult> {
|
||||||
|
return (await this._exec({ commandString, silent: true })) as IExecResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execStrict(commandString: string): Promise<IExecResult> {
|
||||||
|
return (await this._exec({ commandString, strict: true })) as IExecResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execStrictSilent(commandString: string): Promise<IExecResult> {
|
||||||
|
return (await this._exec({ commandString, silent: true, strict: true })) as IExecResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execStreaming(commandString: string, silent: boolean = false): Promise<IExecResultStreaming> {
|
||||||
|
return (await this._exec({ commandString, silent, streaming: true })) as IExecResultStreaming;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execStreamingSilent(commandString: string): Promise<IExecResultStreaming> {
|
||||||
|
return (await this._exec({ commandString, silent: true, streaming: true })) as IExecResultStreaming;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execInteractive(commandString: string): Promise<void> {
|
||||||
|
await this._exec({ commandString, interactive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execAndWaitForLine(
|
||||||
|
commandString: string,
|
||||||
|
regex: RegExp,
|
||||||
|
silent: boolean = false
|
||||||
|
): Promise<void> {
|
||||||
|
const execStreamingResult = await this.execStreaming(commandString, silent);
|
||||||
|
return new Promise<void>((resolve) => {
|
||||||
|
execStreamingResult.childProcess.stdout.on('data', (chunk: Buffer | string) => {
|
||||||
|
const data = typeof chunk === 'string' ? chunk : chunk.toString();
|
||||||
|
if (regex.test(data)) {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async execAndWaitForLineSilent(commandString: string, regex: RegExp): Promise<void> {
|
||||||
|
return this.execAndWaitForLine(commandString, regex, true);
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +1,3 @@
|
|||||||
export * from './smartshell.wrap'
|
export * from './classes.smartshell.js';
|
||||||
export * from './smartshell.classes.smartshell'
|
export * from './classes.smartexecution.js';
|
||||||
|
export { which } from './plugins.js';
|
||||||
|
6
ts/plugins.ts
Normal file
6
ts/plugins.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
|
import * as smartexit from '@push.rocks/smartexit';
|
||||||
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
|
import which from 'which';
|
||||||
|
|
||||||
|
export { smartdelay, smartexit, smartpromise, which };
|
@ -1,65 +0,0 @@
|
|||||||
import * as plugins from './smartshell.plugins'
|
|
||||||
import * as smartshellWrap from './smartshell.wrap'
|
|
||||||
|
|
||||||
export type TExecutor = 'sh' | 'bash'
|
|
||||||
|
|
||||||
export interface ISmartshellContructorOptions {
|
|
||||||
executor: TExecutor
|
|
||||||
sourceFilePaths: string[]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Smartshell {
|
|
||||||
executor: TExecutor
|
|
||||||
sourceFileArray: string[] = []
|
|
||||||
constructor (optionsArg: ISmartshellContructorOptions) {
|
|
||||||
this.executor = optionsArg.executor
|
|
||||||
for (let sourceFilePath of optionsArg.sourceFilePaths) {
|
|
||||||
this.sourceFileArray.push(sourceFilePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addSourceFiles (sourceFilePathsArray: string[]) {
|
|
||||||
for (let sourceFilePath of sourceFilePathsArray) {
|
|
||||||
this.sourceFileArray.push(sourceFilePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanSourceFiles () {
|
|
||||||
this.sourceFileArray = []
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* executes silently and returns IExecResult
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
async execSilent (commandArg: string) {
|
|
||||||
let execCommand = this.createExecString(commandArg)
|
|
||||||
return await smartshellWrap.execSilent(execCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* executes and returns IExecResult
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
async exec (commandArg: string) {
|
|
||||||
let execCommand = this.createExecString(commandArg)
|
|
||||||
return await smartshellWrap.exec(execCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* creates the final sourcing string
|
|
||||||
* @param commandArg
|
|
||||||
*/
|
|
||||||
private createExecString (commandArg): string {
|
|
||||||
if (this.executor === 'bash') {
|
|
||||||
let sourceString = ''
|
|
||||||
for (let sourceFilePath of this.sourceFileArray) {
|
|
||||||
sourceString = sourceString + `source ${sourceFilePath} && `
|
|
||||||
}
|
|
||||||
return `bash -c '${sourceString} ${commandArg}'`
|
|
||||||
} else {
|
|
||||||
return commandArg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
import * as shelljs from 'shelljs'
|
|
||||||
import * as smartq from 'smartq'
|
|
||||||
import * as which from 'which'
|
|
||||||
|
|
||||||
export {
|
|
||||||
shelljs,
|
|
||||||
smartq,
|
|
||||||
which
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
import * as plugins from './smartshell.plugins'
|
|
||||||
|
|
||||||
// interfaces
|
|
||||||
import { ChildProcess } from 'child_process'
|
|
||||||
import { Deferred } from 'smartq'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* interface for ExecResult
|
|
||||||
*/
|
|
||||||
export interface IExecResult {
|
|
||||||
exitCode: number,
|
|
||||||
stdout: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* interface for streaming ExecResult
|
|
||||||
*/
|
|
||||||
export interface IExecResultStreaming {
|
|
||||||
childProcess: ChildProcess,
|
|
||||||
finalPromise: Promise<IExecResult>
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* executes a given command async
|
|
||||||
* @param commandStringArg
|
|
||||||
*/
|
|
||||||
export let exec = (commandStringArg: string): Promise<IExecResult> => {
|
|
||||||
let done = plugins.smartq.defer<IExecResult>()
|
|
||||||
plugins.shelljs.exec(commandStringArg, { async: true }, (code, stdout, stderr) => {
|
|
||||||
done.resolve({
|
|
||||||
exitCode: code,
|
|
||||||
stdout: stdout
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* executes a given command async and silent
|
|
||||||
* @param commandStringArg
|
|
||||||
*/
|
|
||||||
export let execSilent = (commandStringArg: string) => {
|
|
||||||
let done = plugins.smartq.defer<IExecResult>()
|
|
||||||
plugins.shelljs.exec(commandStringArg, { async: true, silent: true }, (code, stdout, stderr) => {
|
|
||||||
done.resolve({
|
|
||||||
exitCode: code,
|
|
||||||
stdout: stdout
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* executes a command and allws you to stream output
|
|
||||||
*/
|
|
||||||
export let execStreaming = (commandStringArg: string, silentArg: boolean = false) => {
|
|
||||||
let childProcessEnded = plugins.smartq.defer<IExecResult>()
|
|
||||||
let execChildProcess = plugins.shelljs.exec(commandStringArg, {async: true, silent: silentArg}, (code, stdout, stderr) => {
|
|
||||||
childProcessEnded.resolve({
|
|
||||||
exitCode: code,
|
|
||||||
stdout: stdout
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return {
|
|
||||||
childProcess: execChildProcess,
|
|
||||||
finalPromise: childProcessEnded.promise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export let execStreamingSilent = (commandStringArg: string) => {
|
|
||||||
return execStreaming(commandStringArg, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* executes a command and returns promise that will be fullfilled once an putput line matches RegexArg
|
|
||||||
* @param commandStringArg
|
|
||||||
* @param regexArg
|
|
||||||
*/
|
|
||||||
export let execAndWaitForLine = (commandStringArg: string, regexArg: RegExp, silentArg: boolean = false) => {
|
|
||||||
let done = plugins.smartq.defer()
|
|
||||||
let execStreamingResult = execStreaming(commandStringArg, silentArg)
|
|
||||||
execStreamingResult.childProcess.stdout.on('data', (stdOutChunk: string) => {
|
|
||||||
if (regexArg.test(stdOutChunk)) {
|
|
||||||
done.resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
|
|
||||||
export let execAndWaitForLineSilent = (commandStringArg: string, regexArg: RegExp) => {
|
|
||||||
execAndWaitForLine(commandStringArg, regexArg, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get a path
|
|
||||||
*/
|
|
||||||
export let which = (cmd: string): Promise<string> => {
|
|
||||||
let done = plugins.smartq.defer<string>()
|
|
||||||
plugins.which(cmd, (err, path: string) => {
|
|
||||||
if (err) {
|
|
||||||
done.reject(err)
|
|
||||||
}
|
|
||||||
done.resolve(path)
|
|
||||||
})
|
|
||||||
return done.promise
|
|
||||||
}
|
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tslint-config-standard"
|
|
||||||
}
|
|
373
yarn.lock
373
yarn.lock
@ -1,373 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@types/chai-as-promised@0.0.29":
|
|
||||||
version "0.0.29"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "*"
|
|
||||||
"@types/promises-a-plus" "*"
|
|
||||||
|
|
||||||
"@types/chai-string@^1.1.30":
|
|
||||||
version "1.1.30"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "*"
|
|
||||||
|
|
||||||
"@types/chai@*":
|
|
||||||
version "4.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.1.tgz#37fea779617cfec3fd2b19a0247e8bbdd5133bf6"
|
|
||||||
|
|
||||||
"@types/chai@^3.4.35":
|
|
||||||
version "3.5.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
|
|
||||||
|
|
||||||
"@types/node@*":
|
|
||||||
version "8.0.13"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.13.tgz#530f0f9254209b0335bf5cc6387822594ef47093"
|
|
||||||
|
|
||||||
"@types/promises-a-plus@*":
|
|
||||||
version "0.0.27"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
|
||||||
|
|
||||||
"@types/shelljs@^0.7.2":
|
|
||||||
version "0.7.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.2.tgz#c2bdb3fe80cd7a3da08750ca898ae44c589671f3"
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "*"
|
|
||||||
|
|
||||||
"@types/which@^1.0.28":
|
|
||||||
version "1.0.28"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
|
|
||||||
|
|
||||||
ansi-256-colors@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
|
||||||
|
|
||||||
assertion-error@^1.0.1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
|
||||||
|
|
||||||
balanced-match@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
|
||||||
|
|
||||||
beautycolor@^1.0.7:
|
|
||||||
version "1.0.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
|
|
||||||
dependencies:
|
|
||||||
ansi-256-colors "^1.1.0"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
bindings@^1.2.1:
|
|
||||||
version "1.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
|
|
||||||
|
|
||||||
brace-expansion@^1.1.7:
|
|
||||||
version "1.1.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
|
||||||
dependencies:
|
|
||||||
balanced-match "^1.0.0"
|
|
||||||
concat-map "0.0.1"
|
|
||||||
|
|
||||||
chai-as-promised@^6.0.0:
|
|
||||||
version "6.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
|
|
||||||
dependencies:
|
|
||||||
check-error "^1.0.2"
|
|
||||||
|
|
||||||
chai-string@^1.3.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49"
|
|
||||||
|
|
||||||
chai@^3.5.0:
|
|
||||||
version "3.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
|
|
||||||
dependencies:
|
|
||||||
assertion-error "^1.0.1"
|
|
||||||
deep-eql "^0.1.3"
|
|
||||||
type-detect "^1.0.0"
|
|
||||||
|
|
||||||
check-error@^1.0.2:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
|
||||||
|
|
||||||
concat-map@0.0.1:
|
|
||||||
version "0.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
|
||||||
|
|
||||||
deep-eql@^0.1.3:
|
|
||||||
version "0.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
|
||||||
dependencies:
|
|
||||||
type-detect "0.1.1"
|
|
||||||
|
|
||||||
define-properties@^1.1.2:
|
|
||||||
version "1.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
|
|
||||||
dependencies:
|
|
||||||
foreach "^2.0.5"
|
|
||||||
object-keys "^1.0.8"
|
|
||||||
|
|
||||||
early@^2.1.1:
|
|
||||||
version "2.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
|
|
||||||
dependencies:
|
|
||||||
beautycolor "^1.0.7"
|
|
||||||
smartq "^1.1.1"
|
|
||||||
typings-global "^1.0.16"
|
|
||||||
|
|
||||||
es-abstract@^1.5.1:
|
|
||||||
version "1.7.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c"
|
|
||||||
dependencies:
|
|
||||||
es-to-primitive "^1.1.1"
|
|
||||||
function-bind "^1.1.0"
|
|
||||||
is-callable "^1.1.3"
|
|
||||||
is-regex "^1.0.3"
|
|
||||||
|
|
||||||
es-to-primitive@^1.1.1:
|
|
||||||
version "1.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
|
|
||||||
dependencies:
|
|
||||||
is-callable "^1.1.1"
|
|
||||||
is-date-object "^1.0.1"
|
|
||||||
is-symbol "^1.0.1"
|
|
||||||
|
|
||||||
es6-error@^4.0.2:
|
|
||||||
version "4.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
|
|
||||||
|
|
||||||
foreach@^2.0.5:
|
|
||||||
version "2.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
|
|
||||||
|
|
||||||
fs.realpath@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
|
||||||
|
|
||||||
function-bind@^1.0.2, function-bind@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"
|
|
||||||
|
|
||||||
glob@^7.0.0:
|
|
||||||
version "7.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
|
||||||
dependencies:
|
|
||||||
fs.realpath "^1.0.0"
|
|
||||||
inflight "^1.0.4"
|
|
||||||
inherits "2"
|
|
||||||
minimatch "^3.0.4"
|
|
||||||
once "^1.3.0"
|
|
||||||
path-is-absolute "^1.0.0"
|
|
||||||
|
|
||||||
has@^1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
|
|
||||||
dependencies:
|
|
||||||
function-bind "^1.0.2"
|
|
||||||
|
|
||||||
inflight@^1.0.4:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
|
||||||
dependencies:
|
|
||||||
once "^1.3.0"
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
inherits@2:
|
|
||||||
version "2.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
|
||||||
|
|
||||||
interpret@^1.0.0:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
|
|
||||||
|
|
||||||
is-callable@^1.1.1, is-callable@^1.1.3:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
|
|
||||||
|
|
||||||
is-date-object@^1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
|
|
||||||
|
|
||||||
is-regex@^1.0.3:
|
|
||||||
version "1.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
|
||||||
dependencies:
|
|
||||||
has "^1.0.1"
|
|
||||||
|
|
||||||
is-symbol@^1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
|
|
||||||
|
|
||||||
isexe@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
|
||||||
|
|
||||||
leakage@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
|
|
||||||
dependencies:
|
|
||||||
es6-error "^4.0.2"
|
|
||||||
left-pad "^1.1.3"
|
|
||||||
memwatch-next "^0.3.0"
|
|
||||||
minimist "^1.2.0"
|
|
||||||
pretty-bytes "^4.0.2"
|
|
||||||
|
|
||||||
left-pad@^1.1.3:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
|
||||||
|
|
||||||
memwatch-next@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
|
|
||||||
dependencies:
|
|
||||||
bindings "^1.2.1"
|
|
||||||
nan "^2.3.2"
|
|
||||||
|
|
||||||
minimatch@^3.0.4:
|
|
||||||
version "3.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
|
||||||
dependencies:
|
|
||||||
brace-expansion "^1.1.7"
|
|
||||||
|
|
||||||
minimist@^1.2.0:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
|
||||||
|
|
||||||
nan@^2.3.2:
|
|
||||||
version "2.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
|
||||||
|
|
||||||
object-keys@^1.0.8:
|
|
||||||
version "1.0.11"
|
|
||||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
|
|
||||||
|
|
||||||
object.getownpropertydescriptors@^2.0.3:
|
|
||||||
version "2.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
|
|
||||||
dependencies:
|
|
||||||
define-properties "^1.1.2"
|
|
||||||
es-abstract "^1.5.1"
|
|
||||||
|
|
||||||
once@^1.3.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
|
||||||
dependencies:
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
path-is-absolute@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
|
||||||
|
|
||||||
path-parse@^1.0.5:
|
|
||||||
version "1.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
|
|
||||||
|
|
||||||
pretty-bytes@^4.0.2:
|
|
||||||
version "4.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
|
||||||
|
|
||||||
rechoir@^0.6.2:
|
|
||||||
version "0.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
|
||||||
dependencies:
|
|
||||||
resolve "^1.1.6"
|
|
||||||
|
|
||||||
resolve@^1.1.6:
|
|
||||||
version "1.3.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
|
|
||||||
dependencies:
|
|
||||||
path-parse "^1.0.5"
|
|
||||||
|
|
||||||
semver@^5.3.0:
|
|
||||||
version "5.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
|
||||||
|
|
||||||
shelljs@^0.7.8:
|
|
||||||
version "0.7.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
|
|
||||||
dependencies:
|
|
||||||
glob "^7.0.0"
|
|
||||||
interpret "^1.0.0"
|
|
||||||
rechoir "^0.6.2"
|
|
||||||
|
|
||||||
smartchai@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "^3.4.35"
|
|
||||||
"@types/chai-as-promised" "0.0.29"
|
|
||||||
"@types/chai-string" "^1.1.30"
|
|
||||||
chai "^3.5.0"
|
|
||||||
chai-as-promised "^6.0.0"
|
|
||||||
chai-string "^1.3.0"
|
|
||||||
|
|
||||||
smartdelay@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579"
|
|
||||||
dependencies:
|
|
||||||
smartq "^1.1.1"
|
|
||||||
typings-global "^1.0.16"
|
|
||||||
|
|
||||||
smartq@^1.1.1, smartq@^1.1.6:
|
|
||||||
version "1.1.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
|
|
||||||
dependencies:
|
|
||||||
typings-global "^1.0.19"
|
|
||||||
util.promisify "^1.0.0"
|
|
||||||
|
|
||||||
smartshell@^1.0.6:
|
|
||||||
version "1.0.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.8.tgz#1535756c0fe8069f7e6da1e3f9cb6c8f77094e42"
|
|
||||||
dependencies:
|
|
||||||
"@types/shelljs" "^0.7.2"
|
|
||||||
"@types/which" "^1.0.28"
|
|
||||||
shelljs "^0.7.8"
|
|
||||||
smartq "^1.1.1"
|
|
||||||
typings-global "^1.0.19"
|
|
||||||
which "^1.2.14"
|
|
||||||
|
|
||||||
tapbundle@^1.1.1:
|
|
||||||
version "1.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.1.tgz#ec4172c0e82a77b1f6133fef2606311ede28a62d"
|
|
||||||
dependencies:
|
|
||||||
early "^2.1.1"
|
|
||||||
leakage "^0.3.0"
|
|
||||||
smartchai "^1.0.3"
|
|
||||||
smartdelay "^1.0.3"
|
|
||||||
smartq "^1.1.1"
|
|
||||||
typings-global "^1.0.19"
|
|
||||||
|
|
||||||
type-detect@0.1.1:
|
|
||||||
version "0.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
|
||||||
|
|
||||||
type-detect@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
|
|
||||||
|
|
||||||
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19:
|
|
||||||
version "1.0.19"
|
|
||||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.19.tgz#3376a72d4de1e5541bf5702248ff64c3e6ea316c"
|
|
||||||
dependencies:
|
|
||||||
semver "^5.3.0"
|
|
||||||
smartshell "^1.0.6"
|
|
||||||
|
|
||||||
util.promisify@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
|
|
||||||
dependencies:
|
|
||||||
define-properties "^1.1.2"
|
|
||||||
object.getownpropertydescriptors "^2.0.3"
|
|
||||||
|
|
||||||
which@^1.2.14:
|
|
||||||
version "1.2.14"
|
|
||||||
resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5"
|
|
||||||
dependencies:
|
|
||||||
isexe "^2.0.0"
|
|
||||||
|
|
||||||
wrappy@1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
|
Loading…
x
Reference in New Issue
Block a user