Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function terminal_plugin(md,options) {
var defaultOptions = {
styleOptions: {
code: styles.yellow,
blockquote: terminal.compoundStyle(['gray','italic']),
html: styles.gray,
heading: terminal.compoundStyle(['green','bold']),
firstHeading: terminal.compoundStyle(['magenta','underline','bold']),
hr: styles.reset,
listitem: styles.reset,
table: styles.reset,
paragraph: styles.reset,
strong: styles.bold,
em: styles.italic,
codespan: styles.yellow,
del: terminal.compoundStyle(['dim','gray','strikethrough']),
link: styles.blue,
href: terminal.compoundStyle(['blue','underline'])
},
unescape: true
};
var opts = merge(defaultOptions, options);
terminal(md,opts);
// console.log(styles)
};
if (!errors) {
if (!version) {
const date = (new Date()).toLocaleDateString();
version = `abstruse_${date}`;
}
if (!description) {
description = 'Deployed with Abstruse.';
}
if (!applicationType) {
applicationType = 'zip';
}
let msg = style.yellow.open + style.bold.open + '==> deploy started' +
style.bold.close + style.yellow.close + '\r\n';
observer.next({ type: 'data', data: msg });
// 2. set credentials for awscli
let command = {
type: CommandType.deploy, command: `aws configure set aws_access_key_id ${accessKeyId}`
};
dockerExec(container, command, variables)
.toPromise()
.then(result => {
if (!(result && result.data === 0)) {
const m = 'aws configure aws_access_key_id failed';
observer.next({ type: 'containerError', data: m});
return Promise.reject(1);
}
}
}
if (!region) {
if (preferences && preferences.region) {
region = preferences.region;
} else {
const msg =
chalk.red('region is not set in environment variables or in yml config file \r\n');
observer.next({ type: 'data', data: msg });
errors = true;
}
}
if (!errors) {
let msg = style.yellow.open + style.bold.open + '==> deploy started' +
style.bold.close + style.yellow.close + '\r\n';
observer.next({ type: 'data', data: msg });
// 2. check if appspec.yml exists (otherwise create it)
appSpecExists(container).then(exists => {
let commands = [];
if (!exists) {
commands.push(
{ type: CommandType.deploy, command: `echo version: 0.0 >> appspec.yml` },
{ type: CommandType.deploy, command: `echo os: linux >> appspec.yml` },
{ type: CommandType.deploy, command: `echo files: >> appspec.yml` },
{ type: CommandType.deploy, command: `echo ' - source: ./' >> appspec.yml` },
{ type: CommandType.deploy, command: `echo ' destination: ./' >> appspec.yml` }
);
}
async function promptQuestions (
env /*: string */,
containerRegistries /*: Array */,
kubeContexts /*: Array */
) {
let saved = packageJson['deploy-node-app'] && packageJson['deploy-node-app'][env]
if (!saved) {
// Gives some context to what we are about to do and why we are asking questions:
process.stdout.write(
`\n${warning} Preparing to deploy ${style.bold.open +
style.green.open +
env +
style.reset.open}...\n\n`
)
saved = {}
}
// TODO: dont prompt for the above if answers exist in package.json?
let answers = await inquirer.prompt(
[
saved.port
? null
: {
name: 'port',
type: 'input',
message: 'What port does your application listen on?',
default: '3000',
observer.next({ type: 'exit', data: msg });
observer.error(msg);
} else if (event.type === 'containerInfo') {
observer.next({
type: 'exposed ports',
data: { type: 'ports', info: event.data.NetworkSettings.Ports }
});
} else if (event.type === 'exit') {
if (Number(event.data) !== 0) {
let msg = [
`build: ${proc.build_id} job: ${proc.job_id} =>`,
`last executed command exited with code ${event.data}`
].join(' ');
let tmsg = style.red.open + style.bold.open +
`\r\n[error]: executed command returned exit code ${event.data}` +
style.bold.close + style.red.close;
observer.next({ type: 'exit', data: chalk.red(tmsg) });
observer.error(msg);
docker.killContainer(name)
.then(() => {
sub.unsubscribe();
observer.complete();
})
.catch(err => console.error(err));
}
} else {
observer.next(event);
}
}, err => {
observer.error(err);
function colorizeKey(k)
{
return applyStyle(ansiStyles.bold, applyStyle(ansiStyles.magenta, k));
}
'use strict';
var AnsiEscapes = require('ansi-escapes');
var AnsiStyles = require('ansi-styles');
var webpack = require('webpack');
require('object.assign').shim();
var bold = AnsiStyles.bold;
var inverse = AnsiStyles.inverse;
var red = AnsiStyles.red;
var yellow = AnsiStyles.yellow;
var green = AnsiStyles.green;
var blue = AnsiStyles.blue;
var magenta = AnsiStyles.magenta;
var bgRed = AnsiStyles.bgRed;
var bgYellow = AnsiStyles.bgYellow;
var bgGreen = AnsiStyles.bgGreen;
var bgBlue = AnsiStyles.bgBlue;
var cursorUp = AnsiEscapes.cursorUp;
var cursorDown = AnsiEscapes.cursorDown;
var eraseEndLine = AnsiEscapes.eraseEndLine;
translate(program.args.join(' '), {from: program.from, to: program.to}).then(res => {
let msg = '';
spinner.stop();
if (res.from.language.didYouMean) {
msg = `${chalk.bold('Did you mean to translate from ')}`;
msg += `${chalk.green.bold(languages[res.from.language.iso])}${chalk.bold('?')}`;
}
let correctedSpelling = '';
if (res.from.text.value !== '') {
if (chalk.supportsColor) {
correctedSpelling = res.from.text.value.replace(/\[/g, styles.bold.open + styles.green.open);
correctedSpelling = correctedSpelling.replace(/]/g, styles.bold.close + styles.green.close);
} else {
correctedSpelling = res.from.text.value.replace(/\[/g, '');
correctedSpelling = correctedSpelling.replace(/]/g, '');
}
}
if (res.from.text.autoCorrected) {
if (msg !== '') {
msg += '\n';
}
msg += `${chalk.bold('Auto corrected to:')} ${correctedSpelling}`;
} else if (res.from.text.didYouMean) {
if (msg !== '') {
msg += '\n';
}
.then(() => {
let m = style.yellow.open + style.bold.open + '==> deployment completed successfully!'
+ style.bold.close + style.yellow.close + '\r\n';
observer.next({ type: 'data', data: m });
observer.complete();
})
.catch(err => {