Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var q = async.queue(function (resource, next) {
resource.user = options.marvin;
resource.languages = _.compact(_.map(resource.languages.split(','),_.trim)).sort()
resource.name = resource.name || resource.title_en;
// check that every urls exist
console.log(clc.blackBright(' creating ...', clc.whiteBright(resource.slug)))
Resource.create(resource, function (err, res) {
if(err) {
q.kill();
callback(err)
} else {
console.log(clc.blackBright(' resource: ', clc.whiteBright(res.id), 'saved,', q.length(), 'resources remaining'));
next();
}
})
}, 1);
q.push(options.data);
}
} else if (mode === "react"){
compiled = {
name,
content: ReactCompiler(name, file, css, js),
type: "react"
}
} else {
console.log(clc.redBright("\nError!!!\n"))
console.log(clc.redBright(`Invalid Mode.`));
process.exit(1);
}
functions.writeFile(compiled); //Append Files to the output folder
functions.writeComponents(name, mode, Components());
console.log(clc.greenBright("\nSuccess...\n"))
console.log(`Thanks for use ${clc.whiteBright("Rocket Translator")}.\n\nOpen ${clc.whiteBright(output)} to view your files.`);
} else if(mode === "--version" || mode === "-v") {
let {version} = require("../package.json");
console.log("v"+version);
}
};
} else if (mode === "angular"){
compiled = {
name,
content: AngularCompiler(name, file, css, js),
type: "react"
};
} else {
console.log(clc.redBright("\nError!!!\n"));
console.log(clc.redBright("Invalid Mode."));
process.exit(1);
}
functions.writeFile(compiled); //Append Files to the output folder
functions.writeComponents(name, mode, Components);
console.log(clc.greenBright("\nSuccess...\n"));
console.log(`Thanks for use ${clc.whiteBright("Rocket Translator")}.\n\nOpen ${clc.whiteBright(output)} to view your files.`);
} else if(mode === "--version" || mode === "-v") {
let {version} = require("../package.json");
console.log(`v${version}`);
}
_findFile(pathname) {
if (!existsSync(pathname)) {
console.log(clc.redBright("\nError!!!\n"));
console.error(clc.whiteBright("File does not exist."));
process.exit(1);
} else {
//If is not a HTML file
if (!/\w*.html$/.test(pathname)) {
console.log(clc.redBright("\nError!!!\n"));
console.error(clc.whiteBright("Please select a html file."));
process.exit(1);
} else {
const data = readFileAsString(pathname);
//Remove external files routes
this._file = data
.replace(/#(js|css) .*(\n|\r\n|\r)/g, "")
.split(//g)
.map((e, i) => i > 0 ? e.replace(/(\n|\r|\r\n)*(.*(\n|\r|\r\n)*)*<\/script>/, "") : e)
.join("");
this._getFileData(data, "js"); //Get Js Route and Data
this._getFileData(data, "css"); //Get Css Route and Data
this._getScriptTags(data);
this._getStyleTags(data);
}
offset: 0,
verbose: false
},
async = require('async'),
clc = require('cli-color'),
_ = require('lodash'),
tasks = require('require-all')({
dirname: __dirname + '/../tasks',
filter : /(.*).js$/
}),
query = tasks.helpers.cypher.perf,
tick = tasks.helpers.tick,
ticker = { verbose: false };
console.log(clc.whiteBright( "Starting perfomance test for " + options.cypher + "..."));
var sampleSize = 5,
sampleConfig = [],
sample = 1,
sampleValues = [];
_.range(sampleSize).forEach(function() {
sampleConfig = sampleConfig.concat([
tick.start,
function (options, callback) {
process.stdout.write("Taking sample " + sample + "/" + sampleSize + "\r");
query(options, function(err, results) {
if (err) {
callback(err);
} else {
sample = sample + 1;
"Like fireworks in a shed.",
"throw new NotAndWillNeverBeImplementedException()",
"Now we know. Noooow we know. We know now.",
"Hate the game.",
"Syms and shims",
"Zoinks!",
"Using DHTML technologies",
"Life is squill.Pane",
"Needs more ketchup."
].sort(function () { return Math.random() - 0.5; });
var version = common.sdkVersion.toString();
var versionLength = version.length; //clc adds escape chars
version = clc.yellow(version);
var colouredGCText = clc.whiteBright("{{") + clc.cyanBright(" Game Closure SDK ") + clc.whiteBright("}}");
console.log([
"============================================================",
" " + colouredGCText + " ",
" ".substr(0, (60-versionLength)/2) + version,
" ".substr(0, (60-opts[0].length)/2) + opts[0],
"------------------------------------------------------------",
""].join('\n'));
}
const clc = require("cli-color");
console.log(clc.greenBright(`Congratulations!!!\n\n`) + clc.whiteBright("We have new things!!!\n"));
console.log("If you want know more, go to: " + clc.whiteBright(`https://github.com/davidsdevel/rocket-translator/blob/master/CHANGELOG.md`));
warningKeys.forEach(key => {
warningMessage += clc.whiteBright(`\n${key}:\n`);
global.Warnings[key].forEach(line => {
warningMessage += `\n${line}`;
warningCount++;
});
});
console.log(clc.yellowBright(`\nWarning!!! Compiled with ${clc.white(warningCount)} issues`));
console.log(`${warningMessage}\n`);
}
else
console.log(clc.greenBright("\nSuccess...\n"));
console.log(`Thanks for use ${clc.whiteBright("Rocket Translator")}.\n\nOpen ${clc.whiteBright(this.output)} to view your files.`);
console.log(`\nSend a feedback to ${clc.whiteBright("@davidsdevel")} on Twitter.\n\nTo report a Error, open a new issue on:\n${clc.whiteBright("https://github.com/davidsdevel/rocket-translator")}`);
}
}
const formatValue = (value, comment, sign) => (
`${sign ? color.cyan(` ${sign} `) : ''}${color.whiteBright(value.toLocaleString().padStart(sign ? 5 : 8))} ${` (${comment})\n`}`
);