diff options
author | Teemu Pöntelin <teemu@vaadin.com> | 2016-08-29 14:37:00 +0300 |
---|---|---|
committer | Teemu Pöntelin <teemu@vaadin.com> | 2016-08-29 16:34:21 +0300 |
commit | 9e55d6c52d8faa82338b6eae613cd95d112d0e2f (patch) | |
tree | 1b466d7df0b1b5a13d9ece2b7c35c5b65302ffb0 | |
parent | 5d34d324759f329ad713139f09afac0b5320bd01 (diff) | |
download | vaadin-core-9e55d6c52d8faa82338b6eae613cd95d112d0e2f.tar.gz vaadin-core-9e55d6c52d8faa82338b6eae613cd95d112d0e2f.zip |
Generate a separate bower.json with overrides for master
-rw-r--r-- | bower.json | 11 | ||||
-rw-r--r-- | gulpfile.js | 2 | ||||
-rw-r--r-- | tasks/cdn.js | 28 | ||||
-rw-r--r-- | tasks/config.js | 1 | ||||
-rw-r--r-- | tasks/docsite.js | 7 |
5 files changed, 39 insertions, 10 deletions
@@ -41,5 +41,16 @@ }, "resolutions": { "polymer": "v1.1.1" + }, + "masterOverrides": { + "version": "master", + "dependencies": { + "vaadin-grid": "vaadin/vaadin-grid#master", + "vaadin-combo-box": "vaadin/vaadin-combo-box#master", + "vaadin-icons": "vaadin/vaadin-icons#master", + "vaadin-date-picker": "vaadin/vaadin-date-picker#master", + "vaadin-upload": "vaadin/vaadin-upload#master", + "vaadin-split-layout": "vaadin/vaadin-split-layout#master" + } } } diff --git a/gulpfile.js b/gulpfile.js index 312593b..f31904f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,6 +8,6 @@ gulp.task('default', function() { console.log('\n Use:\n gulp <stage|deploy[:cdn]>|<zip>\n'); }); -gulp.task('clean', ['clean:cdn', 'clean:zip']); +gulp.task('clean', ['clean:cdn', 'clean:bower', 'clean:zip']); gulp.task('deploy', ['deploy:cdn']); diff --git a/tasks/cdn.js b/tasks/cdn.js index 816f852..05a8bbd 100644 --- a/tasks/cdn.js +++ b/tasks/cdn.js @@ -3,6 +3,7 @@ var config = require('./config'); var common = require('./common'); var gulp = require('gulp'); var fs = require('fs-extra'); +var path = require('path'); var modify = require('gulp-modify'); var rsync = require('gulp-rsync'); var gutil = require('gulp-util'); @@ -12,16 +13,33 @@ var stagingBasePath = config.paths.staging.cdn; var version = config.version; var host = config.toolsHost; var permalink = config.permalink; -var stagingPath = stagingBasePath + '/' + version; -var testPath = process.cwd() + '/' + stagingPath + '/test'; +var stagingPath = path.join(process.cwd(), stagingBasePath, version); +var masterBowerPath = config.paths.staging.bower; gulp.task('clean:cdn', function() { fs.removeSync(stagingBasePath); }); -gulp.task('cdn:stage-bower_components', function() { +gulp.task('clean:bower', function() { + fs.removeSync(masterBowerPath); +}); + +gulp.task('cdn:stage-bower.json', function() { + // Load the bower.json, assign overrides and write back to disk. + let bowerJson = JSON.parse(fs.readFileSync('./bower.json', 'utf-8')); + bowerJson = Object.assign(bowerJson, bowerJson.masterOverrides); + delete bowerJson.masterOverrides; + + fs.mkdirSync(masterBowerPath); + fs.writeFileSync(masterBowerPath + '/bower.json', JSON.stringify(bowerJson, null, ' ')); + gutil.log('Created ' + masterBowerPath + '/bower.json with overrides applied.'); +}); + +gulp.task('cdn:stage-bower_components', ['cdn:stage-bower.json'], function() { + const bowerJsonPath = path.join(process.cwd(), (version === 'master' ? masterBowerPath : '')); return bower({ directory: stagingPath, + cwd: bowerJsonPath, forceLatest: true, cmd: 'install' }); @@ -41,10 +59,10 @@ gulp.task('cdn:stage-vaadin-core-elements', function() { return contents; } })) - .pipe(gulp.dest(stagingPath + "/vaadin-core-elements")); + .pipe(gulp.dest(stagingPath + '/vaadin-core-elements')); }); -gulp.task('stage:cdn', ['clean:cdn', 'cdn:stage-bower_components', 'cdn:stage-vaadin-core-elements']); +gulp.task('stage:cdn', ['clean:cdn', 'clean:bower', 'cdn:stage-bower_components', 'cdn:stage-vaadin-core-elements']); gulp.task('upload:cdn', ['stage:cdn'], function() { common.checkArguments(['cdnUsername', 'cdnDestination']); diff --git a/tasks/config.js b/tasks/config.js index 61d550f..521a8ce 100644 --- a/tasks/config.js +++ b/tasks/config.js @@ -4,7 +4,6 @@ var fs = require('fs'); var userhome = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE; module.exports = { - coreElements: ['vaadin-grid', 'vaadin-combo-box', 'vaadin-date-picker', 'vaadin-upload', 'vaadin-icons'], version: args.version || 'master', permalink: args.version ? 'latest' : '', toolsHost: args.toolsHostname || 'tools.vaadin.com', diff --git a/tasks/docsite.js b/tasks/docsite.js index 50fb02e..2543662 100644 --- a/tasks/docsite.js +++ b/tasks/docsite.js @@ -19,6 +19,7 @@ var stagingPath = stagingBasePath + '/' + version; var modify = require('gulp-modify'); var rootZip = 'target/'; var fileZip = 'docsite.zip'; +var bowerJson = require('../bower.json'); gulp.task('cdn:docsite:clean', function() { fs.removeSync(docPath); @@ -56,9 +57,9 @@ gulp.task('cdn:docsite:core-elements-integrations', function() { }); gulp.task('cdn:docsite:core-elements-elements', ['cdn:docsite:bower_components'], function() { - var docsPaths = config.coreElements.map(function(c) { - return stagingPath + '/' + c + '/docs/**'; - }); + var docsPaths = Object.keys(bowerJson.dependencies).map(function(c) { + return stagingPath + '/' + c + '/docs/**'; + }); return gulp.src(docsPaths, {base: stagingPath}) .pipe(rename(function (path) { |