Browse Source

chore(grunt): add grunt release and update changelog

zhixin 9 years ago
parent
commit
7e69a82f2c
3 changed files with 58 additions and 4 deletions
  1. 11 0
      CHANGELOG.md
  2. 42 0
      Gruntfile.js
  3. 5 4
      package.json

+ 11 - 0
CHANGELOG.md

@@ -1,5 +1,16 @@
 ## ChangeLog
 
+### 1.10.1
+
+- revert: feat: update escape to false
+- feat: add `checkInvert` method
+- feat: add `bootstrap-table-he-IL.js`
+- bug: update grunt to development dependency
+- bug: press on toolbar elements, the key-events it will not run
+- bug: remove bogus conditions that will always be true
+- bug: refactor filter control select input initialization
+- bug: typo in Slovak translation
+
 ### 1.10.0
 
 - [bug] Fixed #1619: sub-table checkbox selects all the table.

+ 42 - 0
Gruntfile.js

@@ -1,5 +1,7 @@
 'use strict';
 
+var fs = require('fs');
+
 module.exports = function(grunt) {
 
     // Project configuration.
@@ -77,14 +79,54 @@ module.exports = function(grunt) {
                 dest: 'docs/dist',      // destination folder
                 expand: true            // required when using cwd
             }
+        },
+        release: {
+            options: {
+                additionalFiles: ['bootstrap-table.jquery.json'],
+                beforeRelease: ['docs', 'default']
+            }
         }
     });
 
+    var bumpVersion = function (path, version, startWith) {
+        var lines = fs.readFileSync(path, 'utf8').split('\n');
+        lines.forEach(function (line, i) {
+            if (line.indexOf(startWith) === 0) {
+                lines[i] = startWith + version;
+            }
+        });
+        fs.writeFileSync(path, lines.join('\n'), 'utf8');
+
+        grunt.log.ok('bumped version of ' + path + ' to ' + version);
+    };
+
+    grunt.registerTask('docs', 'build the docs', function () {
+        var version = require('./package.json').version;
+        bumpVersion('./_config.yml', version, 'current_version: ');
+        bumpVersion('./src/bootstrap-table.js', version, ' * version: ');
+        bumpVersion('./src/bootstrap-table.css', version, ' * version: ');
+
+        var changeLog = fs.readFileSync('./CHANGELOG.md', 'utf8');
+        var latestLogs = changeLog.split('### ')[1];
+        var date = new Date();
+
+        var lines = [
+            '### Latest release (' +
+            [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-') + ')',
+            '',
+            '#### v' + latestLogs
+        ];
+        fs.writeFileSync('./docs/_includes/latest-release.md', lines.join('\n'), 'utf8');
+
+        grunt.log.ok('updated the latest-release.md to ' + version);
+    });
+
     grunt.loadNpmTasks('grunt-contrib-clean');
     grunt.loadNpmTasks('grunt-contrib-concat');
     grunt.loadNpmTasks('grunt-contrib-uglify');
     grunt.loadNpmTasks('grunt-contrib-cssmin');
     grunt.loadNpmTasks('grunt-contrib-copy');
+    grunt.loadNpmTasks('grunt-release');
 
     grunt.registerTask('default', ['clean', 'concat', 'uglify', 'cssmin', 'copy']);
 };

+ 5 - 4
package.json

@@ -8,13 +8,14 @@
   },
   "devDependencies": {
     "cz-conventional-changelog": "^1.1.5",
-    "grunt-contrib-copy": "^0.8.0",
-    "grunt-contrib-concat": "^0.5.1",
+    "grunt": "^0.4.5",
     "grunt-contrib-clean": "^0.6.0",
+    "grunt-contrib-concat": "^0.5.1",
+    "grunt-contrib-copy": "^0.8.0",
     "grunt-contrib-cssmin": "^0.12.2",
-    "grunt-contrib-uglify": "^0.8.0",
     "grunt-contrib-jshint": "^0.10.0",
-    "grunt": "^0.4.5"
+    "grunt-contrib-uglify": "^0.8.0",
+    "grunt-release": "^0.13.0"
   },
   "repository": {
     "type": "git",