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 🙏

© 2025 – Pkg Stats / Ryan Hefner

import-react-app

v1.0.0

Published

A script that clones a git repository containing a react-app, builds it, and adds it to your backend.

Downloads

3

Readme

import-react-app

WARING: You need node >= 7.10.0 to run this!

import-react-app is an easy way to automate the process of copying your built React App to your backend. Generally, this isn't a hard process; it's just inconvenient. The simplest way to solve it is manually, like so:

~              $ ls
my-backend my-react-app
~              $ cd my-react-app
~/my-react-app $ git pull
~/my-react-app $ yarn build
~/my-react-app $ cp build/static ../my-backend/static
~/my-react-app $ cp build/favicon.ico ../my-backend/static/favicon.ico
~/my-react-app $ cp build/index.html ../my-backend/views/react-app.html

Now, you have to do that every time you update your React App. What about your team? Does everyone do it manually? You may check it into source control...

~/my-react-app $ cd ../my-backend
~/my-backend   $ git add -A && git commit -m "Added the react app" && git push

...However, it doesn't feel right to commit it. After all, the React App is not part of your backend.

This is the problem that import-react-app aims to solve. It reads a git repository from your backend's package.json:

{
	"scripts": {
		"react-import": "ROOT_DIRECTORY=. import-react-app"
	},
	"import-react-app-apps": {
		"myApp": "[email protected]:<your_username>/<your_react_app>.git"
	}
}

After you run yarn react-import or npm run react-import, import-react-app will clone the repository on a temporary folder, install the dependencies, build the app by running the build script, and will copy the result to the views and static folders.

Although this process takes a significant amount of time, it is a convenient way to do it and easy to integrate with your build process.

Usage

First install the package:

$ yarn add --dev import-react-app
# or
$ npm install --save-dev import-react-app

Then add the following section to your package.json:

{
	"import-react-app-apps": {
		"appName": "[email protected]:<your_username>/<your_react_app>.git"
	}
}

Note: you may use the HTTP version of the git repository url as well.

If you want, you can add a script to your package.json as well:

{
	"scripts": {
		"react-import": "ROOT_DIRECTORY=. import-react-app"
	}
}

Otherwise you can run it with ROOT_DIRECTORY=. node ./node_modules/import-react-app/index.js.

By doing ROOT_DIRECTORY=. you're telling import-react-app to save the app in your directory. Otherwise, it would default to saving inside its own directory, which you don't want.

Why not commit the built react app

Indeed, committing it is easier, since you only need to clone the repository, and don't need an extra step. However, the same can be said about committing node_modules. It would be easier to simply clone, instead of cloning and installing. But on larger projects it isn't right to commit it; it just doesn't belong in source control.

You might argue that this is just personal preference, and you'd be right. But the great thing about import-react-app is that you can still use the method you've been using until now! :)