diff options
author | Sauli Tähkäpää <sauli.tahkapaa@outlook.com> | 2016-08-30 14:04:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-30 14:04:12 +0300 |
commit | 199891513f89d5ef1ef7c526f876a4a9de166a0a (patch) | |
tree | a51f7d14f0dd94c9b933446df53f28425e6cd99b | |
parent | cb94ce56f1c9a95e6a77be1961bba5158837302c (diff) | |
parent | ac016539b77e41337c2751843b35c0a481a6390c (diff) | |
download | vaadin-core-199891513f89d5ef1ef7c526f876a4a9de166a0a.tar.gz vaadin-core-199891513f89d5ef1ef7c526f876a4a9de166a0a.zip |
Merge pull request #67 from vaadin/fix/cdn-master
Improve cdn deployment of master versions
-rw-r--r-- | .jshintrc | 4 | ||||
-rw-r--r-- | bower.json | 23 | ||||
-rw-r--r-- | gulpfile.js | 2 | ||||
-rw-r--r-- | tasks/cdn.js | 26 | ||||
-rw-r--r-- | tasks/config.js | 1 | ||||
-rw-r--r-- | tasks/docsite.js | 7 |
6 files changed, 46 insertions, 17 deletions
diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..59f01b9 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,4 @@ +{ + "node": true, + "esnext": true +} @@ -4,7 +4,7 @@ "authors": [ "Vaadin Ltd" ], - "description": "Vaadin Core Elements is an evolving set of free, open sourced custom HTML elements, built using Polymer, for building mobile and desktop web applications in modern browsers.", + "description": "Vaadin Core Elements is an evolving set of free, open sourced custom HTML elements, built using Polymer.", "license": "Apache-2.0", "keywords": [ "vaadin", @@ -24,11 +24,11 @@ "**/tests" ], "dependencies": { - "vaadin-grid": "vaadin/vaadin-grid#~1.1.0", - "vaadin-combo-box": "vaadin/vaadin-combo-box#~1.1.0", - "vaadin-icons": "vaadin/vaadin-icons#~1.0.0", - "vaadin-date-picker": "vaadin/vaadin-date-picker#~1.1.0", - "vaadin-upload": "vaadin/vaadin-upload#~1.0.0" + "vaadin-grid": "vaadin/vaadin-grid#1.1.x", + "vaadin-combo-box": "vaadin/vaadin-combo-box#1.1.x", + "vaadin-icons": "vaadin/vaadin-icons#1.0.x", + "vaadin-date-picker": "vaadin/vaadin-date-picker#1.1.x", + "vaadin-upload": "vaadin/vaadin-upload#1.0.x" }, "devDependencies": { "web-component-tester": "^4.0.3", @@ -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 9f60d08..312593b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,8 +4,6 @@ require('require-dir')('./tasks'); var args = require('yargs').argv; var git = require('gulp-git'); -var version = '0.3.0'; - gulp.task('default', function() { console.log('\n Use:\n gulp <stage|deploy[:cdn]>|<zip>\n'); }); 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) { |