Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _diffStrings(oldStr: string, newStr: string, context: number): string[] {
const patch: Patch = structuredPatch(null, null, oldStr, newStr, null, null, { context });
const result = new Array();
for (const hunk of patch.hunks) {
result.push(colors.magenta(`@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`));
const baseIndent = _findIndent(hunk.lines);
for (const line of hunk.lines) {
// Don't care about termination newline.
if (line === '\\ No newline at end of file') { continue; }
const marker = line.charAt(0);
const text = line.slice(1 + baseIndent);
switch (marker) {
case ' ':
result.push(`${CONTEXT} ${text}`);
break;
case '+':
result.push(colors.bold(`${ADDITION} ${colors.green(text)}`));
break;
case '-':
result.push(colors.bold(`${REMOVAL} ${colors.red(text)}`));
break;
this.on('stop-tty-received', function () {
console.log('\n => SIGINT received => we will stop streaming watch results to the terminal,\n' +
'but they will continue to be streamed to the project-watch log file, here => \n ' +
colors.magenta(projectOutputLog), '\n\n');
process.nextTick(function () {
process.exit(0);
});
});
gulp.task('copy', function() {
console.log(colors.magenta('⬤ Copy files to build/... ⬤'));
return gulp.src(['assets/**/*', '*.html'])
.pipe(copy('build/'));
});
}
}
];
try {
require.resolve('suman-server');
}
catch (err) {
const p = {
type: 'confirm',
name: 'confirmNoSumanServerInstalled',
message: 'Please acknowledge that you will need to' +
' install the suman-server package if you wish to use the watch features,\n' +
' you can do that with ' + colors.magenta('"$ suman --use-server"') + ', (we will auto-generate this command for you later, this is just FYI).',
when: function () {
console.log('\n\n -------------------------------------- \n\n');
_suman.backspacing = false;
return true;
},
onLeftKey: function () {
_suman.onBackspace(backspaceCB);
},
validate: function (item) {
return true;
}
};
prompt1.unshift(p);
prompt2.unshift(p);
}
const path = require('path');
const colors = require('colors/safe');
const taskName = colors.bold(colors.magenta(`[taktil]`));
module.exports = (project_root = '.', { production = false, watch = false }) => {
process.chdir(project_root);
const webpackPath = path.join(process.cwd(), 'node_modules', 'webpack');
let webpack;
try {
webpack = require(webpackPath);
} catch (e) {
console.error(
`\n${taskName} ${colors.bold(
colors.red('ERROR: No local Webpack installation found.')
)}\n${webpackPath}`
);
console.error(colors.cyan('\n try "npm install webpack"\n'));
return;
);
console.log(colors.cyan('\n✻ Header'));
console.log(colors.cyan(json.plain(token.decoded.header)));
console.log(colors.yellow('\n✻ Payload'));
console.log(colors.yellow(json.plain(token.decoded.payload)));
const dates = {'iat': 'Issued At', 'nbf': 'Not Before', 'exp': 'Expiration Time'}
for (const [field, name] of Object.entries(dates)) {
if (token.decoded.payload.hasOwnProperty(field)) {
console.log(colors.yellow(` ${name}: `) + niceDate(token.decoded.payload[field]));
}
}
console.log(colors.magenta('\n✻ Signature ' + token.decoded.signature));
}
webpack: (config, env) => {
console.log(colors.magenta('Starting RMWC ❤️'));
return pipe(
fixLinting,
addAliases,
config => {
//console.log(config);
return config;
}
)(config);
},
storybook: (config, env) => pipe(addAliases)(config),
function info(msg) {
sh.echo(colors.magenta(msg));
}
exec: function (args, $, res, body) {
var n = parseInt(args[0], 10);
if (isNaN(n)) {
n = (type === 'number') ? 0 : null;
}
client.set(prop, n);
showSuccess(
'changed', colors.magenta(prop),
'property to', colors.red(client[prop])
);
}
};