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

can-migrate

v2.3.2

Published

Codemods to simplify upgrading CanJS.

Downloads

150

Readme

can-migrate

npm version Build Status Greenkeeper badge

CLI & codemod scripts for upgrading to CanJS 3 to 6.

Usage

Check out the Using Codemods guide on canjs.com for an overview of this project, how to install can-migrate, how to use the CLI, and recommendations for how to migrate your app.

Generate template and tests

There is now a quick and easy way to create a transform and the associated tests and diff files. Running:

./bin/can-migrate-generate.js <folder> <transform> --can-version=6

Will either add the files to an existing folder or create a folder and add the files. It will create transform.js | transform-test.js | transform-input.js | transform-output.js as well as adding the information into the transforms.json.

transforms.json

There is one entry in the array per type of template/test required to generate the transforms. The current groups of transforms are:

  • Component Rename: rename parts of a component
  • can.extend: swap out extend for assign or deep-assign
  • can-data: swap out .data() for domData
  • Replace imports/requires: Replace existing import/require statements and replace any references in the code
  • Replace can.: Replace can. methods and add the corresponding import/require
[
  {
    "copy": [ // Copy these files from src
      {
        "input": "...", // Source filename
        "output: "...", // Destination filename
        "type": "fixture|test|transform" // Type of copy determines where the destination file ends up (more on that below)
      }
    ],
    "generate": [ // Generate output from the template in src using "transforms
      {
        "template": "...", // Source filename
        "outputPath: "...", // Destination filename
        "type": "fixture|test|transform" // Type of copy determines where the destination file ends up (more on that below)
      }
    ],
    "transforms": [
      {
        "shortName": "component", // Short name of the transform for debugging and template filename generation
        "oldSourceValues": [ // List of ways this component could be imported/required. Used to replace these with newer component import
          "can/component/",
          "can/component/component",
          "can/component/component.js"
        ],
        "newSourceValue": "can-component", // The new value of the import/require
        "exampleLocalName": "MyComponent" // The example local name to include in generate documentation
        "oldObjectName": "can", // Object name to look for
        "oldPropertyName": "addEvent", // Property name to look for
        "newPropertyName": addEventListener, // What should replace the object.property (false for nothing, could be a complex replacement like mutate.appendChild)
        "sourceValue": "can-construct" // Key to look up the configurable naming in config.json
      }
    ]
  }
]

Types

  • test: Copied to lib, file is added to test/test.js.
  • fixture : Copied to test/fixtures
  • transform: Copied to lib/transforms