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

reeasy

v0.5.14

Published

Framework of React app with easy configuration. Support HMR and custom server. As simple as next.js.

Downloads

8

Readme

Reeasy.js

version build Coverage Status

Framework of React app with easy configuration. Support HMR and custom server. As simple as next.js.

Mostly ES6/React feature has be built in Reeasy.js. If you need more, just custom babel loader config.

How to use

Setup

Install it

npm i reeasy --save

and add a script to your package.json like this:

{
  "scripts": {
    "dev": "reeasy dev",
    "build": "reeasy build",
    "start": "reeasy start"
  }
}

create several necessary files:

index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Welcome to reeasy.js!</title>
    <meta charset="UTF-8"/>
  </head>
  <body>
    <div id="root"></div>
    <script src="/bundle.js"></script>
  </body>
</html>

app.js

import React from 'react'

export default () => (
  <div>Welcome to reeasy.js!</div>
)

reeasy.config.js - (reeasy config file)

module.exports = {
  rootPath: './app.js',  //Entry file path of your app
  selector: '#root'      //Selector of element for rendering
}

finally run npm run dev and go to http://localhost:3000. To use another port, you can run npm run dev -- -p <your port here>.

Run in production mode

Build it first

npm run build

Start server

npm start

Start server using pm2

pm2 start npm -- start

Custom configuration

Custom configuration is specified in reeasy.config.js in root directory of your project

module.exports = {

  //Entry file path of your app, this field is required
  // rootPath: <your entry file path>,
  
  //Selector of element for rendering, default `div`
  //starting with `.` for class name (such as `.content`);
  //starting with `#` for id (such as `#root`);
  //otherwise for tag name (like `div`),
  selector: 'div',
  
  //Output directory for build, default `.dist`
  outDir: '.dist',

  //Output bundle name, default `bundle.js`  
  bundleName: 'bundle.js',

  //Public path for http server, default `/`  
  publicPath: '/',
  
  //Path of index html file, default `./index.html`
  indexHTML: 'index.html',
  
  //Custom webpack configuration
  webpack: (config, dev) => {
    //config: webpack configuration object
    //dev: boolean, is in development mode

    //your config here

    //return new config (important!)
    return config
  },

  //Custom babel-loader configuration  
  babelLoaderConfig: (config, dev) => {
    //config: babel-loader configuration
    //dev: boolean, is in development mode
    
    //your config here

    //return new config (important!)
    return config
  },

  ////Custom webpack-dev-middleware configuration  
  devMiddlewareConfig: (config) => {
    //config: webpack-dev-middleware configuration
    
    //your config here

    //return new config (important!)
    return config
  }
}

Cli

Reeasy cli usage

  • reeasy dev Run reeasy in development mode, with hot module replacement
  • reeasy build Build app in production mode
  • reeasy start Start in production mode, need run reeasy build first

options

  • -c, --config Custom reeasy configuration file
  • -p, --port Port to listen for http server
  • -w, --cwd Custom working directory

Custom server

First, add a server.js file in your project directory like this:

  • If you use http module directly
const http = require('http')
const reeasy = require('reeasy')

const app = reeasy({
  dev: process.env.NODE_ENV !== 'production'
})

app.prepare().then(middleware => {
  const server = http.createServer((req, res) => {
    middleware(req, res)
  })

  server.listen(3000, err => {
    if (err) throw err
    console.log('> Ready on http://localhost:3000')
  })
})
  • If you use express
const express = require('express')
const reeasy = require('reeasy')

const app = reeasy({
  dev: process.env.NODE_ENV !== 'production'
})

app.prepare().then(middleware => {
  const server = express()

  //define other middleware here

  server.use(middleware)

  server.listen(3000, err => {
    if (err) throw err
    console.log('> Ready on http://localhost:3000')
  })
})
  • If you use koa
const Koa = require('koa')
const reeasy = require('reeasy')

const app = reeasy({
  dev: process.env.NODE_ENV !== 'production'
})

app.prepare().then(middleware => {
  const server = new Koa()

  //define other middleware here

  server.use(middleware.koa())

  server.listen(3000, err => {
    if (err) throw err
    console.log('> Ready on http://localhost:3000')
  })
})

Then add a script to your package.json like this:

{
  "scripts": {
    "dev": "NODE_ENV=development node server.js",
    "build": "reeasy build",
    "start": "NODE_ENV=production node server.js"
  }
}

Finally start your project by npm scripts.

The reeasy API is:

  • reeasy(opts: object) Create reeasy instance

Supported options:

  • cwd (string) Current work directory, use process.cwd() as default
  • dev (bool) Whether to launch reeasy in dev mode, default false
  • conf (string) Custom reeasy configuration file path, if not set this option, use default configuration file path (reeasy.config.js in root directory)

License

MIT