Update node_modules

This commit is contained in:
CrazyMax
2020-01-17 09:36:42 +01:00
parent 0249173616
commit 999f6ae5af
787 changed files with 76078 additions and 436 deletions

View File

@@ -1,38 +0,0 @@
export = decompresstarxz;
declare function decompresstarxz(
input: string | Buffer,
output?: string | decompresstarxz.DecompressOptions,
opts?: decompresstarxz.DecompressOptions
): Promise<decompresstarxz.File[]>;
declare namespace decompresstarxz {
interface File {
data: Buffer;
mode: number;
mtime: string;
path: string;
type: string;
}
interface DecompressOptions {
/**
* Filter out files before extracting
*/
filter?(file: File): boolean;
/**
* Map files before extracting
*/
map?(file: File): File;
/**
* Array of plugins to use.
* Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]
*/
plugins?: any[];
/**
* Remove leading directory components from extracted files.
* Default: 0
*/
strip?: number;
}
}

View File

@@ -1,11 +1,11 @@
import decompress = require('decompress');
import decompresstarxz = require('decompress-tarxz');
import * as download from 'download';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as util from 'util';
import * as restm from 'typed-rest-client/RestClient';
import * as core from '@actions/core';
import * as tc from '@actions/tool-cache';
let osPlat: string = os.platform();
let osArch: string = os.arch();
@@ -16,33 +16,38 @@ export async function getUPX(version: string): Promise<string> {
version = selected;
}
console.log(`✅ UPX version found: ${version}`);
core.info(`✅ UPX version found: ${version}`);
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'upx-'));
const fileName = getFileName(version);
const downloadUrl = util.format('https://github.com/upx/upx/releases/download/v%s/%s', version, fileName);
console.log(`⬇️ Downloading ${downloadUrl}...`);
core.info(`⬇️ Downloading ${downloadUrl}...`);
await download.default(downloadUrl, tmpdir, {filename: fileName});
console.log('📦 Extracting UPX...');
core.info('📦 Extracting UPX...');
let extPath: string = tmpdir;
if (osPlat == 'win32') {
await decompress(`${tmpdir}/${fileName}`, tmpdir, {strip: 1});
extPath = await tc.extractZip(`${tmpdir}/${fileName}`);
} else {
await decompresstarxz(`${tmpdir}/${fileName}`, tmpdir, {strip: 1});
extPath = await tc.extractTar(`${tmpdir}/${fileName}`, undefined, 'x');
}
return path.join(tmpdir, osPlat == 'win32' ? 'upx.exe' : 'upx');
return path.join(extPath, getFileNameWithoutExt(version), osPlat == 'win32' ? 'upx.exe' : 'upx');
}
function getFileName(version: string): string {
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.xz';
return util.format('%s.%s', getFileNameWithoutExt(version), ext);
}
function getFileNameWithoutExt(version: string): string {
let platform: string = '';
if (osPlat == 'win32') {
platform = osArch == 'x64' ? 'win64' : 'win32';
} else if (osPlat == 'linux') {
platform = osArch == 'x64' ? 'amd64_linux' : 'i386_linux';
}
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.xz';
return util.format('upx-%s-%s.%s', version, platform, ext);
return util.format('upx-%s-%s', version, platform);
}
interface GitHubRelease {

View File

@@ -1,10 +1,16 @@
import * as installer from './installer';
import * as fs from 'fs';
import * as os from 'os';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
export async function run(silent?: boolean) {
try {
if (os.platform() == 'darwin') {
core.setFailed('Not supported on darwin platform');
return;
}
const version = core.getInput('version') || 'latest';
const file = core.getInput('file', {required: true});
const args = core.getInput('args');