This repository has been archived by the owner on Jan 5, 2019. It is now read-only.
forked from gordonbrander/openag-ui
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathGruntfile.js
104 lines (100 loc) · 2.69 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
module.exports = function (grunt) {
var appDbUrl = grunt.option('app_db_url') || 'http://raspberrypi:5984/app';
// Configuration for the CouchApp grunt plugin.
// We set this configuration object on properties of `grunt.initConfig`
// below.
// https://www.npmjs.com/package/grunt-couchapp.
var couch = {
openag_ui: {
db: appDbUrl,
app: './couchapp.js',
options: {
okay_if_missing: true,
okay_if_exists: true
}
}
}
grunt.initConfig({
browserify: {
dev: {
options: {
browserifyOptions: {
// Set source maps
debug: true
},
transform: [
["babelify", {
"presets": ["es2015"]
}]
]
},
files: {
// if the source file has an extension of es6 then
// we change the name of the source file accordingly.
// The result file's extension is always .js
"./dist/scripts/main.js": ["./scripts/main.js"]
}
},
dist: {
options: {
browserifyOptions: {
// Set source maps?
debug: false
},
transform: [
["babelify", {
"presets": ["es2015"]
}]
]
},
files: {
// if the source file has an extension of es6 then
// we change the name of the source file accordingly.
// The result file's extension is always .js
"./dist/scripts/main.js": ["./scripts/main.js"]
}
}
},
copy: {
main: {
files: [
{
src: ['assets/**'],
dest: 'dist/'
},
{
src: ['vendor/**'],
dest: 'dist/'
},
{
src: ['index.html'],
dest: 'dist/index.html'
}
]
}
},
watch: {
scripts: {
files: [
'./scripts/**/*.js',
'./scripts/**/*.json',
'./assets/**',
'openag-config.json'
],
tasks: ["browserify:dev", "copy"]
}
},
mkcouchdb: couch,
rmcouchdb: couch,
couchapp: couch
});
grunt.loadNpmTasks("grunt-browserify");
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-couchapp");
grunt.registerTask("default", ["build"]);
grunt.registerTask("build", ["browserify:dist", "copy"]);
grunt.registerTask('couchapp_install', ['rmcouchdb:openag_ui', 'mkcouchdb:openag_ui', 'couchapp:openag_ui']);
grunt.registerTask('couchapp_deploy', ['build', 'couchapp_install']);
grunt.registerTask("develop", ["browserify:dev", "copy", "watch"]);
};