Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
setSettings(argv);
if (global.settings.production) {
// in production mode, make sure environment is production
process.env.NODE_ENV = 'production';
}
// Customize CLI behavior
// Make gulp think we have tasks so that it doesn't error
if (argv._) {
if (argv._[0] && argv._[0].indexOf(':') > -1) {
gutil.log(gutil.colors.red('Running subtasks is not allowed due to unknown behavior.'));
process.exit();
}
const tasks = Object.keys(gulp.tasks);
// fill in missing tasks
const toFillIn = ['_', 'platform', 'recipe'];
toFillIn.forEach((key) => {
if (argv[key]) {
const vals = Array.isArray(argv[key]) ? argv[key] : [argv[key]];
vals.forEach((taskName) => {
if (tasks.indexOf(taskName) === -1) {
gulp.task(taskName, () => {});
}
});
}
});
}
require('./boilerplate/scripts/analyze.js');
require('./boilerplate/scripts/build.js');
return function (done){
// console.log(this.storage.get('me'))
/**
* Set options.generator equal to the context of the current gulp taks;
* @type {Object};
*/
options.generator = new Generator( this, options, __this );
_.extend(gulp.tasks.default, options.generator);
options.doneCallback = done;
return __stream.validate( options )
.then( __stream.flow )
.then( __stream.defaults )
.then( __stream.prompts )
.then( __stream.configuration )
.then( __stream.filter )
.then( __stream.paths )
.then( __stream.use )
.catch( done )
}
}
return gulp
.src(path.resolve(cwd, 'node_modules/unjar-from-url/node_modules/gromit/html/oauth.html'))
.pipe(gulp.dest(path.resolve(cwd, 'dist')));
});
gulp.task('copy:gromit', function() {
return gulp
.src(path.resolve(cwd, 'node_modules/unjar-from-url/node_modules/gromit/**/*'))
.pipe(gulp.dest(path.resolve(cwd, 'dist/gromit')));
});
gulp.task('copy:extras', ['copy:oauth.html', 'copy:gromit']);
// Ensure copy:extras is a part of the copy:development & copy:production base tasks:
gulp.tasks['copy:development'].dep.push('copy:extras');
gulp.tasks['copy:production'].dep.push('copy:extras');
'type-assertions': {
description: 'Inlines runtime type assertions for the type annotations.',
type: 'boolean'
}
})
.argv;
pragmatist(gulp, {
es5: argv.es5,
forceLogging: true,
notifications: argv.notifications,
prefix: 'pragmatist:',
typeAssertions: argv.typeAssertions
});
knownTaskNames = _.keys(gulp.tasks);
executeTaskNames = argv._;
Promise
.resolve(executeTaskNames)
/* eslint-disable lodash3/prefer-lodash-method */
.map((taskName) => {
/* eslint-enable lodash3/prefer-lodash-method */
let executeTaskName;
executeTaskName = 'pragmatist:' + taskName;
if (_.indexOf(knownTaskNames, executeTaskName) === -1) {
throw new Error('"' + executeTaskName + '" task does not exist.');
}
return new Promise((resolve) => {
it( 'taskLoader returns tasks', function ( done ) {
console.log( 'gulp.tasks', gulp.tasks );
expect( gulp.tasks ).not.to.be.undefined;
expect( gulp.tasks ).to.have.property( 'lessEach' );
expect( gulp.tasks ).to.have.property( 'lessReduce' );
done();
} );
bold: '\x1b[1m',
green: '\x1b[32m',
magenta: '\x1b[35m'
};
console.log('');
console.log(c.green + c.bold + 'Main Commands' + c.reset);
console.log(c.green + '-------------------------------------------' + c.reset);
console.log(c.green + 'clean' + c.reset + ' - delete the .tmp/ and dist/ folders.');
console.log(c.green + 'build' + c.reset + ' - execute the release build and output into the dist/ folder.');
console.log(c.green + 'serve:dist' + c.reset + ' - execute the release build and output into the dist/ folder then run a local server for the files.');
console.log(c.green + 'serve' + c.reset + ' - run JShint and LESS compiler to produce .tmp/ folder. Then serve up the app on a local server.');
console.log('');
console.log(c.green + c.bold + 'All Commands' + c.reset);
console.log(c.green + '-------------------------------------------' + c.reset);
console.log(Object.keys(gulp.tasks).sort().join('\n'));
console.log('');
});
gulp.task('copy-images', ['copy-fonts'], require('./build/tasks/styles').copyImages);
gulp.task('copy-javascripts', ['clean'], require('./build/tasks/javascripts').copy);
gulp.task('list', require('./build/tasks/list'));
gulp.task('html', require('./build/tasks/html'));
gulp.task('styles-dev', require('./build/tasks/styles').dev);
gulp.task('styles-dist', require('./build/tasks/styles').dist);
gulp.task('javascripts-app', require('./build/tasks/javascripts').app);
gulp.task('javascripts-vendor', require('./build/tasks/javascripts').vendor);
gulp.task('watch', require('./build/tasks/watch'));
var build_deps = {
'styles-dev': ['copy-less', 'copy-fonts', 'copy-images'],
'styles-dist': ['copy-less', 'copy-fonts']
};
Object.keys(gulp.tasks)
.filter(function(task) { return !/clean|copy|list/.test(task) })
.forEach(function(task) {
var deps = build_deps[task] || ['clean'];
gulp.task('build-' + task, deps, gulp.tasks[task].fn);
});
gulp.task('build-dev', function() {
gulp.start(
'build-html',
'build-styles-dev',
'build-javascripts-app',
'build-javascripts-vendor'
);
});
gulp.task('default', ['build-watch']);
var c = {
reset: '\x1b[0m',
bold: '\x1b[1m',
green: '\x1b[32m',
magenta: '\x1b[35m'
};
console.log('');
console.log(c.green + c.bold + 'Main Commands' + c.reset);
console.log(c.green + '-------------------------------------------' + c.reset);
console.log(c.green + 'clean' + c.reset + ' - delete the dist/ folder.');
console.log(c.green + 'build' + c.reset + ' - execute the release build and output into the dist/ folder.');
console.log('');
console.log(c.green + c.bold + 'All Commands' + c.reset);
console.log(c.green + '-------------------------------------------' + c.reset);
console.log(Object.keys(gulp.tasks).sort().join('\n'));
console.log('');
return;
});
argv = argv.filter(function(arg){
var task = gulp.tasks[arg];
if( task ){
var str = (
'\ngulp.task(\'' + task.name + '\',' +
JSON.stringify(task.dep) +', ' +
(''+task.fn) + ');'
).replace(/\n/g, '\n ');
if(!args.noColor && !env.noColor){
str = util.ansiJS(str);
} else {
argv.splice(argv.indexOf('--no-color'), 1);
}
runtime.output.write(str + '\n\n');
return false;
}
tasks.forEach((name) => {
const task = gulp.tasks[name]
if (task) {
gulp.start(name)
} else {
log(`${task} is not defined`)
}
})
done()