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

react-app-rewire-blockstack

v1.0.7

Published

Enables use of blockstack.js with create-react-app projects

Downloads

17

Readme

react-app-rewire-blockstack npm version

Allows you to rewire your dev server and build process to support blockstack.js in a create-react-app project.

Blockstack offers simple, yet powerful APIs for building decentralized apps. While the APIs abstract away a lot of the difficulty of communicating with the Bitcoin blockchain (including authentication and file storage), there's still some difficulty in configuring a Blockstack app's development server and build processes––particularly with a CRA (create-react-app) setup. CRA is arguably the most popular tool for bootstrapping React apps. "CRA apps" come pre-configured with an incredible, zero-config, developer experience. The repository has over 53K stars on GitHub, and is actively maintained by Facebook. You can "eject" in a CRA app to extend the configuration (with custom webpack and babel plugins, for example). A little extra configuration is necessary to get blockstack.js working with CRA apps. However, the CRA documentation cautions against ejecting, as it results in less seamless React updates. A better route (in my opinion), is the react-app-rewired library, which allows for CRA apps to be configured via a custom fork of CRA's react-scripts. The react-app-rewire-blockstack package works with the latter method. To implement Blockstack in your CRA app, follow the instructions below:

Installation

# with yarn
$ yarn add -D react-app-rewire-blockstack react-app-rewired
# with npm
$ npm install -D react-app-rewire-blockstack react-app-rewired

Usage

1) Go into your package.json and make the following changes:

  "scripts": {
-   "start": "react-scripts start",
+   "start": "react-app-rewired start",
-   "build": "react-scripts build",
+   "build": "react-app-rewired build",
-   "test": "react-scripts test --env=jsdom",
+   "test": "react-app-rewired test --env=jsdom"
  }

2) In the root directory of your project, create a config-overrides.js

3) Copy and paste:

const {
  rewireBlockstackBuild,
  rewireBlockstackDevServer
} = require('react-app-rewire-blockstack')

module.exports = {

  webpack: (config, env) => {
    if(env === 'production') {
      config = rewireBlockstackBuild(config)
    }
    return config
  },

  devServer: (configFunction) => {
    return (proxy, allowedHost) => {
      let config = configFunction(proxy, allowedHost)
      config = rewireBlockstackDevServer(config)
      return config
    }
  }

}

4) Enjoy building your decentralized app!!!

5) Please file an issue if you come across any bugs and I'll do my best to help. Thank you!

This library has been released under the MIT license