Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
.fail((msg, err, yargs) => {
debug(err);
yargs.showHelp();
console.error(`\n${symbols.error} ${ansi.red('ERROR:')} ${msg}`);
process.exit(1);
})
.help('help', 'Show usage information & exit')
.alias('help', 'h')
.version('version', 'Show version number & exit', version)
.alias('version', 'V')
.wrap(process.stdout.columns ? Math.min(process.stdout.columns, 80) : 80)
.epilog(
`Mocha Resources
Chat: ${ansi.magenta(gitter)}
GitHub: ${ansi.blue(repository.url)}
Docs: ${ansi.yellow(homepage)}
`
)
.parserConfiguration(YARGS_PARSER_CONFIG)
.config(args)
.parse(args._);
};
function log(statusCode, message, startTime) {
let color = statusCode === 200 ? 'green' : 'red';
let now = new Date();
if (startTime) {
let diff = Date.now() - startTime;
message = message + chalk.blue(" " + diff + "ms");
}
console.log(chalk.blue(now.toISOString()) + " " + chalk[color](statusCode) + " " + message);
}
function log(statusCode, message, startTime) {
let color = statusCode === 200 ? 'green' : 'red';
let now = new Date();
if (startTime) {
let diff = Date.now() - startTime;
message = message + chalk.blue(" " + diff + "ms");
}
console.log(chalk.blue(now.toISOString()) + " " + chalk[color](statusCode) + " " + message);
}
function main() {
const quality = process.env['VSCODE_QUALITY'];
if (!quality) {
console.log('Missing VSCODE_QUALITY, skipping mixin');
return;
}
const productJsonFilter = filter('product.json', { restore: true });
fancyLog(ansiColors.blue('[mixin]'), `Mixing in sources:`);
return vfs
.src(`quality/${quality}/**`, { base: `quality/${quality}` })
.pipe(filter(f => !f.isDirectory()))
.pipe(productJsonFilter)
.pipe(buffer())
.pipe(json(o => Object.assign({}, require('../product.json'), o)))
.pipe(productJsonFilter.restore)
.pipe(es.mapSync(function (f) {
fancyLog(ansiColors.blue('[mixin]'), f.relative, ansiColors.green('✔︎'));
return f;
}))
.pipe(vfs.dest('.'));
}
.on('end', function() {
if (forbiddenFound) {
log(colors.blue(
'Please remove these usages or consult with the AMP team.'));
}
if (missingRequirements) {
log(colors.blue(
'Adding these terms (e.g. by adding a required LICENSE ' +
'to the file)'));
}
if (forbiddenFound || missingRequirements) {
process.exit(1);
}
});
}
cb(null, file);
return;
}
if (file.isStream()) {
logger.error('Streaming not supported');
return;
}
var size = file.contents.length;
var gzipsize = gzipSize.sync(file.contents)
totalSize += size;
totalSizeGzip += gzipsize;
if (options.showFiles === true && size > 0) {
log(options.title, colors.blue(file.relative), size, gzipsize);
}
fileCount++;
cb(null, file);
}, function (cb) {
if (fileCount === 1 && options.showFiles === true && totalSize > 0) {
}, (file, enc, callback) => {
if (file.isNull()) {
return callback(null, file);
}
if (file.isStream()) {
return callback(new Error('gulp-image: Streaming is not supported'));
}
const log = options && options.quiet ? NOOP : fancyLog;
const extension = extname(file.path).toLowerCase();
if (!SUPPORTED_EXTENSIONS.includes(extension)) {
log('gulp-image: Skipping unsupported image ' + colors.blue(file.relative));
return callback(null, file);
}
optimize(file.contents, Object.assign({
pngquant : true,
optipng : false,
zopflipng : true,
jpegRecompress : false,
mozjpeg : true,
guetzli : false,
gifsicle : true,
svgo : true
}, options)).then(buffer => {
const before = file.contents.length;
const after = buffer.length;
const diff = before - after;
actions.push((answers) => {
log('\nCreation finished. Have a look at it:');
log(pad('Go to your project:'), colors.green('cd ' + answers.projectName));
log(pad('Install dependencies:'), colors.green('npm install'));
log(pad('Create the documentation:'), colors.green('npm start'));
log(pad('Open a browser at'), colors.blue('http://localhost:8333'));
});
function assignIssue(issue, assignees) {
const {number} = issue;
const options = extend(
{
url:
'https://api.github.com/repos/ampproject/amphtml/issues/' +
`${number}/assignees`,
method: 'POST',
body: JSON.stringify({
'assignees': assignees,
}),
},
defaultOption
);
if (isDryrun) {
log(colors.blue(`assign PR #${number}, to ${assignees}`));
return Promise.resolve();
}
return request(options);
}
.on('end', function() {
if (forbiddenFound) {
log(
colors.blue(
'Please remove these usages or consult with the AMP team.'
)
);
}
if (missingRequirements) {
log(
colors.blue(
'Adding these terms (e.g. by adding a required LICENSE ' +
'to the file)'
)
);
}
if (forbiddenFound || missingRequirements) {
process.exitCode = 1;
}
});
}