å æ¥ã® Google I/O 2015 ã«ããã㦠Polymer 1.0 ããªãªã¼ã¹ããã¾ããããã§ãããããã§è¡¨é¡ã®ããã«ãèªå㧠Polymer ã¨ã¬ã¡ã³ãï¼ã³ã³ãã¼ãã³ãï¼ãä½ãã¨ãã®æ§æã®è©±ã
å§ããã«ããã£ã¦ã¯ PolymerLabs/seed-element ããã¼ã¹ã«ããã¨ä¾¿å©ã§ããã®ä¸ã«ã¯ä»¥ä¸ã®ãããªæ¨æºçãªæ§æã示ããã¦ãã¾ãã
- bower ã«ããä¾åã®è§£æ±º
- web-component-tester ã使ã£ãã¯ãã¹ãã©ã¦ã¶ã®ãã¹ã
- iron-component-page ã使ã£ã API ããã¥ã¡ã³ãã¨ãã¢
web-component-tester
web-component-tester 㯠Polymer ã¨ã¬ã¡ã³ãããã¹ãããããã®ãã¼ã«ã§ããã¹ããå®è¡ããã ããããªã Mocha ã Async.js ãªã©ä¾¿å©ãªã©ã¤ãã©ãªããã¹ãããå©ç¨ã§ããããã«ãã¦ããã¾ããPolymer ãæä¾ããã³ã³ãã¼ãã³ãã®ãã¹ãã¯ããã«ä¾åãã¦ãããããå®è³ªçãªæ¨æºãã¼ã«ã¨è¨ã£ã¦ããã§ãããã
wct
ã³ãã³ãã§èµ·åããã¨ãã¼ã«ã«ã§ã ChromeãFirefox ãªã©ãèµ·åãã¦ãtest 以ä¸ã®ãã¹ããããããã®ãã©ã¦ã¶ã§å®è¡ã§ãã¾ãã
iron-component-page
iron-component-page 㯠Polymer ã¨ã¬ã¡ã³ãã®ããã¥ã¡ã³ããæä¾ããããã®ã³ã³ãã¼ãã³ãã§ãbody ä¸ã«ä»¥ä¸ã®ããã«è¦ç´ ãé ç½®ããã ãã§ãã¼ã¸ã® URL ãã対象ã®ã³ã³ãã¼ãã³ããæ¤åºãã¦ãããããã¼ãããAPI ã®è©³ç´°ã¨ãdemo ãã£ã¬ã¯ããªãããã°ãã¢ã¸ã®ãªã³ã¯ã表示ãã¾ããPolymer Catalog ã®ãããªãã¼ã¸ãããã ãã§ä½ãã¦ãä¸æ°ã«ããã£ã½ããå¢ãã¾ããã
<iron-component-page></iron-component-page>
ãã® HTML ãã¡ã¤ã«ã¯åºæ¬çã«ã³ã³ãã¼ãã³ãã® .html ã®é£ã« index.html ã¨ãã¦ç½®ãããã§ããseed-element ããã¼ã¹ã«ããå ´åã¯å ãããã£ã¦ãç·¨éããå¿ è¦ããªãã
polyserve
ä¸è¨ã®ããã¥ã¡ã³ãã«é¢ãã¦ãbower ã§å
¥æããã³ã³ãã¼ãã³ããéçºä¸ã®ãã®ããã¼ã«ã«ç°å¢ã§åç
§ããã«ä¾¿å©ãªã®ã polyserve ã§ããPolymer ããã¸ã§ã¯ãã®ã«ã¼ãã§ä»¥ä¸ã®ããã«ãã¦èµ·åããã°ãbower ã§ã¤ã³ã¹ãã¼ã«ããã³ã³ãã¼ãã³ãã http://localhost:8080/components/{element-name}
ï¼ãã¢ãªãããã«ãã®ä¸ã® /demo/ ï¼ã§åç
§ã§ãã¾ãã
polyserve [-p 8080]
seed-element ã®æ§æã«å¾ãã¨ãããã¸ã§ã¯ãã«ã¼ãã«ç½®ãã¦ããã³ã³ãã¼ãã³ãã® HTML {my-element}.html ãã以ä¸ã®ãã㪠bower ã§ã¤ã³ã¹ãã¼ã«ãããåæã®ç¸å¯¾ URL æå®ã§ä»ã®ã©ã¤ãã©ãªãèªã¿ãããã¨ã«ãªãã¾ãã
<link rel="import" href="../polymer/polymer.html">
ãã®ããæ®éã®ãã¼ã«ã«ãµã¼ãã ã¨åç §å ããªãã¦æåã®ç¢ºèªããããªããªãã®ã§ãããpolyserve ã¯ãã®è¦ç´ ã /components/{my-element} 以ä¸ã§é ä¿¡ãã¦ãããã®ã§ãä¾åã®ãã¼ãããã¾ããã¨ããããã«ãªã£ã¦ãã¾ããããããæ°ãå¹ãã¦ãã¦ä¾¿å©ãªç¹ãã¨ã¬ã¡ã³ãåã«ã¯ bower.json ãåç §ããã¾ãã
ããã¥ã¡ã³ãã®å ¬é
ããã¸ã§ã¯ãã GitHub ã«ã¢ãããã¼ãããã®ãªããããã¥ã¡ã³ãã GitHub Pages ã使ãããã¨ããã§ããå ã»ã©ã® iron-component-page ã使ãã°æ¨æºç㪠UI ãæä¾ãããã®ã§ãããã使ãã¾ãã
polyserve ãè¡ããããªãã£ã¬ã¯ããªæ§æï¼ã¿ã㪠/components/ 以ä¸ï¼ã«ããã¨ãããªãããã¾ãããåç´ã«ããã®ã 㨠https://{user}.github.io/{element-name}/components/{element-name}/
ã¨ãã£ã URL ã§ã®é
ä¿¡ã«ãªã£ã¦ãã¾ãã¾ããå
¬å¼ã®ãªãã¸ããªã«ã¯ gp.sh ã£ã¦ã¹ã¯ãªããããããã§ãããããã¯ããããã¼ã¸ã¸ã®ã¢ã¯ã»ã¹ãã³ã³ãã¼ãã³ãã®ãã£ã¬ã¯ããªã«ãªãã¤ã¬ã¯ãããããã«ãªã£ã¦ãã¾ããPolymer Catalog ã®ããã«è¤æ°ã®ã¨ã¬ã¡ã³ããé
ä¿¡ããå ´åã¯ããã§ããã®ã§ããã1 ã¤ã ãã®å ´åã¡ãã£ã¨åã¾ããæªãã
ãã㧠gh-pages ãã©ã³ãã® /index.html ã« <base href="...">
è¦ç´ ãç½®ããã¨ã§ãhttps://{user}.github.io/{element-name}/
ã§ã®é
ä¿¡ãå¯è½ã«ãã¾ãã
以ä¸ã®ã¹ã¯ãªãããå®è¡ãã㨠components 以ä¸ã«ä¸»å½¹ã®ã³ã³ãã¼ãã³ãã¨ãã®ä¾åããã©ããã«é ç½®ããä¸ã§ãä¸è¨ã®ããã«ç´°å·¥ããããã¥ã¡ã³ãã® index.html ãæä¸ä½ã«ç½®ãããã£ã¬ã¯ããªã gh-pages ã¨ããååã§çæãã¾ãããã®å 容ã gh-pages ãã©ã³ãã¨ã㦠push ããã¨ããæãã«ãªãã¨æãã¾ãã
vulcanizeãpolybuild
ãã㧠Polymer ã¨ã¬ã¡ã³ãã使ç¨ããããã¥ã¡ã³ããã¼ã¸ãé
ä¿¡ã§ããããã§ããã<link rel="import">
ã«ããã¤ã³ãã¼ãã¯å帰çã«è¡ãããã¾ããã®ããã«ãããã¯ã¼ã¯éä¿¡ãçºçããã®ã§çµæ§é
ããããã解決ããããã«ãä¾åããã³ã³ãã¼ãã³ããä¸æã® HTML ã«ã¾ã¨ãã vulcanize ã¨ãããã¼ã«ã使ããã¨ãã§ãã¾ãã
vulcanize my-element.html > my-element.build.html
ãã㧠HTML ã CSS ã JavaScript ãå ¨é¨ã¾ã¨ã¾ããã§ãããã¾ãå ¨é¨ã¾ã¨ã¾ã£ã¦ããã£ã¦ãå°ãï¼Content-Security-Policy ã¨ãï¼ãç¾å¨ã¯å é¨ã§ vulcanize ãå©ç¨ãã polybuild ãããã®ã§ãããã使ãã®ãããã¨ãããã¨ã«ãªãããã§ãï¼ãã«ãããªãã£ããã¨ããã¼ã«ã¨ãã¦ã®æç度ã«ã¯ã¾ã ä½å°ãããããï¼ã
polybuild index.html # index.build.html 㨠index.build.js ãçæãã
ã¡ãªã¿ã« Polymer ã¨ã¬ã¡ã³ãã®èªä½ã«é¢ãã¦ã¯ä»¥ä¸ã®ãããªãè¦ãã¨æè¦ãã¤ãããã¨æãã¾ãã0.8 ã®ããã®è©±ã ãã©ã大æ ã¯ä¸ç·ã§ãã
CI
ãã¡ããå ¬éãã¦ä½¿ã£ã¦ããããã®ã§ããã°ãã¹ã㯠CI ã«è¼ãããããããã¥ã¡ã³ããã¦ã§ãã§ã¢ã¯ã»ã¹ã§ããã®ãããã§ãããããã®èªååã«ä»å㯠Wercker ã使ãã¾ãã
Werckerï¼ååã«ããã¨ãã¦ã§ããã£ã¼ãï¼ã¯ãããã CI as a Service ã§ãæè¿ Docker ã¤ã¡ã¼ã¸ããã«ãç°å¢ã«æå®ã§ããããã«ãªã£ããããããç¡æ²æ±°ã ã£ãã®ã§ä½¿ã£ã¦ã¿ã¾ãããã¾ãããã¯ãã 使ãããã£ãã ããªã®ã§ãä»ã®ãµã¼ãã¹ã§ãåé¡ãªãå¿ç¨ã§ããã¨æãã¾ãã
Wercker ã§ã®ãã¹ã
wct ã使ãã«ã¯ãã©ã¦ã¶ãå¿
è¦ï¼ã»ãã¨ã¯ Sauce Labs ã使ãããã©ãä»åã¯ãããªãã£ãï¼ãªã®ã§ããã®ããã® Dockerfile ãæ¸ãã¾ãããmotemen/nodejs-java-browsers ããã¯ä»¥ä¸ãã¤ã³ã¹ãã¼ã«ããã¦ãã¦ãxvfb-run wct
ã¨ããã°ãã©ã¦ã¶ãèµ·åãã¦ãã¹ããè¡ããç°å¢ã«ãªã£ã¦ãã¾ãã
- xvfb
- chrome
- firefox
- nodejs
- java
- git
wercker.yaml ã®å½è©²é¨åã¯ä»¥ä¸ã®ã¨ããã
box: motemen/nodejs-java-browsers build: steps: - npm-install - script: name: bower install code: | ./node_modules/bower/bin/bower install --allow-root --config.interactive=false - script: name: npm test code: | xvfb-run npm test
Wercker ã§ã®ãããã¤
Wercker ã§ã¯ææç©ã GitHub Pages ã« push ããã¹ãããï¼æé ï¼ãå©ç¨å¯è½ãªã®ã§ãããã¨å ã»ã©ã®ã¹ã¯ãªãããå©ç¨ããã°ç°¡åã« GitHub Pages ãæ´æ°ã§ãã¾ãã
deploy: steps: - script: name: generate gh-pages content code: | set -x url=$(git config remote.origin.url) url=${url%.git} name=$(basename $url) user=$(basename $(dirname $url)) user=${user#*:} out=./gh-pages rm -rf $out mkdir -p $out cp -R bower_components $out/components git archive --prefix=components/$name/ HEAD | tar x -C $out git rev-parse HEAD > $out/GIT_REVISION cat $out/components/$name/index.html | sed "s:<head>:<head><base href='components/$name/'>:" > $out/index.html - lukevivier/[email protected]: token: $GITHUB_TOKEN basedir: gh-pages
asciidoctor-element
ããããããã§ã§ããã®ã asciidoctor-element ã§ããã©ãããå©ç¨ãã ããï¼å®è£ 㯠marked-element ã®ä¸¸ãã¯ãªãªãã§è¦ãã¨ããªãï¼ã