Generator.prototype._injectDependencies = function _injectDependencies() { var howToInstall = '\nAfter running `npm install & bower install`, inject your front end dependencies into' + '\nyour HTML by running:' + '\n' + chalk.yellow.bold('\n grunt bower-install'); if (this.options['skip-install']) { console.log(howToInstall); } else { wiredep({ directory: 'app/bower_components', bowerJson: JSON.parse(fs.readFileSync('./bower.json')), ignorePath: 'app/', src: 'app/' + (this.jade ? 'jade/index.jade': 'index.html') }); } };
Generator.prototype._injectBowerScripts = function() { if (this.options['skip-add']) { console.log( '\nI did not inject deps into app/index.html. Once `bower install` has been run, you can\n' + 'do this manually by running: '+chalk.yellow.bold('grunt bower-install') ); } else { apputil.title('Injecting bower dependencies into %yellowapp/index.html%/yellow'); wiredep({ directory: 'app/bower_components', bowerJson: JSON.parse(fs.readFileSync(path.join(process.cwd(), 'bower.json'))), ignorePath: 'app/', htmlFile: 'app/index.html', cssPattern: '<link rel="stylesheet" href="{{filePath}}">', exclude: ['angular-mocks.js', 'observe.js', 'angularfire.min.js'] }); } };
function listFiles() { var wiredepOptions = _.extend({}, conf.wiredep, { dependencies: true, devDependencies: true }); var patterns = wiredep(wiredepOptions).js .concat([ path.join(conf.paths.src, '/*.js'), ]); var files = patterns.map(function(pattern) { return { pattern: pattern }; }); return files; }
function injectBowerComponents () { var wiredepOptions = { src: __dirname + '/../ui/index.html', bowerJson: require(__dirname + '/../bower.json'), // DO NOT REMOVE __dirname as this is needed for installs through npm. // The path can vary, dummy! directory: __dirname + '/../bower_components', // this ignore path makes it search in current folder (./), // fixing the context root path issues. ignorePath: '../bower_components/' }; $wiredep(wiredepOptions); }
Generator.prototype._injectDependencies = function _injectDependencies() { var howToInstall = '\nAfter running `npm install & bower install`, inject your front end dependencies into' + '\nyour HTML by running:' + '\n' + chalk.yellow.bold('\n grunt bower-install'); if (this.options['skip-install']) { console.log(howToInstall); } else { wiredep({ directory: 'app/bower_components', bowerJson: JSON.parse(fs.readFileSync('./bower.json')), ignorePath: 'app/', htmlFile: 'app/index.html', cssPattern: '<link rel="stylesheet" href="{{filePath}}">' }); } };
wiredep: function(opts, callback){ function getRelativePath(file){ return path.relative(process.cwd(), file); }; opts.directory = opts.directory || 'bower_components'; var bowerJson = opts.file ? require(path.join(process.cwd(), opts.file)) : require (path.join(process.cwd(), 'bower.json')); var bowerSourceFiles = wiredep({ exclude: opts.exclude, directory: opts.directory, bowerJson: bowerJson }); callback(null, { bower: { js: bowerSourceFiles.js ? parseSlashes(excludeFiles(opts.exclude, bowerSourceFiles.js.map(getRelativePath))) : [], css: bowerSourceFiles.css ? parseSlashes(excludeFiles(opts.exclude,bowerSourceFiles.css.map(getRelativePath))) : [] } }); },
function concatLibsCSS() { var bowerList = wiredep(config.wiredep)['css'] || ''; return gulp.src(bowerList) .pipe(concat(config.finalLibCSS)) .pipe($.autoprefixer({ browsers: config.browsers })) .pipe($.cssnano( { zindex: false, safe: true } )) .pipe($.rev()) .pipe(gulp.dest(config.releaseSource)); }
/** * Returns an array of files required by Karma to run the tests. * * @return {!Array<string>} */ function getFileList() { // All app dependencies are required for tests. Include them. let wiredepOptions = { dependencies: true, devDependencies: true, }; return wiredep(wiredepOptions).js.concat([ path.join(conf.paths.frontendTest, '**/*.json'), path.join(conf.paths.frontendTest, '**/*.js'), path.join(conf.paths.frontendSrc, '**/*.js'), path.join(conf.paths.frontendSrc, '**/*.html'), path.join(conf.paths.bowerComponents, 'google-closure-library/closure/goog/base.js'), { pattern: path.join(conf.paths.bowerComponents, 'google-closure-library/closure/goog/deps.js'), included: false, served: false, }, ]); }
function injectBowerCSSToIndex(done) { var bowerList = wiredep({})['css'] || undefined; if (bowerList) { var bower = gulp.src(bowerList); console.log(bowerList); return gulp.src(config.cssDestination) .pipe($.inject( bower, injectBowerCSS)) .pipe(gulp.dest(config.cssDestinationFolder)); } else { done(); } }
module.exports = function(wallaby) { return { files: wiredep({ devDependencies: true, directory: './bower_components/', ignorePath: './..' })['js'].map(function(dep) { return { pattern: dep, instrument: false } }).concat([ // test libs { pattern: 'node_modules/chai/chai.js', instrument: false }, { pattern: 'node_modules/sinon/pkg/sinon.js', instrument: false }, { pattern: 'node_modules/sinon-chai/lib/sinon-chai.js', instrument: false }, { pattern: 'node_modules/babel-polyfill/browser.js', instrument: false}, // app files 'src/client/app/**/*.html', 'src/client/**/*.module.ts', // first modules 'src/client/**/*.ts', // then the rest '!src/client/**/*.spec.ts' ]), tests: [ 'src/client/**/*.spec.ts' ], testFramework: 'mocha', compilers: { '**/*.ts': wallaby.compilers.typeScript({ target: 'es5' }) }, preprocessors: { '**/*.html': function(file) { return angularTemplatePreprocessor.transform(file, { stripPrefix: 'src/client/', moduleName: 'app' }) } } }; };
function runTests(singleRun, done) { var bowerDeps = wiredep({ directory: 'bower_components', dependencies: true, devDependencies: true }); var testFiles = bowerDeps.js.concat([ paths.src + '/{app,components}/**/!(*.config|*.controller|*.service|*.directive|*.filter|*.routes).js', paths.src + '/{app,components}/**/!(*.spec|*.mocks).js', paths.src + '/{app,components}/**/*.mocks.js', paths.src + '/{app,components}/**/*.js' ]); gulp.src(testFiles) .pipe($.plumber()) .pipe($.karma({ configFile: 'karma.conf.js', action: (singleRun) ? 'run': 'watch' })); }
gulp.task('test', function () { var bowerDeps = wiredep({ directory: 'bower_components', exclude: ['bootstrap-sass-official'], dependencies: true, devDependencies: true }); var testFiles = bowerDeps.js.concat([ 'src/{app,components}/**/*.js' ]); return gulp.src(testFiles) .pipe($.karma({ configFile: 'karma.conf.js', action: 'run' })) .on('error', function (err) { // Make sure failed tests cause gulp to exit non-zero throw err; }); });
function runTests (singleRun, done) { var bowerDeps = wiredep({ directory: 'bower_components', exclude: ['bootstrap-sass-official'], dependencies: true, devDependencies: true }); var testFiles = bowerDeps.js.concat([ paths.src + '/{app}/**/*.js' ]); gulp.src(testFiles) .pipe($.karma({ configFile: 'karma.conf.js', action: (singleRun)? 'run': 'watch' })) .on('error', function (err) { // Make sure failed tests cause gulp to exit non-zero throw err; }); }