Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
default:
options.output = path.resolve(options.output);
}
options.outputDir = path.normalize(options.output);
// resolve input dir
options.templates = (options.templates || [])
.concat(__dirname + '/template/')
.map(function(dir){
return path.resolve(options._configPath || options.base, dir);
});
return options;
}
var command = clap.create('create')
.description('Code generator')
.option('-b, --base
//
var target;
var output = [];
switch (topic)
{
case 'app':
case 'module':
target = topic == 'app' ? options.output : path.join(options.output, options.name);
resolveDirPath(target);
output = [target];
// if folder exists and not empty - confirm possible file rewrite
if (fs.readdirSync(target).length)
clap.confirm('Destination folder is not empty, some files may be overwritten. Continue? (y/n) ', function(yes){
if (yes)
{
console.log();
mainTask();
}
});
else
mainTask();
break;
case 'type':
options.instanceName = options.name.charAt(0).toLowerCase() + options.name.substr(1);
target = options.output;
output = [target];
{
var cfgFile = curpath.join(path.sep) + path.sep + 'basis.config';
if (fs.existsSync(cfgFile))
return fetchConfig(cfgFile);
curpath.pop();
}
}
//
// main part
//
var program = cli.create('basis')
.version(require('../package.json').version)
.option('-n, --no-config', 'Don\'t use basis.config')
.option('-c, --config-file ', 'Specify path to config filename')
.delegate(function(nextCommand){
var options = this.values;
if (options.config && nextCommand.name != 'completion')
{
var config = options.configFile
? fetchConfig(options.configFile)
: searchConfig();
if (config)
{
nextCommand.config = config.data;
nextCommand.configFile = config.filename;
nextCommand.configPath = config.path;
}
// source map placed in external file
if (inputMapFile) {
inputMapContent = fs.readFileSync(inputMapFile, 'utf8');
}
return {
input: inputMapContent,
inputFile: inputMapFile || (inputMapContent ? '' : false),
output: map,
outputFile: outputMapFile
};
}
var command = cli.create('csso', '[input] [output]')
.version(require('../package.json').version)
.option('-i, --input ', 'Input file')
.option('-o, --output ', 'Output file (result outputs to stdout if not set)')
.option('-m, --map ', 'Generate source map: none (default), inline, file or ', 'none')
.option('-u, --usage ', 'Usage data file')
.option('--input-map <source>', 'Input source map: none, auto (default) or ', 'auto')
.option('--restructure-off', 'Turns structure minimization off')
.option('--stat', 'Output statistics in stderr')
.option('--debug [level]', 'Output intermediate state of CSS during compression', debugLevel, 0)
.action(function(args) {
var options = this.values;
var inputFile = options.input || args[0];
var outputFile = options.output || args[1];
var usageFile = options.usage;
var usageData = false;
var map = options.map;
};
}
function processCommentsOption(value) {
switch (value) {
case 'exclamation':
case 'first-exclamation':
case 'none':
return value;
}
console.error('Wrong value for `comments` option: %s', value);
process.exit(2);
}
var command = cli.create('csso', '[input] [output]')
.version(require('../package.json').version)
.option('-i, --input ', 'Input file')
.option('-o, --output ', 'Output file (result outputs to stdout if not set)')
.option('-m, --map ', 'Generate source map: none (default), inline, file or ', 'none')
.option('-u, --usage ', 'Usage data file')
.option('--input-map <source>', 'Input source map: none, auto (default) or ', 'auto')
.option('--restructure-off', 'Turns structure minimization off')
.option('--comments ', 'Comments to keep: exclamation (default), first-exclamation or none', 'exclamation')
.option('--stat', 'Output statistics in stderr')
.option('--debug [level]', 'Output intermediate state of CSS during compression', debugLevel, 0)
.action(function(args) {
var options = this.values;
var inputFile = options.input || args[0];
var outputFile = options.output || args[1];
var usageFile = options.usage;
var usageData = false;
handlerList = [handlerList];
else
handlerList = [];
options.preprocess[type] = handlerList;
}
options.preprocess[type] = handlerList.map(function(fn){
return path.normalize(path.resolve(this.context.configPath || '.', fn));
}, this);
}
return options;
}
module.exports = clap.create('extract', '[file]')
.description('Extract file graph')
.init(function(){
var config = this.context.config = this.root.getConfig(this.values);
if (config)
applyConfig(this, config.data['build'] || {}, config.path);
})
.option('-b, --base
handlerList = [handlerList];
else
handlerList = [];
options.preprocess[type] = handlerList;
}
options.preprocess[type] = handlerList.map(function(fn){
return path.normalize(path.resolve(module.exports._configPath || '.', fn));
});
}
return options;
}
module.exports = clap.create('lint', '[file]')
.description('Lint files')
.init(function(){
var config = this.context.config = this.root.getConfig(this.values);
if (config)
applyConfig(this, config.data['build'] || {}, config.path);
})
.option('-b, --base
config.ignore = Array.isArray(config.ignore)
? config.ignore.map(function(fileMask){
return options.configPath_ ? path.resolve(options.configPath_, fileMask) : fileMask;
})
: false;
config.name = config.name || config.filename;
config.filename = resolve.sync(config.filename || config.name, { basedir: process.cwd() });
return config;
}).filter(Boolean);
return options;
}
module.exports = clap.create('server')
.description('Launch dev-server')
.init(function(){
var config = this.context.config = this.root.getConfig(this.values);
if (config)
{
applyConfig(this, config.data[this.name] || {}, config.path);
if (config.data.plugins)
{
this.values.plugins = config.data.plugins;
this.values.configPath_ = config.path;
}
}
if (!config || !config.editor)
}
for (var type in configPreprocess)
addPreprocessors(type, configPreprocess[type]);
/*if (options.jsCutDev)
{
if (!options.preprocess['script'])
options.preprocess['script'] = [];
options.preprocess['script'].push('./misc/preprocess/js-cut-dev.js');
}*/
return options;
}
module.exports = clap.create('build', '[file]')
.description('Build an app')
.init(function(){
var config = this.context.config = this.root.getConfig(this.values);
if (config)
applyConfig(this, config.data['build'] || {}, config.path);
})
.args(function(filename){
this.setOption('file', filename);
})
.option('-b, --base
if (options.statistics) {
var timeDiff = process.hrtime(time);
showStat(
relInputFilename,
source.length,
result.css.length,
sourceMap.inputFile,
sourceMapAnnotation.length,
parseInt(timeDiff[0] * 1e3 + timeDiff[1] / 1e6, 10),
process.memoryUsage().heapUsed - mem
);
}
});
}
var command = cli.create('csso', '[input]')
.version(require('csso/package.json').version)
.option('-i, --input ', 'Input file')
.option('-o, --output ', 'Output file (result outputs to stdout if not set)')
.option('-s, --source-map ', 'Generate source map: none (default), inline, file or ', 'none')
.option('-u, --usage ', 'Usage data file')
.option('--input-source-map <source>', 'Input source map: none, auto (default) or ', 'auto')
.option('-d, --declaration-list', 'Treat input as a declaration list')
.option('--no-restructure', 'Disable structural optimisations')
.option('--force-media-merge', 'Enable unsafe merge of @media rules')
.option('--comments ', 'Comments to keep: exclamation (default), first-exclamation or none', 'exclamation')
.option('--stat', 'Output statistics in stderr')
.option('--debug [level]', 'Output intermediate state of CSS during a compression', debugLevel, 0)
.option('--watch', 'Watch source file for changes')
.action(function(args) {
var options = processOptions(this.values, args);