From 27e6b8c80c31b01571c72757fb4191e23fa8d384 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 5 May 2014 15:55:48 +1000 Subject: [PATCH] Adds bower to node dependencies, uses bower to get the typeahead dependency, gets bower dependencies on npm install --- .gitignore | 3 ++- build/BuildBelle.bat | 3 ++- src/Umbraco.Web.UI.Client/bower.json | 21 ++++++++++++++++ src/Umbraco.Web.UI.Client/gruntFile.js | 35 ++++++++++++++++++++++++-- src/Umbraco.Web.UI.Client/package.json | 7 +++--- 5 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/bower.json diff --git a/.gitignore b/.gitignore index fd94476152..77c1f5d11b 100644 --- a/.gitignore +++ b/.gitignore @@ -108,4 +108,5 @@ src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config src/Umbraco.Web.UI/umbraco/plugins/* src/Umbraco.Web.UI/umbraco/js/init.js build/ApiDocs/* -build/ApiDocs/Output/* \ No newline at end of file +build/ApiDocs/Output/* +src/Umbraco.Web.UI.Client/bower_components/* diff --git a/build/BuildBelle.bat b/build/BuildBelle.bat index 6ff22f1096..e7673f054e 100644 --- a/build/BuildBelle.bat +++ b/build/BuildBelle.bat @@ -23,7 +23,8 @@ CD %CD%\..\src\Umbraco.Web.UI.Client\ ECHO Do npm install and the grunt build of Belle call npm install call npm install -g grunt-cli -call grunt build --buildversion=8.1.1 +call npm install -g bower +call grunt build --buildversion=7.1.2 ECHO Reset path to what it was before path=%oldPath% diff --git a/src/Umbraco.Web.UI.Client/bower.json b/src/Umbraco.Web.UI.Client/bower.json new file mode 100644 index 0000000000..92b0cf2fc0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/bower.json @@ -0,0 +1,21 @@ +{ + "name": "Umbraco", + "version": "7", + "homepage": "https://github.com/umbraco/Umbraco-CMS", + "authors": [ + "Shannon " + ], + "description": "Umbraco CMS", + "license": "MIT", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "typeahead.js": "~0.10.2" + } +} diff --git a/src/Umbraco.Web.UI.Client/gruntFile.js b/src/Umbraco.Web.UI.Client/gruntFile.js index 23fc14bb9b..cb7850c274 100644 --- a/src/Umbraco.Web.UI.Client/gruntFile.js +++ b/src/Umbraco.Web.UI.Client/gruntFile.js @@ -14,7 +14,7 @@ module.exports = function (grunt) { grunt.registerTask('watch-test', ['jshint:dev', 'karma:unit']); //triggered from grunt dev or grunt - grunt.registerTask('build', ['clean','concat','recess:min','recess:installer','copy']); + grunt.registerTask('build', ['clean','concat','recess:min','recess:installer','bower','copy']); //utillity tasks grunt.registerTask('docs', ['ngdocs']); @@ -26,6 +26,28 @@ module.exports = function (grunt) { grunt.log.subhead(Date()); }); + // Custom task to run the bower dependency installer + // tried, a few other things but this seems to work the best. + // https://coderwall.com/p/xnkdqw + grunt.registerTask('bower', 'Get js packages listed in bower.json', + function () { + var bower = require('bower'); + var done = this.async(); + + bower.commands.install(undefined, { offline: true }, { interactive: false, offline: true }) + .on('log', function (data) { + grunt.log.write(data.message + "\n"); + }) + .on('error', function (data) { + grunt.log.write(data.message + "\n"); + done(false); + }) + .on('end', function (data) { + done(); + }); + } + ); + // Project configuration. grunt.initConfig({ @@ -58,7 +80,8 @@ module.exports = function (grunt) { }, distdir: 'build/belle', - vsdir: '../Umbraco.Web.Ui/umbraco', + bowerfiles: 'bower_components', + vsdir: '../Umbraco.Web.UI/umbraco', pkg: grunt.file.readJSON('package.json'), banner: '/*! <%= pkg.title || pkg.name %> - v<%= buildVersion %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' + @@ -86,6 +109,14 @@ module.exports = function (grunt) { clean: ['<%= distdir %>/*'], copy: { + + // Copies over the files downloaded by bower + bower: { + files: [ + { dest: '<%= distdir %>/lib/typeahead/typeahead.bundle.min.js', src: '<%= bowerfiles %>/typeahead.js/dist/typeahead.bundle.min.js' } + ] + }, + assets: { files: [{ dest: '<%= distdir %>/assets', src : '**', expand: true, cwd: 'src/assets/' }] }, diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index 16d00e35e2..b9fa69ccb4 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -2,7 +2,7 @@ "author": "Umbraco HQ", "name": "umbraco", "homepage": "https://github.com/umbraco/umbraco-cms/", - "version": "7.1.1", + "version": "7.1.2", "repository": { "type": "git", "url": "git@github.com:umbraco/umbraco-cms.git" @@ -42,6 +42,7 @@ "karma-coffee-preprocessor": "0.0.1", "karma": "~0.9", "karma-phantomjs-launcher": "0.0.2", - "grunt-ngdocs": "~0.1.2" - } + "grunt-ngdocs": "~0.1.2", + "bower": "~1.3.3" + } }