-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(uglify/concat): Update UI-Grid build system to publish multiple …
…files separated by features. UI-Grid will now publish a base file with just the basic grid and multiple files for each individual feature. fix #5802
- Loading branch information
Showing
5 changed files
with
43 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,28 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const getDirectories = p => fs.readdirSync(p).filter(f => fs.statSync(path.join(p, f)).isDirectory()); | ||
|
||
function getFiles() { | ||
const files = { | ||
'<%= dist %>/release/<%= pkg.name %>.js': ['src/js/core/bootstrap.js', 'src/js/**/*.js', 'src/features/*/js/**/*.js', '.tmp/template.js'], | ||
'<%= dist %>/release/<%= pkg.name %>.base.js': ['src/js/core/bootstrap.js', 'src/js/**/*.js', '.tmp/template.js'] | ||
}; | ||
const features = getDirectories('src/features/'); | ||
|
||
features.forEach((feat) => { | ||
files[`<%= dist %>/release/<%= pkg.name %>.${feat}.js`] = [`src/features/${feat}/js/**/*.js`] | ||
}); | ||
|
||
return files; | ||
} | ||
|
||
module.exports = { | ||
options: { | ||
banner: '<%= banner %>', | ||
stripBanners: true | ||
}, | ||
dist: { | ||
src: ['src/js/core/bootstrap.js', 'src/js/**/*.js', 'src/features/*/js/**/*.js', '.tmp/template.js'], | ||
dest: '<%= dist %>/release/<%= pkg.name %>.js' | ||
}, | ||
options: { | ||
banner: '<%= banner %>', | ||
stripBanners: true | ||
}, | ||
dist: { | ||
files: getFiles() | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
const concat = require('./concat'); | ||
|
||
function getFiles() { | ||
const files = {}; | ||
const sources = Object.keys(concat.dist.files); | ||
|
||
sources.forEach((srcFile) => { | ||
files[srcFile.replace('.js', '.min.js')] = srcFile; | ||
}); | ||
|
||
return files; | ||
} | ||
|
||
module.exports = { | ||
options: { | ||
banner: '<%= banner %>' | ||
}, | ||
concat: { | ||
src: '<%= concat.dist.dest %>', | ||
dest: '<%= dist %>/release/<%= pkg.name %>.min.js' | ||
files: getFiles() | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.