Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@goldstack/utils-sh

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goldstack/utils-sh - npm Package Compare versions

Comparing version 0.1.29 to 0.1.30

4

dist/utilsSh.d.ts

@@ -7,2 +7,6 @@ import sh from 'shelljs';

export declare const cp: (options: string, source: string | string[], dest: string) => void;
/**
* Works better in Windows environment, since automatic retires are attempted when there is a temporary error.
*/
export declare const rmSafe: (...files: string[]) => Promise<void>;
export declare const rm: (options: string, ...files: string[]) => void;

@@ -9,0 +13,0 @@ export declare const mkdir: (options: string, ...dir: string[]) => void;

@@ -61,3 +61,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.cd = exports.sh = exports.write = exports.read = exports.pwd = exports.exec = exports.mkdir = exports.rm = exports.cp = exports.copy = void 0;
exports.cd = exports.sh = exports.write = exports.read = exports.pwd = exports.exec = exports.mkdir = exports.rm = exports.rmSafe = exports.cp = exports.copy = void 0;
var shelljs_1 = __importStar(require("shelljs"));

@@ -68,2 +68,3 @@ exports.sh = shelljs_1.default;

var path_1 = __importDefault(require("path"));
var rimraf_1 = __importDefault(require("rimraf"));
exports.copy = function (source, dest) { return __awaiter(void 0, void 0, void 0, function () {

@@ -129,2 +130,52 @@ var sourceArr, _loop_1, _i, sourceArr_1, sourceEl;

};
/**
* Works better in Windows environment, since automatic retires are attempted when there is a temporary error.
*/
exports.rmSafe = function () {
var files = [];
for (var _i = 0; _i < arguments.length; _i++) {
files[_i] = arguments[_i];
}
return __awaiter(void 0, void 0, void 0, function () {
var _loop_2, _a, files_1, file;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_loop_2 = function (file) {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
rimraf_1.default(file, {
maxBusyTries: 10,
}, function (e) {
if (e) {
reject(e);
return;
}
resolve();
});
})];
case 1:
_a.sent();
return [2 /*return*/];
}
});
};
_a = 0, files_1 = files;
_b.label = 1;
case 1:
if (!(_a < files_1.length)) return [3 /*break*/, 4];
file = files_1[_a];
return [5 /*yield**/, _loop_2(file)];
case 2:
_b.sent();
_b.label = 3;
case 3:
_a++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/];
}
});
});
};
exports.rm = function (options) {

@@ -135,7 +186,10 @@ var files = [];

}
var res = shelljs_1.default.rm(options, files);
if (!res || res.code !== 0) {
shelljs_1.default.echo(res.stdout);
shelljs_1.default.echo(res.stderr);
throw new Error("Cannot remove " + files);
for (var _a = 0, files_2 = files; _a < files_2.length; _a++) {
var file = files_2[_a];
rimraf_1.default.sync(file); // sh.rm(options, files);
// if (!res || res.code !== 0) {
// sh.echo(res.stdout);
// sh.echo(res.stderr);
// throw new Error(`Cannot remove ${file}`);
// }
}

@@ -142,0 +196,0 @@ };

4

package.json
{
"name": "@goldstack/utils-sh",
"version": "0.1.29",
"version": "0.1.30",
"license": "MIT",

@@ -24,2 +24,3 @@ "author": "Max Rohde",

"ncp": "^2.0.0",
"rimraf": "^3.0.2",
"shelljs": "^0.8.4"

@@ -32,2 +33,3 @@ },

"@types/node": "^14.0.6",
"@types/rimraf": "^3.0.0",
"@types/shelljs": "^0.8.8",

@@ -34,0 +36,0 @@ "jest": "^26.0.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc