Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "grunt-npm", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A set of helpers for dealing with NPM from Grunt.", | ||
@@ -5,0 +5,0 @@ "bugs": { |
@@ -18,6 +18,6 @@ # grunt-npm | ||
### grunt npm-show | ||
### grunt npm-show (also aliased as show) | ||
Show all the files that would be published to NPM. This is useful if you wanna make sure you are not publishing files you don't want to... | ||
### grunt npm-publish | ||
### grunt npm-publish (also aliased as publish) | ||
@@ -37,1 +37,15 @@ #### Configuration | ||
``` | ||
### grunt npm-contributors (also aliased as contributors) | ||
Update contributors in `package.json` - all developers who commited to the repository, sorted by number of commits. A `.mailmap` file can be used to map multiple emails to a single person. | ||
#### Configuration | ||
```js | ||
'npm-contributors': { | ||
options: { | ||
file: 'package.json', | ||
commit: true, | ||
commitMessage: 'Update contributors' | ||
} | ||
} | ||
``` |
@@ -76,2 +76,47 @@ module.exports = function(grunt) { | ||
}); | ||
/** | ||
* Generate contributors, all developers who contributed, sorted by number of commits. | ||
*/ | ||
grunt.registerTask('npm-contributors', 'Update contributors in package.json', function() { | ||
var done = this.async(); | ||
var opts = this.options({ | ||
file: 'package.json', | ||
commit: true, | ||
commitMessage: 'Update contributors' | ||
}); | ||
exec('git log --pretty=short | git shortlog -nse', function(err, stdout) { | ||
var pkg = grunt.file.readJSON(opts.file); | ||
pkg.contributors = stdout.toString().split('\n').slice(1, -1).map(function(line) { | ||
return line.replace(/^[\W\d]+/, ''); | ||
}); | ||
grunt.file.write(opts.file, JSON.stringify(pkg, null, ' ') + '\n'); | ||
exec('git status -s ' + opts.file, function(err, stdout) { | ||
if (!stdout) { | ||
grunt.log.ok('The contributors list is already up to date.'); | ||
return done(); | ||
} | ||
exec('git commit ' + opts.file + ' -m "' + opts.commitMessage + '"', function(err, stdout, stderr) { | ||
if (err) { | ||
grunt.log.error('Cannot commit contributors changes:\n ' + stderr); | ||
} else { | ||
grunt.log.ok('The contributors list has been updated.'); | ||
} | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
// aliases | ||
grunt.registerTask('contributors', 'npm-contributors'); | ||
grunt.registerTask('show', 'npm-show'); | ||
grunt.registerTask('publish', 'npm-publish'); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5364
100
50