From c63e2faac7ec6bf387bf8df3b9ceb2578cecf1c9 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Mon, 7 May 2018 13:34:01 -0700 Subject: [PATCH 1/4] Add publish-demos script --- scripts/publish-demos.sh | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 scripts/publish-demos.sh diff --git a/scripts/publish-demos.sh b/scripts/publish-demos.sh new file mode 100755 index 000000000..1745746d6 --- /dev/null +++ b/scripts/publish-demos.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +## +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +# Remove previous build +rm -rf build +# Get list of demos +demos=`ls demos/*.html` +# Transform demo list into list of --fragment flags +fragments=`echo $demos | sed -E 's/([^ ]*)/--fragment \1/g'` +# Run polymer build to do node module resolution on the demos, output to build/default +polymer build --module-resolution=node $fragments +# Clone gh-pages branch +git clone git@github.com:material-components/material-components-web-components.git -b gh-pages build/gh-pages +# Copy built source to gh-pages +cp -rf build/default/* build/gh-pages + +# Push to gh-pages +read -p "Test build/gh-pages/demos/index.html, then press 'y' to publish to gh-pages: " -n 1 -r +echo # (optional) move to a new line +if [[ $REPLY =~ ^[Yy]$ ]] +then + (cd build/gh-pages && git add -A && git commit -m 'Update gh-pages' && git push origin gh-pages) +fi + +# Bundled/compiled build currently not working well.... + +# # Run polymer build to do node module resolution on the demos, output to build/default +# polymer build --js-compile --module-resolution=node $fragments +# # Make a build/interim copy of build/default +# cp -rf build/default build/interim +# # Add babel-polyfill to the babel helpers injected build-entrypoint +# echo '' >> build/default/build-entrypoint.html +# # Inject the babel helpers from the original entrypoint into each demo in interim +# for f in $demos; do sed '// r build/default/build-entrypoint.html' build/default/$f > build/interim/$f; done; +# # Install babel-polyfill +# (cd build/interim && npm install babel-polyfill) +# # Move webcomponents into the interim copy (for some reason --extra-dependencies on polymer build above was failing) +# cp -rf node_modules/@webcomponents/webcomponentsjs build/interim/node_modules/@webcomponents +# # Clear the build entrypoint file in the interim copy +# echo '' > build/interim/build-entrypoint.html +# # Bundle the interim demos +# (cd build/interim && polymer build --module-resolution=node --bundle $fragments --entrypoint build-entrypoint.html) +# # Blow away interim +# # rm -rf build/default +# # mv build/interim/build/default build/default +# # rm -rf build/interim \ No newline at end of file From 2182d6478ace264c5fd36b92668575d70c6166dd Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 8 May 2018 11:23:01 -0700 Subject: [PATCH 2/4] Make demos easy to publish - Minor changes to demo pages for rollup compat --- .gitignore | 3 +- demos/card.html | 2 +- demos/checkbox.html | 2 +- demos/chips.html | 2 +- demos/fab.html | 4 +- demos/formfield.html | 2 +- demos/index.html | 4 +- demos/linear-progress.html | 2 +- demos/menu.html | 2 +- package-lock.json | 601 +++++++++++++++++++--------------- package.json | 12 +- scripts/build/rollup-demos.js | 125 +++++++ scripts/publish-demos.sh | 22 +- 13 files changed, 504 insertions(+), 279 deletions(-) create mode 100755 scripts/build/rollup-demos.js diff --git a/.gitignore b/.gitignore index 3d9bed870..9fc8605eb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules /build /coverage .DS_Store -/lerna-debug.log \ No newline at end of file +/lerna-debug.log +/gh-pages \ No newline at end of file diff --git a/demos/card.html b/demos/card.html index 90af1d815..4b90ddcf7 100644 --- a/demos/card.html +++ b/demos/card.html @@ -110,7 +110,7 @@ limitations under the License.
- diff --git a/demos/checkbox.html b/demos/checkbox.html index 54dc33d01..2378bcd66 100644 --- a/demos/checkbox.html +++ b/demos/checkbox.html @@ -42,7 +42,7 @@ limitations under the License. - diff --git a/demos/chips.html b/demos/chips.html index 85378485b..5adb7eb24 100644 --- a/demos/chips.html +++ b/demos/chips.html @@ -63,7 +63,7 @@ limitations under the License. - diff --git a/demos/fab.html b/demos/fab.html index 3127707b1..1cbd80ba5 100644 --- a/demos/fab.html +++ b/demos/fab.html @@ -20,8 +20,8 @@ limitations under the License. fab demo - +