mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
feat(build-system): check that files listed in vendor.yml exist (#1398)
* chore(build-system) check that files listed in vendor.yml exist (#1410) * fix(build-system) Chart.min.js duplicated in vendor.yml (#1410)
This commit is contained in:
parent
3548f0db6f
commit
a2d41e5316
2 changed files with 23 additions and 10 deletions
32
gruntfile.js
32
gruntfile.js
|
@ -55,6 +55,29 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('run-dev', ['build', 'shell:run', 'watch:build']);
|
||||
grunt.registerTask('clear', ['clean:app']);
|
||||
|
||||
// Load content of `vendor.yml` to src.jsVendor, src.cssVendor and src.angularVendor
|
||||
grunt.registerTask('vendor', 'vendor:<minified|regular>', function(min) {
|
||||
// Argument `min` defaults to 'minified'
|
||||
var minification = (min === '') ? 'minified' : min;
|
||||
var vendorFile = grunt.file.readYAML('vendor.yml');
|
||||
for (var filelist in vendorFile) {
|
||||
if (vendorFile.hasOwnProperty(filelist)) {
|
||||
var list = vendorFile[filelist][minification];
|
||||
// Check if any of the files is missing
|
||||
for (var itemIndex in list) {
|
||||
if (list.hasOwnProperty(itemIndex)) {
|
||||
var item = list[itemIndex];
|
||||
if (!grunt.file.exists(item)) {
|
||||
grunt.fail.warn('Dependency file ' + item + ' not found.');
|
||||
}
|
||||
}
|
||||
}
|
||||
// If none is missing, save the list
|
||||
grunt.config('src.' + filelist + 'Vendor', list);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
distdir: 'dist/public',
|
||||
|
@ -232,13 +255,4 @@ module.exports = function (grunt) {
|
|||
}
|
||||
});
|
||||
|
||||
grunt.registerTask('vendor', 'vendor:<min|reg>', function(min) {
|
||||
// The content of `vendor.yml` is loaded to src.jsVendor, src.cssVendor and src.angularVendor
|
||||
// Argument `min` selects between the 'regular' or 'minified' sets
|
||||
var m = ( min === '' ) ? 'minified' : min;
|
||||
var v = grunt.file.readYAML('vendor.yml');
|
||||
for (type in v) { if (v.hasOwnProperty(type)) {
|
||||
grunt.config('src.'+type+'Vendor',v[type][m]);
|
||||
}}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue