Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function build(directory, callback) {
console.log(
colors.dim(".."),
require("path").basename(directory),
colors.dim(directory)
);
var templatePackage, isPublic, method;
var name, template, description, id;
try {
templatePackage = fs.readJsonSync(directory + "/package.json");
} catch (e) {
templatePackage = {};
console.warn(
colors.dim(" "),
colors.red("Warning: ENOENT " + colors.dim(directory + "/package.json"))
);
// package.json is optional
if (tldname || '.' === state.input[state.input.length - 1]) {
part = suggestedTld.tld.substr(tldname.length);
state.hint = input + part;
} else {
part = ' (.' + suggestedTld.tld;
state.hint = '';
}
complete += colors.dim(part);
if (searchable && authparts.length > 1) {
state.input += eppprompt.split('').map(function () { return '•'; }).join('') + auth;
complete +=
colors.bold(eppprompt + auth)
+ colors.dim('xxxxxxxx'.split('').slice(auth.length).join(''))
;
}
else {
if (suggestedTld.tld) {
part += ' ' + suggestedTld.usd;
if (suggestedTld.na) {
complete += ' ' + colors.red('N/A');
}
else if (suggestedTld.available) {
complete += ' ' + colors.cyan(suggestedTld.usd);
}
else if (exactTld) {
complete += ' ' + colors.dim(suggestedTld.usd.replace(/./g, '-'));
//complete += ' ' + suggestedTld.usd;
}
extantEntry.dateStamp > deletedEntry.dateStamp &&
extantEntry.title === deletedEntry.title
);
});
if (!candidates.length) return next();
var candidate = candidates[0];
var newDate = candidate.date;
var newDateStamp = candidate.dateStamp;
console.log(
"\n" +
extantEntry.title +
"\n" +
colors.dim(process.argv[2].slice(0, -1) + extantEntry.url)
);
console.log(
colors.dim(
"Consider the date from the deleted post '" +
candidate.title +
"' (" +
candidate.path +
")"
)
);
yesno.ask(
"> Change date from " +
colors.red(extantEntry.date) +
" to " +
colors.green(newDate) +
"? (y/n)",
function list(callback) {
console.log(colors.dim("Help:"));
console.log(
"node scripts/state <label>",
colors.dim("Load application state from list below")
);
console.log(
"node scripts/state/save <label>",
colors.dim("Save existing state under label")
);
console.log(
"node scripts/state/remove <label>",
colors.dim("Delete existing state under label")
);
console.log(
"node scripts/state/fetch",
colors.dim("Download latest production db")
);
console.log();
console.log("Local:");
fs.readdirSync(directory)
.filter(function(i) {
return (
i.indexOf("production-") === -1 &&
fs.statSync(directory + "/" + i).isDirectory()
);
})</label></label></label>
function getContextMessage(source, lineNumber, columnNumber) {
source = source.split('\n');
var lineDigits = ('' + (lineNumber + 1)).length + 1;
var padding = repeatString(' ', lineDigits);
var previousPrefix = colors.dim(pad(padding, (lineNumber - 1), true) + '| ');
var errorPrefix = colors.dim(pad(padding, lineNumber, true) + '| ');
var followingPrefix = colors.dim(pad(padding, (lineNumber + 1), true) + '| ');
var previousLine = source[lineNumber - 2] + '\n';
var errorLine = colors.bold(source[lineNumber - 1]) + '\n';
var followingLine = source[lineNumber] + '\n';
previousLine = previousLine.trim().slice(0, 2) === '//' ? colors.dim(previousLine) : previousLine;
followingLine = followingLine.trim().slice(0, 2) === '//' ? colors.dim(followingLine) : followingLine;
var previousTotal = previousLine === 'undefined\n' ? '' : previousPrefix + previousLine;
var errorTotal = errorPrefix + errorLine;
var followingTotal = followingLine === 'undefined\n' ? '' : followingPrefix + followingLine;
return previousTotal + errorTotal + (padding + getArrow(columnNumber)) + followingTotal;
}
download(blog.avatar, path, function(err) {
if (err) return next(err);
var message =
colors.dim("Replace avatar for ") +
colors.yellow(blog.handle) +
" - " +
blog.id +
colors.dim("\nOld: ") +
blog.avatar +
colors.dim("\nNew: ") +
avatar +
colors.dim("\n ") +
path +
" - " +
humanFileSize(fs.statSync(path).size);
yesno.ask(message, true, function(ok) {
if (!ok) return next();
Blog.set(blog.id, { avatar: avatar }, next);
});
});
}
function(item, index, done) {
log(colors.dim(++index + "/" + totalItems), item.title[0].trim());
Item(item, outputDirectory, done);
},
callback
name,
packageName,
publish,
annotations,
version
}: {
name: string
packageName: string
publish: boolean
annotations: { key: string; value: string }[]
version: string
}) => ({
name: pn(name, packageName),
'published?': pp(publish),
kind: pk(annotations),
version: colors.dim(version)
})
plugins: ({ name, attributes }: { name: string; attributes: { key: string; value: string }[] }) => {
return {
name: pn(name),
version: colors.dim(attributes.find(({ key }) => key === 'version').value)
}
},
_default: ({