forked from Sunbird-Knowlg/sunbird-content-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
170 lines (155 loc) · 5.34 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Generated on 2015-12-14 using generator-angular 0.14.0
'use strict';
module.exports = function(grunt) {
// Configurable paths for the application
var appConfig = {
app: 'app',
dist: 'dist'
};
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
yeoman: appConfig,
// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: ['app/scripts/{,*/}*.js', 'app/bower_components/*/index.js', 'plugins/**/{,*/}*.js', 'plugins/**/*.json'],
tasks: ['newer:jshint:all', 'newer:jscs:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
styles: {
files: ['app//{,*/}*.css'],
tasks: ['newer:copy:styles', 'postcss']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'app/{,*/}*.html',
'app/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
},
css: {
files: 'app/styles/**/*.scss',
tasks: ['compass']
},
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function(connect) {
return [
connect.static(appConfig.app),
connect().use(
'/bower_components',
connect.static('./app/bower_components')
),
connect().use(
'/libs',
connect.static('./app/libs')
),
connect().use(
'/app/styles',
connect.static('./app/styles')
),
connect().use(
'/plugins',
connect.static('../Content-Plugins')
)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
aws_s3: {
options: {
accessKeyId: '', // Use the variables
secretAccessKey: '', // You can also use env variables
region: 'ap-south-1',
uploadConcurrency: 5, // 5 simultaneous uploads
downloadConcurrency: 5 // 5 simultaneous downloads
},
main: {
options: {
bucket: 'ekstep-public-dev',
differential: true, // Only uploads the files that have changed
gzipRename: 'ext' // when uploading a gz file, keep the original extension
},
files: [
{ dest: 'v3/preview/', cwd: 'app/preview/', action: 'download' }
]
}
},
// this is only used for deployment
compress: {
main: {
options: {
archive: 'ce-docs.zip'
},
files: [{
src: ['docs/**']
}]
}
},
rename: {
main: {
files: [
{ src: ['dist'], dest: 'content-editor' },
]
}
},
jsdoc: {
framework: {
src: ['app/scripts/**/*.js', '!**/node_modules/**', '!**/bower_components/**', '!**/libs/**', 'README.md'],
options: {
destination: 'docs/framework'
}
},
plugins: {
src: ['plugins/**/*.js', '!**/node_modules/**', '!**/bower_components/**', '!**/libs/**', 'README.md'],
options: {
destination: 'docs/plugins'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.registerTask('serve', 'Compile then start a connect web server', function(target) {
console.log("from serve", target);
if (target === 'staging' || target === "production") {
return grunt.task.run([target]);
}
return grunt.task.run(['staging']);
});
grunt.registerTask('staging', [
// Add further deploy related tasks here
'connect:livereload',
'watch'
]);
grunt.registerTask('default', ['jsdoc']);
grunt.registerTask('compress');
};