-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathGruntfile.js
105 lines (98 loc) · 2.6 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-shell');
grunt.initConfig({
bower: grunt.file.readJSON('bower.json'),
clean: {
all: {
src: ["build", "compiled", "dist"]
}
},
copy: {
bower: {
src: 'bower.json',
dest: 'dist/',
}
},
connect: {
publisher: {
options: {
port: 8000,
base: '.'
}
},
sqwidget: {
options: {
port: 8002,
base: 'example-widget'
}
}
},
requirejs: {
compile: {
options: {
baseUrl: "src",
out: '<%= bower.name %>.js',
paths: {
requirejs: 'lib/requirejs/require',
domReady: 'lib/requirejs-domready/domReady',
},
include: ['requirejs', 'sqwidget'],
wrap: {
startFile: 'src/_wrapper/top.js',
endFile: 'src/_wrapper/bottom.js'
},
optimize: 'uglify2',
//optimize: 'none',
//required for source maps, we should probably have 2 configs one
//without source maps or uglification
generateSourceMaps: false
//preserveLicenseComments: false,
//generateSourceMaps: true
}
}
},
karma: {
options: {
configFile: './karma.conf.js',
browsers: ['Chrome', 'Firefox']
},
unit: {
background: true
},
//continuous integration mode: run tests once in PhantomJS browser.
continuous: {
singleRun: true,
browsers: ['PhantomJS']
},
},
shell: {
build_example: {
options: { stdout: true, stderr: true },
command: "./build_example.sh"
}
},
watch: {
test: {
files: ["test/fixture/*.js", "src/*.js", "test/spec/*.js"],
tasks: ["karma:unit:run"]
},
sqwidget: {
files: ["src/*.js", "test/spec/*.js"],
tasks: ["karma:unit:run", "build"]
},
scaffold: {
files: ["grunt-scaffold/root/main.js", "grunt-scaffold/root/app/**/*.js", "grunt-scaffold/**/*.tmpl"],
tasks: ["build"]
}
}
});
grunt.registerTask("build", ["requirejs:compile"]);
grunt.registerTask("dist", ["clean", "karma:unit", "build" ]);
grunt.registerTask("test", ["clean", "karma:unit", "watch:test"]);
};