This repository has been archived by the owner on Mar 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.js
89 lines (86 loc) · 2.89 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
module.exports = function(grunt) {
var fs = require('fs');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-replace');
grunt.initConfig({
data: {
version: grunt.option('build-number') || grunt.file.readJSON('bower.json').version || '',
copyright: '2013-<%= grunt.template.today("yyyy") %> Jacob van Mourik',
},
connect: {
main: {
options: {
port: 8000,
base: './'
}
}
},
qunit: {
main: {
options: {
urls: fs.readdirSync('./tests')
.filter(function(file) {
return /\.html$/.test(file);
})
.map(function(file) {
return 'http://localhost:8000/tests/' + file;
})
}
}
},
replace: {
main: {
files: [{
expand: true,
flatten: true,
src: ['require-i18next/i18next.js', 'require-i18next/i18next-builder.js'],
dest: './require-i18next/'
}],
options: {
patterns: [{
match: /@version.*(\r?\n)/g,
replacement: '@version <%= data.version %>$1',
}, {
match: /@copyright.*(\r?\n)/g,
replacement: '@copyright <%= data.copyright %>$1',
}, {
match: /version: ".*"/g,
replacement: 'version: "<%= data.version %>"',
}]
}
},
json: {
files: [{
expand: true,
flatten: true,
src: ['bower.json', 'package.json'],
dest: './'
}],
options: {
patterns: [{
match: /"version": ".*"/g,
replacement: '"version": "<%= data.version %>"',
}]
}
}
},
uglify: {
main: {
files: {
'require-i18next/i18next.min.js': ['require-i18next/i18next.js']
},
options: {
banner: '/* RequireJS i18next Plugin v<%= data.version %> | (c) <%= data.copyright %> | MIT Licensed */\n'
}
}
},
jshint: {
all: ['require-i18next/i18next.js', 'require-i18next/i18next-builder.js', 'tests/*.js']
}
});
grunt.registerTask('test', ['connect', 'qunit']);
grunt.registerTask('default', ['jshint', 'test', 'replace', 'uglify']);
};