]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Add package_json grunt task to update package.json
authorIskren Chernev <iskren.chernev@gmail.com>
Wed, 30 Jul 2014 04:36:30 +0000 (21:36 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Wed, 30 Jul 2014 04:36:30 +0000 (21:36 -0700)
package.json contains a list of locale files, that was manually updated until
now. This PR adds a grunt task to update package.json and registers it to run
on release.

fixes #1766

Gruntfile.js
tasks/package_json.js [new file with mode: 0644]

index b4537929d7ce2e4115875bb32ecd23552abfead4..05785cded2f8875d8d5c83090982c317d9f2ab7e 100644 (file)
@@ -216,6 +216,6 @@ module.exports = function (grunt) {
     // Task to be run when releasing a new version
     grunt.registerTask('release', [
         'jshint', 'nodeunit', 'concat', 'embedLocales',
-        'component', 'uglify'
+        'component', 'package_json', 'uglify'
     ]);
 };
diff --git a/tasks/package_json.js b/tasks/package_json.js
new file mode 100644 (file)
index 0000000..9f3d1df
--- /dev/null
@@ -0,0 +1,9 @@
+module.exports = function (grunt) {
+    grunt.registerTask('package_json', function () {
+        var config = JSON.parse(grunt.file.read('package.json'));
+
+        config.spm.output = grunt.file.expand('locale/*.js');
+
+        grunt.file.write('package.json', JSON.stringify(config, true, 4) + '\n');
+    });
+}