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

cra-hyperapp

v0.1.0

Published

Hyperapp expansion pack for create-react-app

Downloads

14

Readme

Hyperapp for zero-configuration create-react-app style projects

Starting a new project

Start by creating a new folder for your awesome new Hyperapp project and initialize a new project with npm.

mkdir my-awesome-project
cd my-awesome-project
mkdir public src
npm init -y

Install your dependencies (they're good for your health).

npm i hyperapp
npm i -D cra-hyperapp

Then open your package.json in your favorite text editor and add your scripts.

"scripts": {
+  "start": "hyperapp-scripts",
+  "build": "hyperapp-scripts build"
},

Create a public/index.html file.

<!doctype html>
<html>
  <head>
    <title>My awesome app!</title>
  </head>
  <body></body>
</html>

Next create a src/index.js file with a basic hello world app.

import { h, app } from "hyperapp"

const state = { title: "Hi." }
const actions = {}
const view = state => <h1>{state.title}</h1>

app(state, actions, view, document.body)

Finally start your app and gaze upon its glory.

npm start

Congratulations! Your app is now ready to make even more awesome! 😎

A 12 step recovery program for kicking your React/Redux habit in favor of Hyperapp

  1. Remove the react, react-dom, redux, and react-redux dependencies.
npm rm react react-dom redux react-redux
  1. Add the hyperapp and cra-hyperapp dependencies.
npm i hyperapp cra-hyperapp
  1. Replace react-scripts with hyperapp-scripts in your package.json.
"scripts": {
-  "start": "react-scripts start",
-  "build": "react-scripts build"
+  "start": "hyperapp-scripts start",
+  "build": "hyperapp-scripts build"
},
  1. Remove your Redux store.
rm src/store.js
  1. Replace import React from "react" with import { h } from "cra-hyperapp". This gives some compatibility features like onClick style support and children as a component prop instead of 2nd argument.
-import React from "react"
+import { h } from "cra-hyperapp"
  1. Replace the ReactDOM.render with app from hyperapp using the withReducer HOA to pass your root reducer.
-import React from "react";
-import { render } from "react-dom";
-import { Provider } from "react-redux";
-import store from "./store";
+import { h, withReducer } from "cra-hyperapp";
+import { app } from "hyperapp";
+import reducer from "./reducer";

-render(
+withReducer(reducer)(app)(
+  state,
+  actions,
-  <Provider store={store}>
-    <App />
-  </Provider>,
+  (state, actions) => <App />,
   document.getElementById("root")
 );
  1. Replace import { connect } from "react-redux" with import { connect } from "cra-hyperapp".
-import { connect } from "react-redux";
+import { connect } from "cra-hyperapp";

Your app should now be back in a working state. Verify this before going full Hyperapp.

  1. Move your action/reducer combinations over to native Hyperapp one at a time.
  2. Move your components over to native Hyperapp one at a time to use the built-in h and removing the connect HOC (this happens somewhat simultaneously with the last step).
-import { h, connect } from "cra-hyperapp"
+import { h } from "hyperapp";
  1. Remove the withReducer HOA from your app.
-import { withReducer } from "cra-hyperapp";
import { h, app } from "hyperapp";
-import reducer from "./reducer";

-withReducer(reducer)(app)(
+app(
  state,
  actions,
  view,
   document.getElementById("root")
 );
  1. Delete your reducer.
rm src/reducer.js
  1. Profit with Hyperapp. 💰