Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.arguments('[dir]')
.option('-m, --module', 'create a module')
.parse(process.argv);
var directory = path.resolve(program.args[0] || '.');
var projectType = require('../lib/framer_test.js')(directory);
// create [dir] if it doesn't exist
if (!projectType) fs.mkdirpSync(directory);
// scaffold project/module if [dir] is empty
if (!!!fs.readdirSync(directory).length) {
var projectType = program.module ? 'module' : 'project';
var toPath = '../boilerplate/' + projectType;
console.log(colors.grey('Creating %s...'), projectType);
fs.copySync(path.resolve(__dirname, toPath), directory);
// move into [dir]
process.chdir(directory);
console.log(colors.grey('Installing project dependencies...'));
exec('framer update');
exec('npm install --production');
} else console.warn(colors.red('Error: ') + directory + ' is not empty');
function formatDevTrace(level, context, message, args, err) {
var str,
mainMessage = util.format.apply(global, [message].concat(args)),
printStack = API.stacktracesWith.indexOf(level) > -1,
errCommomMessage = err && (err.name + ': ' + err.message),
isErrorLoggingWithoutMessage = mainMessage === errCommomMessage;
switch (level) {
case 'DEBUG':
str = colors.grey(level);
break;
case 'INFO':
str = colors.blue(level) + ' '; // Pad to 5 chars
break;
case 'WARN':
str = colors.yellow(level) + ' '; // Pad to 5 chars
break;
case 'ERROR':
str = colors.red(level);
break;
case 'FATAL':
str = colors.red.bold(level);
break;
}
str += ' ' + mainMessage;
function formatDiff (diff, contextStart, linesBefore, linesAfter) {
return colors.cyan('@@ line ' + contextStart + ' @@') + '\n' +
// Prefix lines before with two spaces in order to align with "+ "
(linesBefore ? colors.grey(linesBefore.replace(/^/gm, ' ')) + '\n' : '') +
colors.red('- ' + diff.textBefore) + colors.bold.bgRed(diff.removed) + colors.red(diff.textAfter) + '\n' +
(diff.added !== null
? (colors.green('+ ' + diff.textBefore) + colors.bold.bgGreen(diff.added) + colors.green(diff.textAfter) + '\n')
: ''
) +
colors.grey(linesAfter.replace(/^/gm, ' '));
}
const onFinish = (filename, outputPath, startTime) => {
const endTime = Date.now();
console.log(colors.green(`${colors.grey(filename)} finished: ${outputPath} in ${colors.blue(endTime - startTime + 'ms')}`));
}
.map(project => {
console.log(
`${Colors.yellow(project.id)} - ${Colors.bold(project.name)} | ${Colors.grey(new Date(
project.created_at
).toString())}`
);
});
}
static debug(message) {
Print.log(colors.grey(message), 4);
}
function gwtLabel(label, options) {
if (!label) {
return '';
}
if (!options.style){
return label;
}
if (options.dark) {
return colors.grey(label);
}
if (options.white) {
return colors.white(label);
}
return colors.yellow(label);
}
} else {
let icons = res.favicon.files_urls
.filter((url) => url.indexOf('manifest.json') === -1)
.map((url) => path.join(iconsPath, path.basename(url)));
app.log(colors.bold(colors.green('icons generated!')));
app.log(colors.grey(`(${icons.join(')\n(')})`));
let newManifest = path.join(output, iconsPath, 'manifest.json');
if (fs.existsSync(newManifest)) {
let realManifest = path.join(output, 'manifest.json');
fs.writeFileSync(realManifest, fs.readFileSync(newManifest));
fs.unlinkSync(newManifest);
app.log(`${colors.bold(colors.green('menifest generated!'))} ${colors.grey(`(${realManifest})`)}`);
}
if (res.favicon.html_code) {
app.log(colors.yellow('remember to include'));
app.log(colors.grey(
res.favicon.html_code.replace(path.join(iconsPath, 'manifest.json'), '/manifest.json')
));
app.log(colors.yellow('in your index.html file.'));
}
resolve(res);
}
});
});
prompt() {
process.stdout.write(color.bgBlack(color.grey(color.green(`${this.id}_${this.address}:${this.port}`) + ' > ')));
},
setPrompt(sockParams) {