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.30 to 0.1.31

11

dist/utilsSh.d.ts

@@ -13,2 +13,13 @@ import sh from 'shelljs';

export declare const mkdir: (options: string, ...dir: string[]) => void;
export declare const zip: (params: {
directory: string;
target: string;
}) => Promise<void>;
/**
* Unzips a zip file into directly into a directory.
*/
export declare const unzip: (params: {
file: string;
targetDirectory: string;
}) => Promise<void>;
declare const exec: (cmd: string, params?: ExecParams | undefined) => string;

@@ -15,0 +26,0 @@ declare const read: (path: string) => string;

45

dist/utilsSh.js

@@ -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.rmSafe = exports.cp = exports.copy = void 0;
exports.cd = exports.sh = exports.write = exports.read = exports.pwd = exports.exec = exports.unzip = exports.zip = exports.mkdir = exports.rm = exports.rmSafe = exports.cp = exports.copy = void 0;
var shelljs_1 = __importStar(require("shelljs"));

@@ -69,2 +69,4 @@ exports.sh = shelljs_1.default;

var rimraf_1 = __importDefault(require("rimraf"));
var archiver_1 = __importDefault(require("archiver"));
var extract_zip_1 = __importDefault(require("extract-zip"));
exports.copy = function (source, dest) { return __awaiter(void 0, void 0, void 0, function () {

@@ -207,2 +209,43 @@ var sourceArr, _loop_1, _i, sourceArr_1, sourceEl;

};
exports.zip = function (params) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
var output = fs_1.default.createWriteStream(params.target);
var archive = archiver_1.default('zip', {
zlib: { level: 9 },
});
archive.on('warning', function (err) {
console.warn(err.message);
});
output.on('finish', function () {
resolve();
});
output.on('error', reject);
// pipe archive data to the file
archive.pipe(output);
archive.directory(params.directory, false);
archive.finalize();
})];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); };
/**
* Unzips a zip file into directly into a directory.
*/
exports.unzip = function (params) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, extract_zip_1.default(params.file, {
dir: path_1.default.resolve(params.targetDirectory),
})];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); };
var exec = function (cmd, params) {

@@ -209,0 +252,0 @@ var res = shelljs_1.default.exec(cmd, { silent: params === null || params === void 0 ? void 0 : params.silent });

5

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

@@ -23,2 +23,4 @@ "author": "Max Rohde",

"@goldstack/utils-log": "0.1.35",
"archiver": "^5.0.0",
"extract-zip": "^2.0.1",
"ncp": "^2.0.0",

@@ -30,2 +32,3 @@ "rimraf": "^3.0.2",

"@goldstack/utils-git": "0.1.21",
"@types/archiver": "^3.1.0",
"@types/jest": "^25.2.3",

@@ -32,0 +35,0 @@ "@types/ncp": "^2.0.4",

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