@actions/tool-cache
Advanced tools
Comparing version 1.5.5 to 1.6.0
@@ -41,2 +41,11 @@ import * as mm from './manifest'; | ||
/** | ||
* Extract a xar compatible archive | ||
* | ||
* @param file path to the archive | ||
* @param dest destination directory. Optional. | ||
* @param flags flags for the xar. Optional. | ||
* @returns path to the destination directory | ||
*/ | ||
export declare function extractXar(file: string, dest?: string, flags?: string | string[]): Promise<string>; | ||
/** | ||
* Extract a zip | ||
@@ -43,0 +52,0 @@ * |
@@ -45,2 +45,3 @@ "use strict"; | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
const IS_MAC = process.platform === 'darwin'; | ||
const userAgent = 'actions/tool-cache'; | ||
@@ -262,2 +263,32 @@ /** | ||
/** | ||
* Extract a xar compatible archive | ||
* | ||
* @param file path to the archive | ||
* @param dest destination directory. Optional. | ||
* @param flags flags for the xar. Optional. | ||
* @returns path to the destination directory | ||
*/ | ||
function extractXar(file, dest, flags = []) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
assert_1.ok(IS_MAC, 'extractXar() not supported on current OS'); | ||
assert_1.ok(file, 'parameter "file" is required'); | ||
dest = yield _createExtractFolder(dest); | ||
let args; | ||
if (flags instanceof Array) { | ||
args = flags; | ||
} | ||
else { | ||
args = [flags]; | ||
} | ||
args.push('-x', '-C', dest, '-f', file); | ||
if (core.isDebug()) { | ||
args.push('-v'); | ||
} | ||
const xarPath = yield io.which('xar', true); | ||
yield exec_1.exec(`"${xarPath}"`, _unique(args)); | ||
return dest; | ||
}); | ||
} | ||
exports.extractXar = extractXar; | ||
/** | ||
* Extract a zip | ||
@@ -570,2 +601,9 @@ * | ||
} | ||
/** | ||
* Returns an array of unique values. | ||
* @param values Values to make unique. | ||
*/ | ||
function _unique(values) { | ||
return Array.from(new Set(values)); | ||
} | ||
//# sourceMappingURL=tool-cache.js.map |
{ | ||
"name": "@actions/tool-cache", | ||
"version": "1.5.5", | ||
"version": "1.6.0", | ||
"description": "Actions tool-cache lib", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"scripts": { | ||
"audit-moderate": "npm install && npm audit --audit-level=moderate", | ||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", | ||
"test": "echo \"Error: run tests from root\" && exit 1", | ||
@@ -34,0 +34,0 @@ "tsc": "tsc" |
@@ -32,2 +32,6 @@ # `@actions/tool-cache` | ||
} | ||
else if (process.platform === 'darwin') { | ||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0.pkg'); | ||
const node12ExtractedFolder = await tc.extractXar(node12Path, 'path/to/extract/to'); | ||
} | ||
else { | ||
@@ -34,0 +38,0 @@ const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104226
902
87