Skip to content

Loading…

Add dependencies.json and dependency checking for grunt build #391

Closed
wants to merge 4 commits into from

3 participants

@ajoslin

No description provided.

@ajoslin

If this looks good, I'll rebase and merge it so the commit log is pretty.

@ajoslin

Added ui-map dependency for #390

@ProLoser
AngularUI member

Some of the dependencies appear to be wrong. Inflector depends on select2? And a lot of the URLs were removed?

@ajoslin

Oh, lol. That was a test. What URLs were removed? I didn't implement the core dependencies (jquery-ui, jquery, bootstrap)

@ProLoser
AngularUI member
@ajoslin

OK. I'll review and put them back.

@joshkurz
AngularUI member

Is this relevant anymore now that we are relocating everything?

@ProLoser
AngularUI member

Closing this since it's barely relevant anymore

@ProLoser ProLoser closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
62 grunt.js
@@ -5,6 +5,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-coffee');
+ grunt.loadNpmTasks('grunt-curl');
// Project configuration.
grunt.initConfig({
@@ -12,8 +13,7 @@ module.exports = function (grunt) {
pkg: '<json:package.json>',
meta: {
banner: '/**\n' + ' * <%= pkg.description %>\n' +
- ' * @version v<%= pkg.version %> - ' +
- '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ ' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @license MIT License, http://www.opensource.org/licenses/MIT\n' + ' */'
},
@@ -33,6 +33,8 @@ module.exports = function (grunt) {
dest: '<%= builddir %>/<%= pkg.name %>-ieshiv.js'
}
},
+ curl: { //grunt-curl external dependencies
+ },
min: {
build: {
src: ['<banner:meta.banner>', '<config:concat.build.dest>'],
@@ -45,7 +47,7 @@ module.exports = function (grunt) {
},
recess: {
build: {
- src: ['common/**/*.less'],
+ src: [],
dest: '<%= builddir %>/<%= pkg.name %>.css',
options: {
compile: true
@@ -60,12 +62,13 @@ module.exports = function (grunt) {
}
},
lint: {
- files: ['grunt.js', 'common/**/*.js', 'modules/**/*.js']
+ files: ['grunt.js', 'common/**/*.js', 'modules/**/*.js', 'modules/**/*.json']
},
watch: {
files: ['modules/**/*.coffee', 'modules/**/*.js', 'common/**/*.js', 'templates/**/*.js'],
tasks: 'coffee build test'
}
+
});
// Default task.
@@ -73,28 +76,45 @@ module.exports = function (grunt) {
grunt.registerTask('build', 'build all or some of the angular-ui modules', function () {
- var jsBuildFiles = grunt.config('concat.build.src');
- var lessBuildFiles = [];
-
- if (this.args.length > 0) {
-
- this.args.forEach(function(moduleName) {
- var modulejs = grunt.file.expandFiles('modules/*/' + moduleName + '/*.js');
- var moduleless = grunt.file.expandFiles('modules/*/' + moduleName + '/stylesheets/*.less', 'modules/*/' + moduleName + '/*.less');
+ var jsFiles = grunt.config('concat.build.src');
+ var lessFiles = grunt.config('recess.build.src');
+ var curlFiles = grunt.config('curl');
- jsBuildFiles = jsBuildFiles.concat(modulejs);
- lessBuildFiles = lessBuildFiles.concat(moduleless);
+ function findModuleFiles(moduleName, getExternalFiles) {
+ jsFiles = jsFiles.concat(grunt.file.expand('modules/*/' + moduleName + '/*.js'));
+ lessFiles = lessFiles.concat(grunt.file.expand('modules/*/' + moduleName + '/**/*.less'));
+
+ grunt.file.expand('modules/*/' + moduleName + '/dependencies.json')
+ .map(grunt.file.read).forEach(function(content) {
+ var json = JSON.parse(content);
+ if (getExternalFiles) {
+ //Add external deps to curl list
+ json.external.forEach(function(url) {
+ var fileName = url.substr(url.lastIndexOf('/') + 1);
+ curlFiles[grunt.config('builddir') + '/lib/' + fileName] = url;
+ });
+ }
+ json.internal.forEach(findModuleFiles);
});
+ }
- grunt.config('concat.build.src', jsBuildFiles);
- grunt.config('recess.build.src', lessBuildFiles);
-
+ if (this.args.length > 0) {
+ this.args.forEach(function(module) { findModuleFiles(module, true); });
} else {
- grunt.config('concat.build.src', jsBuildFiles.concat(['modules/*/*/*.js']));
- grunt.config('recess.build.src', lessBuildFiles.concat(grunt.config('recess.build.src')));
+ //Find modules for every directory
+ grunt.file.expand('modules/*/*').forEach(function(path) {
+ findModuleFiles(path.split('/')[2]);
+ });
}
-
- grunt.task.run('concat min recess:build recess:min');
+ grunt.config('concat.build.src', jsFiles);
+ grunt.config('recess.build.src', lessFiles);
+ grunt.config('curl', curlFiles);
+
+ //Only run curl task if length of curlFiles > 0
+ if (Object.keys(grunt.config('curl')).length > 0) {
+ grunt.task.run('curl');
+ }
+ grunt.task.run('concat min recess');
});
grunt.registerTask('dist', 'change dist location', function() {
View
5 modules/directives/animate/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
11 modules/directives/calendar/dependencies.json
@@ -1,8 +1,5 @@
{
- "core": [ "jquery" ],
- "internal": [],
- "external": [
- "http://arshaw.com/js/fullcalendar-1.5.4/fullcalendar/fullcalendar.css",
- "http://arshaw.com/js/fullcalendar-1.5.4/fullcalendar/fullcalendar.js"
- ]
-}
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
11 modules/directives/codemirror/dependencies.json
@@ -1,8 +1,5 @@
{
- "core": [ "jquery" ],
- "internal": [],
- "external": [
- "http://codemirror.net/lib/codemirror.js",
- "http://codemirror.net/lib/codemirror.css",
- ]
-}
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/currency/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
8 modules/directives/date/dependencies.json
@@ -1,5 +1,5 @@
{
- "core": [ "jquery", "jquery-ui" ],
- "internal": [],
- "external": []
-}
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/event/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/if/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/jq/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/keypress/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/map/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": ["event"],
+ "external": []
+}
View
8 modules/directives/mask/dependencies.json
@@ -1,5 +1,5 @@
{
- "core": [ "jquery" ],
- "internal": [],
- "external": []
-}
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/modal/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/reset/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/scrollfix/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
4 modules/directives/select2/dependencies.json
@@ -3,6 +3,6 @@
"internal": [],
"external": [
"http://ivaynberg.github.com/select2/select2-3.2/select2.js",
- "http://ivaynberg.github.com/select2/select2-3.2/select2.css",
+ "http://ivaynberg.github.com/select2/select2-3.2/select2.css"
]
-}
+}
View
5 modules/directives/showhide/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/sortable/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
11 modules/directives/tinymce/dependencies.json
@@ -1,8 +1,5 @@
{
- "core": [ "jquery" ],
- "internal": [],
- "external": [
- "http://fiddle.tinymce.com/tinymce/3.5.8/tiny_mce_jquery_src.js",
- "http://fiddle.tinymce.com/tinymce/3.5.8/jquery.tinymce.js",
- ]
-}
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/directives/validate/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/filters/format/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/filters/highlight/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
5 modules/filters/inflector/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": ["select2"],
+ "external": []
+}
View
5 modules/filters/unique/dependencies.json
@@ -0,0 +1,5 @@
+{
+ "core": [],
+ "internal": [],
+ "external": []
+}
View
3 package.json
@@ -16,6 +16,7 @@
"grunt-recess": "~0.1.3",
"grunt-coffee": "~0.0.3",
"async": "0.1.x",
- "testacular": "~0.4.0"
+ "testacular": "~0.4.0",
+ "grunt-curl": "~0.2.0"
}
}
View
5 templates/dependencies.json
@@ -1,8 +1,7 @@
{
- "core": [ "jquery", "jquery-ui", "bootstrap" ],
- "internal": [ "directives/showHide", "filters/highlight" ],
+ "internal": [ "showHide", "highlight" ],
"external": [
"http://ivaynberg.github.com/select2/select2-3.2/select2.js",
"http://ivaynberg.github.com/select2/select2-3.2/select2.css",
]
-}
+}
Something went wrong with that request. Please try again.