summaryrefslogtreecommitdiffstats
path: root/tasks
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli.tahkapaa@outlook.com>2016-08-30 14:04:12 +0300
committerGitHub <noreply@github.com>2016-08-30 14:04:12 +0300
commit199891513f89d5ef1ef7c526f876a4a9de166a0a (patch)
treea51f7d14f0dd94c9b933446df53f28425e6cd99b /tasks
parentcb94ce56f1c9a95e6a77be1961bba5158837302c (diff)
parentac016539b77e41337c2751843b35c0a481a6390c (diff)
downloadvaadin-core-199891513f89d5ef1ef7c526f876a4a9de166a0a.tar.gz
vaadin-core-199891513f89d5ef1ef7c526f876a4a9de166a0a.zip
Merge pull request #67 from vaadin/fix/cdn-master
Improve cdn deployment of master versions
Diffstat (limited to 'tasks')
-rw-r--r--tasks/cdn.js26
-rw-r--r--tasks/config.js1
-rw-r--r--tasks/docsite.js7
3 files changed, 25 insertions, 9 deletions
diff --git a/tasks/cdn.js b/tasks/cdn.js
index 816f852..0db7bb9 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,31 @@ 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);
gulp.task('clean:cdn', function() {
fs.removeSync(stagingBasePath);
});
-gulp.task('cdn:stage-bower_components', function() {
+gulp.task('cdn:stage-bower.json', ['clean:cdn'], function() {
+ // Load the bower.json, assign overrides and write back to disk.
+ let bowerJson = JSON.parse(fs.readFileSync('./bower.json', 'utf-8'));
+
+ if (version === 'master') {
+ gutil.log('Applying overrides to ' + stagingPath + '/bower.json');
+ bowerJson = Object.assign(bowerJson, bowerJson.masterOverrides);
+ delete bowerJson.masterOverrides;
+ }
+
+ fs.mkdirSync(stagingBasePath);
+ fs.mkdirSync(stagingPath);
+ fs.writeFileSync(stagingPath + '/bower.json', JSON.stringify(bowerJson, null, ' '));
+});
+
+gulp.task('cdn:stage-bower_components', ['cdn:stage-bower.json'], function() {
return bower({
- directory: stagingPath,
+ directory: '.',
+ cwd: stagingPath,
forceLatest: true,
cmd: 'install'
});
@@ -41,7 +57,7 @@ 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']);
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..4c18233 100644
--- a/tasks/docsite.js
+++ b/tasks/docsite.js
@@ -56,9 +56,10 @@ 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/**';
- });
+ const bowerJson = require('../' + stagingPath + '/bower.json');
+ var docsPaths = Object.keys(bowerJson.dependencies).map(function(c) {
+ return stagingPath + '/' + c + '/docs/**';
+ });
return gulp.src(docsPaths, {base: stagingPath})
.pipe(rename(function (path) {