Skip to content

Commit f263a0b

Browse files
author
Pavel Strashkin
committed
Update to latest Grunt tasks
1 parent 7c1554c commit f263a0b

File tree

5 files changed

+104
-51
lines changed

5 files changed

+104
-51
lines changed

Gruntfile.js

Lines changed: 94 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@
33
module.exports = function (grunt) {
44
require('load-grunt-tasks')(grunt);
55

6-
grunt.registerTask('default', ['build', 'connect:livereload', 'open:server', 'watch']);
7-
grunt.registerTask('regression', ['build', 'protractor:local']);
8-
grunt.registerTask('build', [
9-
'jshint',
10-
'clean',
11-
'ngtemplates',
12-
'concat:app',
13-
'concat:vendor',
14-
'concat:index',
15-
'copy:assets',
16-
'sass:build',
17-
'css_prefix:prefix',
18-
'concat:darkTheme',
19-
'concat:lightTheme'
20-
]);
21-
226
grunt.initConfig({
237
tempdir: '.tmp',
248
distdir: 'dist',
@@ -61,22 +45,17 @@ module.exports = function (grunt) {
6145

6246
livereload: {
6347
options: {
48+
livereload: true,
49+
open: true,
6450
middleware: function (connect) {
6551
return [
66-
require('connect-livereload')(),
6752
connect.static('dist')
6853
];
6954
}
7055
}
7156
}
7257
},
7358

74-
open: {
75-
server: {
76-
url: 'http://localhost:<%= connect.options.port %>'
77-
}
78-
},
79-
8059
clean: {
8160
build: [
8261
'<%= tempdir %>',
@@ -129,6 +108,12 @@ module.exports = function (grunt) {
129108
},
130109

131110
darkTheme: {
111+
options: {
112+
process: function process(value) {
113+
return value.replace(/\.raml-console-CodeMirror/g, '.CodeMirror');
114+
}
115+
},
116+
132117
dest: '<%= distdir %>/styles/<%= pkg.name %>-dark-theme.css',
133118
src: [
134119
'src/assets/styles/vendor/codemirror.css',
@@ -140,6 +125,12 @@ module.exports = function (grunt) {
140125
},
141126

142127
lightTheme: {
128+
options: {
129+
process: function process(value) {
130+
return value.replace(/\.raml-console-CodeMirror/g, '.CodeMirror');
131+
}
132+
},
133+
143134
dest: '<%= distdir %>/styles/<%= pkg.name %>-light-theme.css',
144135
src: [
145136
'src/assets/styles/vendor/codemirror.css',
@@ -156,6 +147,21 @@ module.exports = function (grunt) {
156147
}
157148
},
158149

150+
concurrent: {
151+
build: [
152+
'build:scripts',
153+
'concat:vendor',
154+
'concat:index',
155+
'copy:assets',
156+
'build:styles'
157+
],
158+
159+
themes: [
160+
'concat:darkTheme',
161+
'concat:lightTheme'
162+
]
163+
},
164+
159165
sass: {
160166
build: {
161167
options: {
@@ -168,6 +174,7 @@ module.exports = function (grunt) {
168174
'<%= distdir %>/styles/<%= pkg.name %>-dark-theme.css': 'src/scss/dark-theme.scss'
169175
}
170176
},
177+
171178
min: {
172179
options: {
173180
sourcemap: 'none',
@@ -182,16 +189,43 @@ module.exports = function (grunt) {
182189
},
183190

184191
watch: {
185-
build: {
192+
dist: {
186193
options: {
187194
livereload: true
188195
},
189-
tasks: ['build'],
196+
197+
tasks: [],
190198
files: [
191-
'<%= src.js %>',
192-
'<%= src.scssWatch %>',
193-
'src/app/**/*.tpl.html',
194-
'<%= src.html %>'
199+
'<%= distdir %>/**/*'
200+
]
201+
},
202+
203+
scripts: {
204+
tasks: ['build:scripts'],
205+
files: [
206+
'<%= ngtemplates.ramlConsole.src %>',
207+
'<%= src.js %>'
208+
]
209+
},
210+
211+
vendor: {
212+
tasks: ['concat:scripts'],
213+
files: [
214+
'<%= concat.vendor.src %>'
215+
]
216+
},
217+
218+
index: {
219+
tasks: ['concat:index'],
220+
files: [
221+
'<%= concat.index.src %>'
222+
]
223+
},
224+
225+
styles: {
226+
tasks: ['build:styles'],
227+
files: [
228+
'src/scss/**/*.scss'
195229
]
196230
}
197231
},
@@ -200,7 +234,8 @@ module.exports = function (grunt) {
200234
css_prefix: {
201235
prefix: {
202236
options: {
203-
prefix: 'raml-console-'
237+
prefix: 'raml-console-',
238+
processName: 'trim'
204239
},
205240

206241
files: {
@@ -213,7 +248,7 @@ module.exports = function (grunt) {
213248

214249
jshint: {
215250
options: {
216-
jshintrc: '.jshintrc'
251+
jshintrc: true
217252
},
218253

219254
files: [
@@ -243,4 +278,32 @@ module.exports = function (grunt) {
243278
}
244279
}
245280
});
281+
282+
grunt.registerTask('default', [
283+
'build',
284+
'connect:livereload',
285+
'watch'
286+
]);
287+
288+
grunt.registerTask('build', [
289+
'jshint',
290+
'clean',
291+
'concurrent:build'
292+
]);
293+
294+
grunt.registerTask('build:scripts', [
295+
'ngtemplates',
296+
'concat:app'
297+
]);
298+
299+
grunt.registerTask('build:styles', [
300+
'sass:build',
301+
'css_prefix:prefix',
302+
'concurrent:themes'
303+
]);
304+
305+
grunt.registerTask('regression', [
306+
'build',
307+
'protractor:local'
308+
]);
246309
};

dist/scripts/api-console.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,6 @@
11141114
return;
11151115
}
11161116

1117-
/* jshint es5: true */
11181117
authStrategy = RAML.Client.AuthStrategies.for(scheme, $scope.credentials);
11191118
authStrategy.authenticate().then(function(token) {
11201119
token.sign(request);
@@ -1126,7 +1125,6 @@
11261125
});
11271126

11281127
$scope.requestOptions = request.toOptions();
1129-
/* jshint es5: false */
11301128
} catch (e) {
11311129
// custom strategies aren't supported yet.
11321130
}
@@ -1722,7 +1720,6 @@
17221720
(function() {
17231721
'use strict';
17241722

1725-
/* jshint es5: true */
17261723
RAML.Client.AuthStrategies = {
17271724
for: function(scheme, credentials) {
17281725
if (!scheme) {
@@ -1741,7 +1738,6 @@
17411738
}
17421739
}
17431740
};
1744-
/* jshint es5: false */
17451741
})();
17461742

17471743
'use strict';

package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,21 @@
2323
"homepage": "https://github.com/mulesoft/api-console",
2424
"dependencies": {},
2525
"devDependencies": {
26-
"connect": "~3.3.2",
27-
"connect-livereload": "~0.4.0",
2826
"grunt": "~0.4.0",
2927
"grunt-angular-templates": "~0.5.7",
30-
"grunt-contrib-clean": "~0.4.0",
31-
"grunt-contrib-concat": "~0.1.3",
32-
"grunt-contrib-connect": "~0.8.0",
33-
"grunt-contrib-copy": "~0.4.0",
34-
"grunt-contrib-jshint": "~0.2.0",
28+
"grunt-concurrent": "~1.0.0",
29+
"grunt-contrib-clean": "~0.6.0",
30+
"grunt-contrib-concat": "~0.5.0",
31+
"grunt-contrib-connect": "~0.9.0",
32+
"grunt-contrib-copy": "~0.7.0",
33+
"grunt-contrib-jshint": "~0.10.0",
3534
"grunt-contrib-sass": "~0.8.1",
36-
"grunt-contrib-watch": "~0.3.1",
35+
"grunt-contrib-watch": "~0.6.1",
3736
"grunt-css-prefix": "~0.2.3",
38-
"grunt-karma": "~0.4.4",
39-
"grunt-open": "~0.2.3",
37+
"grunt-karma": "~0.10.1",
4038
"grunt-protractor-runner": "~1.1.4",
4139
"jasmine-spec-reporter": "~1.1.0",
42-
"load-grunt-tasks": "~0.6.0",
43-
"serve-static": "~1.7.1"
40+
"load-grunt-tasks": "~2.0.0",
41+
"serve-static": "~1.8.0"
4442
}
4543
}

src/app/directives/sidebar.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@
323323
return;
324324
}
325325

326-
/* jshint es5: true */
327326
authStrategy = RAML.Client.AuthStrategies.for(scheme, $scope.credentials);
328327
authStrategy.authenticate().then(function(token) {
329328
token.sign(request);
@@ -335,7 +334,6 @@
335334
});
336335

337336
$scope.requestOptions = request.toOptions();
338-
/* jshint es5: false */
339337
} catch (e) {
340338
// custom strategies aren't supported yet.
341339
}

src/common/client/auth_strategies.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
(function() {
22
'use strict';
33

4-
/* jshint es5: true */
54
RAML.Client.AuthStrategies = {
65
for: function(scheme, credentials) {
76
if (!scheme) {
@@ -20,5 +19,4 @@
2019
}
2120
}
2221
};
23-
/* jshint es5: false */
2422
})();

0 commit comments

Comments
 (0)