npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

polyup

v0.4.4

Published

Helps you upgrade from Polymer 0.5 to 1.0!

Downloads

13

Readme

polyup

Automates the boring parts of migrating your code from Polymer 0.5 to 1.0.

Build Status

The change from Polymer 0.5 to 1.0 is a large one, as we transitioned from exploratory beta releases to a stable production-ready product.

polyup will parse your HTML and any Javascript in either inline or external scripts and perform a number of automatic transformations to your code.

For most projects polyup won't be able to do everything necessary to upgrade, but its goal is to make it way easier.

Try it out in the interactive demo.

Installation

polyup is available on npm. We recommend installing polyup globally.

npm install -g polyup

This will install polyup to the bin directory configured when node was installed. (e.g. /usr/local/bin/polyup). You may need sudo for this step.

Usage

The command

polyup photo-lightbox.html

will parse and transform photo-lightbox and any linked Javascript that polyup can find and then print the transformed code back out onto the command line.

If that looks good, then you can run polyup with the --overwrite option to overwrite your code on disk with the upgraded version. Make sure that you've got your code checked into source control first, as this will in effect delete the v0.5 version of your code!

Manual Changes

polyup does a lot of stuff! But it doesn't do everything. See the After Use Guide for common changes that you'll need to make by hand.

Reporting Bugs

polyup is still in early and active development. Since so many people are looking at migrating to 1.0 right now we thought that it was better to get what we have now out there now, even if it won't be right for everyone.

Please file bugs as you see them! See CONTRIBUTING.md for more info.

Transformations

HTML

  • [x] <polymer-element name='my-elem'> -> <dom-module id='my-elem'>
  • [x] Moves direct <script> children of <polymer-element> elements into siblings.
  • [x] Migrates <style> children from an element's <template> into a direct child of the <dom-module>
  • [x] Migrates the attributes= attribute off <polymer-element> and into the properties block of the corresponding Polymer({...}) call.
  • [x] Generates a script and Polymer() call elements with a noscript attribute.
  • [x] Migrates the extends attribute on <polymer-element>.
  • [x] Warns on extending a custom element.
  • [x] Does not process extra <template> tags.
  • [x] Transforms <template if='{{x}}'> into <template is="dom-if" if="{{x}}">
  • [x] Upgrades <template repeat>
    • [x] Transforms <template repeat='{{x in xs}}'> into <template is='dom-repeat' items='{{xs}}' as='{{x}}'>
    • [x] Transforms <template repeat='{{x, i in xs}}'> into <template is='dom-repeat' items='{{xs}}' as='{{x}}' index-as='{{i}}'>
  • [ ] Upgrades/warns on <template bind>
    • [ ] Handles <template bind='{{x}}'>
    • [ ] Handles <template bind='{{x as y}}'>
  • [x] Upgrades <template is='auto-binding'>
    • [x] Adds a warning for expressions that are too complex for <template is='dom-bind'>
  • [x] Upgrades all template data binding expressions.
    • [x] Doesn't touch expressions made up only of identifiers, property accesses, or expressions that are just a function call with arguments made of identifiers and property accesses.
    • [x] Wraps an expression in a if it is not the only child of an element.
    • [x] Transforms an attribute made up of a mix of static string and expressions into an anonymous computed property.
    • [x] Transforms more complicated expressions anywhere into anonymous computed properties.
    • [x] Handles expressions with filters like {{x | f}}
    • [x] Upgrades one time bindings [[]] to their best equivilent.
    • [x] For binding to attributes which are not properties like class we need to use x$="{{foo}}" to bind to the HTML attribute.
    • [x] Upgrades boolean bindings like hidden?="{{foo}}"
    • [x] Handles bidirectional binding to common attributes of build-in elements
      • [x] <input value>
      • [x] <textarea value>
      • [x] <select value>
    • [x] Removes curly braces from on-* event handler attributes.
    • [x] Upgrades expressions using tokenList
  • [x] webcomponents(.min)?.js -> webcomponents_lite(.min)?.js
  • [ ] Upgrades official elements from 0.5 to 1.0 mode.
    • [x] Upgrades imports to the new element names and paths.
    • [x] Upgrades references in HTML.
    • [x] Upgrades attributes to their new names, where changed.
    • [ ] Warns on use of removed attributes.
    • [ ] Warns on use or import of elements that do not yet have a polymer version.
    • [ ] Adds additional imports when necessary.
    • [ ] Warns on other major breaking changes to elements.
    • [x] Upgrades official mixins from 0.5 into behaviors of 1.0.
    • [ ] Renames methods, e.g. this.$.ajax.go() -> this.$.ajax.generateRequest()
  • [x] Converts calls of Polymer.mixin and Polymer.mixin2 into behavior declarations.
  • [ ] Detects and upgrades user-defined mixins.

Javascript

  • [x] Infers element name from the context in which a script was loaded.
  • [x] Constructs a properties block from information inferred from many sources.
    • [x] Properties declared in the publish block are migrated, with the notify attribute set.
    • [x] Infers a property and its default value from properties directly on the Polymer({}) declaration
    • [x] Infers type from default value, where present.
    • [x] Converts mutable default values like arrays and objects into functions returning that default value.
    • [x] Discover implicit observers from functions declared with the name xChanged where x is a previously discovered property.
    • [x] Migrate explicitly declared observers from an observe block.
      • [ ] Get the arguments right here when there are multiple properties observed by one function. -- needs a test to be sure we're doing this right.
    • [x] Migrate computed properties from a computed block, including moving the body of an expression into a new function on the declaration.
  • [x] Migrate the body of the domReady function into the ready function, creating one if needed.
  • [ ] Rename common methods on all Polymer elements
    • [x] job -> debounce
    • [x] resolvePath -> resolveUrl
    • [ ] Need to generate a complete list of remaining renames.
  • [ ] Mostly preserves comments, but there are a number of places where they're lost currently.
  • [ ] Rename Polymer.import -> Polymer.Base.importHref
  • [ ] Replace addEventListener('polymer-ready', ...) with addEventListener('WebComponentsReady', ...)
  • [ ] Warns on usage of the removed trackstart and trackend events.
  • [x] Updates elem.domMethod to Polymer.dom(elem).domMethod
    • [x] appendChild, insertBefore removeChild, childNodes, parentNode, firstChild, lastChild, firstElementChild, lastElementChild, previousSibling, nextSibling, textContent, innerHTML, querySelector, querySelectorAll, getDistributedNodes, getDestinationInsertionPoints, setAttribute, removeAttribute, classList

CSS

  • [x] Detect layout attributes in HTML and add them back in to the element's <style>.
  • [x] Fix <link rel='stylesheet' href='...'>

Other

  • [ ] Upgrades bower.json