]> source.dussan.org Git - vaadin-core.git/commitdiff
Generate a separate bower.json with overrides for master pr67/r3
authorTeemu Pöntelin <teemu@vaadin.com>
Mon, 29 Aug 2016 11:37:00 +0000 (14:37 +0300)
committerTeemu Pöntelin <teemu@vaadin.com>
Mon, 29 Aug 2016 13:34:21 +0000 (16:34 +0300)
bower.json
gulpfile.js
tasks/cdn.js
tasks/config.js
tasks/docsite.js

index faa6636110643d16a3e1a55515d420ec4c4debbb..1b852bb7f5ac313bf157216f943faf410c5f34b0 100644 (file)
   },
   "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"
+    }
   }
 }
index 312593be36c4ca6af89b2b4981f9cfcd85e4bdee..f31904febf6c0d45e5da4f8db70a4ab400f236e3 100644 (file)
@@ -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']);
index 816f8521f89a8bcf6e948c88005de7efa211c7c2..05a8bbd6ef7aed0da1c970bf40328c9d91ae0ddc 100644 (file)
@@ -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']);
index 61d550f9e0d02f073768c8551226e6a4d091cc8b..521a8ce4e500ca5562aed083a1c39f7b567ad684 100644 (file)
@@ -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',
index 50fb02e113aa95814c07d7b56cbb8c198ead1697..2543662c37ae40a2334bbcb8db4ed8f8fde0420b 100644 (file)
@@ -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) {