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

create-react-app-updater

v0.13.3

Published

Update Create React App projects

Downloads

485

Readme

create-react-app-updater

npm version Build status

Update Create React App projects

Fetches list of codemods and instructions from create-react-app-updater-codemods-manifest

This is a thin wrapper of boilerplate-update.

Ported from ember-cli-update

https://www.youtube.com/watch?v=pgS3-F0sXeM

Installation

As a global executable:

npm install -g create-react-app-updater

Usage

Make sure your git working directory is clean before updating.

Inside your project directory, if you installed globally run

create-react-app-updater

or the shorter

cra-update

If you want to use npx run

npx create-react-app-updater

It applies a diff of the changes from the latest version to your project. It will only modify the files if there are changes between your project's version and the latest version, and it will only change the section necessary, not the entire file.

You will probably encounter merge conflicts, in which the default behavior is to let you resolve conflicts on your own. You can supply the --resolve-conflicts option to run your system's git merge tool if any conflicts are found.

This tool can also run codemods for you. The option --run-codemods will figure out what codemods apply to your current version of React, and download and run them for you.

Examples

(These examples assume you are using the global command.)

To update to the latest version of Create React App:

cra-update

To update to a certain version of Create React App:

cra-update --to 2.1.1

To run codemods:

(This should be run after running the normal update shown above, and after you've resolved any conflicts.)

cra-update --run-codemods

Options

| Option | Description | Type | Examples | Default | |---|---|---|---|---| | --from | Use a starting version that is different than what is in your package.json | String | "2.9.1" | | | --to | Update to a version that isn't latest | String | "2.14.1" "~2.15" "latest" "beta" | "latest" | | --resolve-conflicts | Automatically run git mergetool if conflicts found | Boolean | | false | | --run-codemods | Run codemods to help update your code | Boolean | | false | | --reset | Reset your code to the default boilerplate at the new version | Boolean | | false | | --compare-only | Show the changes between different versions without updating | Boolean | | false | | --stats-only | Show all calculated values regarding your project | Boolean | | false | | --list-codemods | List available codemods | Boolean | | false |

Hints

Need help using git mergetool? Here are some starting points:

  • https://git-scm.com/docs/git-mergetool
  • https://gist.github.com/karenyyng/f19ff75c60f18b4b8149

If you made a mistake during the update/conflict resolution, run these commands to undo everything and get you back to before the update:

git reset --hard
git clean -f

If you notice ".orig" files lying around after a merge and don't want that behavior, run git config --global mergetool.keepBackup false.

To avoid being prompted "Hit return to start merge resolution tool (vimdiff):" for every conflict, set a merge tool like git config --global merge.tool "vimdiff".

If you run into an error like error: unrecognized input, you may need to update your git config color option like git config --global color.ui auto.

Troubleshooting

If you are getting an error or unexpected results, running the command with the debug flag:

  • Unix (global):   DEBUG=create-react-app-updater,boilerplate-update,git-diff-apply create-react-app-updater
  • Windows (global):   set DEBUG=create-react-app-updater,boilerplate-update,git-diff-apply && create-react-app-updater
  • Unix (npx):   DEBUG=create-react-app-updater,boilerplate-update,git-diff-apply npx create-react-app-updater
  • Windows (npx):   set DEBUG=create-react-app-updater,boilerplate-update,git-diff-apply && npx create-react-app-updater

will give you more detailed logging.