Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderChain(currentChain) {
// If it's a lerna dependency, ignore it.
if (currentChain.filter(item => lernaRegex.test(item)).length) {
return;
}
//currentChain.reverse();
console.log(currentChain.join(colors.bold(" ← "))); // →
}
function loadConfig() {
log('Loading config file...');
if (checkFileExists('config.yml')) {
// config.yml exists, load it
log(colors.bold(colors.cyan('config.yml')), 'exists, loading', colors.bold(colors.cyan('config.yml')));
let ymlFile = fs.readFileSync('config.yml', 'utf8');
return yaml.load(ymlFile);
} else if(checkFileExists('config-default.yml')) {
// config-default.yml exists, load it
log(colors.bold(colors.cyan('config.yml')), 'does not exist, loading', colors.bold(colors.cyan('config-default.yml')));
let ymlFile = fs.readFileSync('config-default.yml', 'utf8');
return yaml.load(ymlFile);
} else {
// Exit if config.yml & config-default.yml do not exist
log('Exiting process, no config file exists.');
log('Error Code:', err.code);
process.exit(1);
}
}
* This script builds and tests the AMP runtime in single pass mode.
* This is run during the CI stage = test; job = single pass tests.
*/
const colors = require('ansi-colors');
const {
printChangeSummary,
startTimer,
stopTimer,
timedExecOrDie: timedExecOrDieBase,
} = require('./utils');
const {determineBuildTargets} = require('./build-targets');
const {isTravisPullRequestBuild} = require('../common/travis');
const FILENAME = 'single-pass-tests.js';
const FILELOGPREFIX = colors.bold(colors.yellow(`${FILENAME}:`));
const timedExecOrDie = (cmd, unusedFileName) =>
timedExecOrDieBase(cmd, FILENAME);
function main() {
const startTime = startTimer(FILENAME, FILENAME);
if (!isTravisPullRequestBuild()) {
timedExecOrDie('gulp update-packages');
timedExecOrDie('gulp dist --fortesting --single_pass');
timedExecOrDie(
'gulp integration --nobuild --compiled --single_pass --headless'
);
} else {
printChangeSummary(FILENAME);
const buildTargets = determineBuildTargets(FILENAME);
if (
name,
description,
author
})
fs.outputFileSync(destinationPath, output)
})
console.log(c.bold.green(`Action ${name} created successfully.\n`))
console.log(`Type ${c.bold(`"cd ${name}"`)} to go to the action root directory followed by ${c.bold('"sh setup.sh"')} to install the dependencies.`)
console.log(c.bold('\nAvailable commands:'))
console.log(`- ${c.bold('npm run dev ')} Automatically rebuilds and run the action on file change.`)
console.log(`- ${c.bold('npm run build ')} Builds the action in production mode.`)
console.log(`- ${c.bold('npm run test ')} Runs the test suite.`)
console.log(`- ${c.bold('npm run launch')} Runs the action in production mode.`)
console.log(`- ${c.bold('npm run lint ')} Performs a linter check.`)
console.log(`- ${c.bold('npm start ')} Lints, builds and tests the action.`)
console.log('')
}
function exec(command, args, env, options, callback) {
const proc = spawn(command, args, {env: env});
if (args && args.length > 0) {
const lastArg = args[args.length - 1];
console.log('Running: ' + c.bold(command) + ' ... ' + c.bold(lastArg));
} else {
console.log('Running: ' + c.bold(command));
}
proc.stdout.on('data', function (data) {
if (options.verbose) {
process.stdout.write(data);
}
});
proc.stderr.on('data', function (data) {
process.stderr.write(data);
});
proc.on('close', function (code) {
if (code) {
description,
author
})
fs.outputFileSync(destinationPath, output)
})
console.log(c.bold.green(`Action ${name} created successfully.\n`))
console.log(`Type ${c.bold(`"cd ${name}"`)} to go to the action root directory followed by ${c.bold('"sh setup.sh"')} to install the dependencies.`)
console.log(c.bold('\nAvailable commands:'))
console.log(`- ${c.bold('npm run dev ')} Automatically rebuilds and run the action on file change.`)
console.log(`- ${c.bold('npm run build ')} Builds the action in production mode.`)
console.log(`- ${c.bold('npm run test ')} Runs the test suite.`)
console.log(`- ${c.bold('npm run launch')} Runs the action in production mode.`)
console.log(`- ${c.bold('npm run lint ')} Performs a linter check.`)
console.log(`- ${c.bold('npm start ')} Lints, builds and tests the action.`)
console.log('')
}
cp.stderr.on('data', data => {
errors.push(`\n${color.bold(color.red(script[0] + ' error:'))}\n\n${data}`);
});
.map(([prop, value]) => `${colors.bold(col(prop, w))} ${value}`)
.join("\n");
function getLogHeader(header) {
const line = new Array(65).join('-');
return colors.bold('\n' + line + '\n ' + header + '\n' + line + '\n\n');
}