UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

53 lines (51 loc) 1.89 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const child_process_1 = tslib_1.__importDefault(require("child_process")); const path_1 = tslib_1.__importDefault(require("path")); const fancy_log_1 = tslib_1.__importDefault(require("fancy-log")); const plugin_error_1 = tslib_1.__importDefault(require("plugin-error")); const PLUGIN_NAME = 'pack-nuget'; function runPack(options, callback) { const powerShell = 'powershell.exe'; const script = path_1.default.normalize(__dirname + '..\\..\\..\\tools\\scripts\\New-ExtensionPackage.ps1'); const args = ['-NoProfile', '-File', script]; if (options.version) { args.push('-Version', options.version); } if (options.icon) { args.push('-Icon', options.icon); } if (options.license) { args.push('-License', options.license); } if (options.company) { args.push('-Company', options.company); } if (options.copyright) { args.push('-Copyright', options.copyright); } if (options.iconUrl) { args.push('-IconUrl', options.iconUrl); } if (options.targetPath) { args.push('-TargetPath', options.targetPath); } (0, fancy_log_1.default)(powerShell, args.join(' ')); const cmd = child_process_1.default.spawn(powerShell, args); cmd.stdout.on('data', function (data) { (0, fancy_log_1.default)(data.toString().trim()); }); cmd.stderr.on('data', function (data) { fancy_log_1.default.error(data.toString().trim()); }); cmd.on('exit', function (code) { if (code !== 0) { callback(new plugin_error_1.default({ plugin: PLUGIN_NAME, message: 'Error: scripts\New-ExtensionPackage.ps1' })); return; } callback(); }); } module.exports = runPack; //# sourceMappingURL=index.js.map