Archives
-
Polymer 1.0 - Polylint - use on project instead of component
The Polymer team just release Polylint, a tool to catch errors in your polymer project before even running your code.
The tool seems to be designed to work in a component, but it faisl in a project that follows the project structure as used in the Polymer Starter Kit.
You can see this structure at https://github.com/polymerelements/polymer-starter-kit.
In this structure the folder bower_components folder is located next to the app folder, instead of in the app folder.
To get started:
git clone https://github.com/polymerelements/polymer-starter-kit
cd polymer-starter-kit
bower install
Now if you run the command polylint --root app --input index.html you will get the following errors:
ERROR finding app\bower_components\webcomponentsjs\webcomponents-lite.js
Error: ENOENT, open 'C:\p\serge\polymer-starter-kit\app\bower_components\webcomponentsjs\webcomponents-lite.js'
at Error (native)
ERROR finding app\bower_components\iron-flex-layout\classes\iron-flex-layout.html
ERROR finding app\bower_components\iron-icons\iron-icons.html
ERROR finding app\bower_components\iron-pages\iron-pages.html
ERROR finding app\bower_components\iron-selector\iron-selector.html
ERROR finding app\bower_components\paper-drawer-panel\paper-drawer-panel.html
ERROR finding app\bower_components\paper-icon-button\paper-icon-button.html
ERROR finding app\bower_components\paper-item\paper-item.html
ERROR finding app\bower_components\paper-material\paper-material.html
ERROR finding app\bower_components\paper-menu\paper-menu.html
ERROR finding app\bower_components\paper-scroll-header-panel\paper-scroll-header-panel.html
ERROR finding app\bower_components\paper-styles\paper-styles-classes.html
ERROR finding app\bower_components\paper-toast\paper-toast.html
ERROR finding app\bower_components\paper-toolbar\paper-toolbar.html
ERROR finding app\bower_components\page\page.js
ERROR finding app\bower_components\polymer\polymer.htmlThis can be solved by creating a symbolic link bower_components in the app folder to ..\bower_components.
The following script RunPolylint.bat will do this, place it in the root of your project (next to the app folder.
:: RunPolylint.bat - by Serge van den Oever, http://weblogs.asp.net/soever
:: This script assumes that polylint in installed
:: globally through the following command:
:: npm install -g polylint
:: Polylint assumes that the bower_components folder is located
:: in the same folder as the entry point file as specified with --input.
:: This is the case for a Polymer component, but not for an application
:: that follows the structure of the Polymer Starter Kit.
:: This script solves this issue by creating a temporary symbolic link
:: to the folder bower_components in the folder app
@cd %~dp0
set root=app
set input=index.html
pushd %root%
mklink bower_components ..\bower_components
popd
polylint --root %root% --input %input%
del %root\bower_components