How to use the util function from grunt

Find comprehensive JavaScript grunt.util code examples handpicked from public code repositorys.

-3
fork icon45
star icon1
watch icon31

+ 3 other calls in file

22
23
24
25
26
27
28
29
30
31
  // console.log('PATHS > ' + JSON.stringify(paths));

  return paths;
};

module.exports = grunt.util._.extend(getHttpPathsFromJSON('data/pages.json'), {
  /** /
  dist_index: {
    options: {url: '<%= pkg.http_path %>/pages/index.html'},
    dest: '<%= pkg.dist_dir %>/index.html'
fork icon1
star icon2
watch icon3

+ 3 other calls in file

64
65
66
67
68
69
70
71
72
73
var config = {
  pkg: grunt.file.readJSON('package.json'),
  env: process.env
};

grunt.util._.extend(config, loadConfig('./tasks/options/'));
//grunt.util._.extend(config, config_manual);
grunt.initConfig(config);

///////////////////////////////////////////
fork icon16
star icon0
watch icon2

11
12
13
14
15
16
17
18
19
20
module.exports = init;

var grunt = require('grunt'),
    path = require('path');

var _ = grunt.util._;
var defaultEnv = {};

function init(grunt)
{
fork icon7
star icon20
watch icon2

18
19
20
21
22
23
24
25
26
27
 * @return {object} bower's .json configuration object
 */
var findBowerJSON = function (BI) {
  var bowerJSON;

  grunt.util._.each(['bower.json', 'component.json'], function (configFile) {
    if (!helpers.is(bowerJSON, 'object') && grunt.file.isFile(configFile)) {
      bowerJSON = grunt.file.readJSON(configFile);

      if (configFile !== 'bower.json') {
fork icon87
star icon0
watch icon1

26
27
28
29
30
31
32
33
34
35
  if (err) {
    autocrlf = 'false';
  }

  if (autocrlf === 'false') {
    grunt.util.linefeed = '\n';
  }
});

// Hook into grunt.task.init to load the built-in init task.
fork icon71
star icon191
watch icon0

39
40
41
42
43
44
45
46
47
48
var changes = Object.keys(changesJSON);
var done = this.async();

var changedFilesWithinCards = changes.filter(byRegex(/^cards\//));
var changedFiles            = changes.filter(byNegatedRegex(/^cards\//));
var changedCards            = grunt.util._.unique(changedFilesWithinCards.map(cardName));

console.log('files', changedFiles);
console.log('cardsFiles', changedFilesWithinCards);
console.log('cards', changedCards);
fork icon12
star icon79
watch icon19

28
29
30
31
32
33
34
35
36
37
var trigger = options.trigger || false;
delete options.trigger;

// turn options into spawn options
var spawnOptions = [process.argv[1]];
grunt.util._.each(options, function(val, key) {
  spawnOptions.push('--' + key);
  spawnOptions.push(val);
});
spawnOptions.push(task);
fork icon9
star icon60
watch icon6

36
37
38
39
40
41
42
43
44
45
// Register task.
parent.registerTask.apply(task, arguments);
// This task, now that it's been registered.
var thisTask = task._tasks[name];
// Metadata about the current task.
thisTask.meta = grunt.util._.clone(registry.meta);
// Override task function.
var _fn = thisTask.fn;
thisTask.fn = function(arg) {
  // Guaranteed to always be the actual task name.
fork icon3
star icon0
watch icon0

+ 77 other calls in file

78
79
80
81
82
83
84
85
86
87
    fail: 'fatal',
    error: errorToObject(e),
    errcode: errcode
  });
  grunt.task.clearQueue();
  grunt.util.exit(typeof errcode === 'number' ? errcode : grunt.fail.code.FATAL_ERROR);
};

grunt.fail.warn = function (e, errcode) {
  process.send({
fork icon3
star icon0
watch icon62

37
38
39
40
41
42
43
44
45
if (!files.length) {
  grunt.log.writeln('No existing files in this target.');
  return cb();
}

grunt.util.async.forEachSeries(files, function(fp, callback) {
  var dest = fp.dest;
  var src = fp.dest;
  var data = {};
fork icon2
star icon4
watch icon7

+ 5 other calls in file

0
1
2
3
4
5
6
7
8
'use strict';

var assert = require('assert');
var path = require('path');
var grunt = require('grunt');
var spawn = grunt.util.spawn;

module.exports = function() {
  var done = this.async();
fork icon0
star icon0
watch icon2

36
37
38
39
40
41
42
43
44
45
  args: ['pack', 'packages/react-noop-renderer'],
  opts: {
    cwd: 'build/',
  },
};
grunt.util.spawn(spawnCmd, function() {
  var buildSrc = 'build/react-noop-renderer-' + grunt.config.data.pkg.version + '.tgz';
  var buildDest = 'build/packages/react-noop-renderer.tgz';
  fs.rename(buildSrc, buildDest, done);
});
fork icon0
star icon0
watch icon3

90
91
92
93
94
95
96
97
98
99
  transforms: [envify({NODE_ENV: 'development'})],
  packageName: 'React (with addons)',
  after: [simpleBannerify]
};

var addonsMin = grunt.util._.merge({}, addons, {
  outfile: './build/react-with-addons.min.js',
  debug: false,
  transforms: [envify({NODE_ENV: 'production'})],
  after: [minify, bannerify]
fork icon0
star icon0
watch icon3

+ 3 other calls in file

78
79
80
81
82
83
84
85
86
87

var args = ['--harmony', path.join('node_modules', 'jest-cli', 'bin', 'jest')];
if (configPath) {
  args.push('--config', configPath);
}
grunt.util.spawn({
  cmd: 'node',
  args: args,
  opts: { stdio: 'inherit', env: { NODE_ENV: 'test' } },
}, function(spawnErr, result, code) {
fork icon0
star icon0
watch icon2

+ 7 other calls in file

48
49
50
51
52
53
54
55
56
57
var gitTag = {
  cmd: 'git',
  args: ['tag', tag],
  opts: opts
};
grunt.util.spawn(gitAddAll, function() {
  grunt.util.spawn(gitAddDel, function() {
    grunt.util.spawn(gitCommit, function() {
      if (tag) {
        grunt.util.spawn(gitTag, cb);
fork icon0
star icon0
watch icon2

+ 39 other calls in file

50
51
52
53
54
55
56
57
58
59
grunt.moduleId = 'canvas_quiz_statistics';
grunt.paths = {
  canvasPackageShims: 'tmp/canvas_package_shims.json'
};

grunt.util.loadOptions = loadOptions;
grunt.util.loadTasks = loadTasks;

loadOptions('./tasks/options/');
loadTasks('./tasks');
fork icon0
star icon0
watch icon4

+ 3 other calls in file