forked from floating-ui/floating-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
113 lines (106 loc) · 3.3 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
'use strict';
var grunt = require('grunt');
var fs = require('fs');
var version = JSON.parse(fs.readFileSync('./package.json')).version;
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-serve');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.loadNpmTasks('grunt-env');
module.exports = function(grunt) {
// comma separated list of browsers to run tests inside
var browsers = grunt.option('browsers') ? grunt.option('browsers').split(',') : ['ChromeTest'];
// Project configuration.
grunt.initConfig({
uglify: {
dist: {
options: {
sourceMap: true,
sourceMapName: 'build/popper.min.js.map',
preserveComments: /(?:license|version)/
},
files: {
'build/popper.min.js': ['build/popper.js']
}
}
},
copy: {
dist: {
nonull: true,
src: 'src/popper.js',
dest: 'build/popper.js',
}
},
jsdoc2md: {
oneOutputFile: {
src: 'src/*.js',
dest: 'doc/documentation.md'
}
},
karma: {
options: {
frameworks: ['jasmine'],
singleRun: true,
browsers: browsers,
customLaunchers: {
'ChromeTest': {
base: 'Chrome',
flags: ['--window-size=800,872'] // 800x800 plus karma shell
}
},
files: [
{ pattern: 'bower_components/**/*.js', included: false },
{ pattern: 'bower_components/requirejs/require.js', included: true },
{ pattern: 'src/**/*.js', included: false },
'tests/*.js',
'tests/styles/*.css'
]
},
unit: {},
local: {
singleRun: false,
}
},
jshint: {
default: ['src/**/*.js']
},
serve: {
options: {
port: 9000
}
},
usebanner: {
dist: {
options: {
replace: '\{\{version\}\}',
banner: version,
position: 'replace',
},
files: {
src: [ 'build/popper.js' ]
}
}
},
shell: {
xvfb: {
command: 'Xvfb :99 -ac -screen 0 1600x1200x24',
options: {
async: true
}
}
},
env: {
xvfb: {
DISPLAY: ':99'
}
}
});
grunt.registerTask('doc', ['jsdoc2md']);
grunt.registerTask('dist', [ 'copy:dist', 'usebanner:dist', 'uglify:dist']);
grunt.registerTask('test', ['jshint', 'karma:local']);
grunt.registerTask('test-ci', ['jshint', 'shell:xvfb', 'env:xvfb', 'karma:unit', 'shell:xvfb:kill']);
};