-
Notifications
You must be signed in to change notification settings - Fork 27
/
Gruntfile.js
executable file
·70 lines (63 loc) · 1.5 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
pkg.version = pkg.version.split(".");
var subversion = pkg.version.pop();
subversion++;
pkg.version.push(subversion);
pkg.version = pkg.version.join(".");
grunt.file.write('package.json', JSON.stringify(pkg, null, 2));
console.log("---------------------------------------");
console.log(" Building mysql-import Version "+pkg.version);
console.log("---------------------------------------");
grunt.initConfig({
pkg: pkg,
concat: {
options: {
banner: '/**\n * <%= pkg.name %> - v<%= pkg.version %>' +
'\n * <%= pkg.description %>' +
'\n * @author <%= pkg.author %>' +
'\n * @website <%= pkg.homepage %>' +
'\n * @license <%= pkg.license %>' +
'\n */\n\n'
},
dist: {
src: [
'src/header.js',
'src/importer.js',
'src/parser.js'
],
dest: 'mysql-import.js',
},
},
'string-replace': {
source: {
files: {
"mysql-import.js": "mysql-import.js"
},
options: {
replacements: [{
pattern: /{{ VERSION }}/g,
replacement: '<%= pkg.version %>'
}]
}
},
readme: {
files: {
"README.md": "README.md"
},
options: {
replacements: [{
pattern: /\d+\.\d+\.\d+/g,
replacement: '<%= pkg.version %>'
}]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-string-replace');
grunt.registerTask('default', [
'concat',
'string-replace'
]);
};