@sentry/wizard
Version:
Sentry wizard helping you to configure your project
83 lines • 2.89 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.execute = exports.executeSync = exports.installSentryCLI = exports.hasSentryCLI = void 0;
const child_process = __importStar(require("child_process"));
const https = __importStar(require("https"));
const fs = __importStar(require("fs"));
function hasSentryCLI() {
try {
child_process.execSync('sentry-cli --version');
return true;
}
catch (e) {
return false;
}
}
exports.hasSentryCLI = hasSentryCLI;
async function installSentryCLI() {
const httpAsync = new Promise((resolve, reject) => {
const file = fs.createWriteStream('installcli.sh');
https.get('https://sentry.io/get-cli/', (response) => {
response.pipe(file);
file.on('finish', () => {
file.close();
try {
child_process.execSync('bash ./installcli.sh');
}
catch (e) {
reject(e);
return;
}
fs.unlinkSync('installcli.sh');
resolve(null);
});
file.on('error', (err) => {
fs.unlinkSync('installcli.sh');
reject(err);
});
});
});
await httpAsync;
}
exports.installSentryCLI = installSentryCLI;
function executeSync(command) {
const output = child_process.execSync(command);
return output.toString();
}
exports.executeSync = executeSync;
function execute(command) {
return new Promise((resolve, reject) => {
child_process.exec(command, (error, stdout, _) => {
if (error) {
reject(error);
return;
}
resolve(stdout);
});
});
}
exports.execute = execute;
//# sourceMappingURL=bash.js.map