• This repository has been archived on 10/Oct/2022
  • Stars
    star
    982
  • Rank 46,621 (Top 1.0 %)
  • Language
    JavaScript
  • Created over 8 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“ฆ build your react apps with one command and one `npm i`.

reactpack

NPM version Dependency Status js-standard-style

One command to build your React frontend.

Features

  • Unified package, only one npm i needed.
  • Linting with your .eslintrc or with standard.
  • Smartly merges existing .babelrc and webpack.config.js into configuration.
  • ES6 with Babel presets react, es2015 and stage-0.
  • PostCSS with precss and autoprefixer.
  • Style extraction into dedicated css bundle.
  • Include enviroment variables with an .env.js file.
  • Automatic index.html creation with html-webpack-plugin.
  • Source maps for styles and scripts.
  • Watch mode (--watch).
  • Development server mode (--dev).
  • Toggle optimizations with uglify and cssnano (-O).

Table of Contents

Install

$ npm i reactpack -g

or for use in scripts section of package.json

$ npm i reactpack --save-dev

Example

import React, { Component } from 'react'
import { render } from 'react-dom'

require('bootstrap/dist/css/bootstrap.css')

class Example extends Component {
  render () {
    return <h1>Hello World!</h1>
  }
}

render(<Example />, document.getElementById('react-app'))
{
  ...
  "scripts": {
    "build": "reactpack src/index.js",
  },
  "dependencies": {
    "bootstrap": "^3.3.6",
    "react": "^15.1.0",
    "react-dom": "^15.1.0",
  },
  "devDependencies": {
    "reactpack": "^0.2.0"
  },
  ...
}

reactpack

FAQ

How do I use another linter than standard?

reactpack will look for an eslint config (.eslintrc, .eslintrc.json ...) and if one is present it will use that one. Make sure that you have all the dependencies installed (plugins etc) to run your linter.

How do I customize index.html?

Place an index.ejs file in the same directory as your entry script and reactpack will use it for generating html. The default index.ejs looks like:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <title><%= htmlWebpackPlugin.options.title %></title>
    <% if (htmlWebpackPlugin.options.dev) { %>
    <script src="http://localhost:<%= htmlWebpackPlugin.options.port %>/webpack-dev-server.js"></script>
    <% } %>
  </head>
  <body>
    <div id="react-app"></div>
  </body>
</html>
How do I add other loaders?

Reactpack merge existing webpack.config.js it into its config so for example if you want to add less-loader just have a webpack.config.js with:

module.exports = {
  module: {
    loaders: [
      {
        test: /\.less$/,
        loader: 'style!css!less'
      }
    ]
  }
}

CLI

  Usage: reactpack [options] <entry> [path/to/bundle]

  Options:

    -h, --help         output usage information
    -V, --version      output the version number
    -q, --quiet        no output
    -O, --optimize     optimize css and js using minifiers
    -w, --watch        watch mode, rebuild bundle on file changes
    -d, --dev          start a dev server with hot module replacement
    -p, --port <port>  port for dev server (default is 8000)
    --standard         force standard linting (do not look for eslint config)
    --clean            delete everything in bundle path before building
    --absolute-path    use absolute path for assets
    --no-source-map    don't output source maps for css and js
    --no-postcss       don't use postcss (autoprefixer and precss)
    --no-html          don't output an index.html
    --no-extract       don't extract css into separate bundle
    --no-lint          turn off linting
    --no-env           don't try and load .env.js file
    --no-inject        don't inject bundles into index.html

Tested on

  • Windows 7 with node 6 and npm 3
  • Ubuntu 12.04 with node 6 and npm 3
  • MacOS 10.11 El Capitan with node 5-6 and npm 3

Contributors

  • Ola Holmstrรถm (@olahol)
  • Tarjei Huse (@tarjei)
  • Code Hz (@codehz)
  • Erik Huisman (@erikhuisman)
  • charlie hield (@stursby)
  • Niklas (@nikteg)
  • Victor Bjelkholm (@VictorBjelkholm)

More Repositories

1

melody

๐ŸŽถ Minimalist websocket framework for Go
Go
3,685
star
2

react-tagsinput

Highly customizable React component for inputing tags.
JavaScript
1,345
star
3

melody-jsnes

๐Ÿ“บ Multiplayer NES through the magic of WebSockets and Go.
HTML
767
star
4

react-ab

Simple declarative and universal A/B testing component for React.
JavaScript
432
star
5

react-social

Simple React components for social buttons (Facebook, Twitter and Pinterest) and social counts.
HTML
177
star
6

go-imageupload

๐Ÿ”ณ Gracefully handle image uploading and thumbnail creation.
Go
139
star
7

iso-3166-2.js

Lookup information about ISO-3166-2 subdivisions
JavaScript
108
star
8

express-chrome-logger

Debug your express app using the Chrome console.
JavaScript
83
star
9

pocketplace

๐ŸŽ† Draw pixels on a canvas with friends.
Go
79
star
10

scrollparent.js

A function to get the scrolling parent of a html element.
HTML
58
star
11

node-csp

Communicating sequential processes for node.
JavaScript
55
star
12

iso-3166-2.json

JSON file of ISO 3166-2 subdivisions.
JavaScript
54
star
13

greasyphone

๐Ÿ“ฑ ๐ŸŽฎ Play NES using smartphones as joypads
JavaScript
45
star
14

viewdiff

๐Ÿ“’ view your diffs in a separate window.
JavaScript
41
star
15

bf2c

๐Ÿ› Not the smallest compiler ever
JavaScript
20
star
16

socialcount.js

Tiny javascript library for getting social share counts. Pinterest, Facebook, Twitter and Google Plus supported.
JavaScript
17
star
17

cpp-csp

Minimalistic header-only library for channels and CSP (Communicating sequential process) in C++11.
C++
15
star
18

ethereum-web1-guestbook

๐Ÿ““ A Web 1.0 guestbook on Web 3.0
HTML
15
star
19

mainthread

Run functions in Go's main thread.
Go
14
star
20

eselement

DOM-like wrapper around the Javascript AST
JavaScript
6
star
21

tsreflect

Flexible reflection based TypeScript type generator for Go types that can be marshalled with `encoding/json`.
Go
6
star
22

capreq

Capture HTTP Requests using gopacket and libpcap
Go
6
star
23

hnplain

output Hacker News in plain text
Python
6
star
24

react-bus

Event emitter designed for communication between react components.
JavaScript
5
star
25

bf2asmjs

A simple brainfuck compiler targeting asm.js
Python
5
star
26

spawn.js

Tiny javascript library for spinning up one off web workers.
JavaScript
3
star
27

node-crcaptcha

Node package for using the Civil Rights Captcha.
JavaScript
2
star
28

tiny-xss-scanner

Lighweight xss scanner
Python
2
star
29

olapass

Stateless password manager.
JavaScript
1
star
30

request-animation-loop

As setInterval is to setTimeout, requestAnimationLoop is to requestAnimationFrame.
JavaScript
1
star
31

cpp-project-template

A small template for C++11 projects using tup and clang.
C++
1
star
32

generator-react-umd

A Yeoman generator that generates a minimalistic scaffold for a ES6 React component wrapped with the UMD.
JavaScript
1
star
33

gin-csrf

CSRF protection middleware for Go web framework Gin
Go
1
star
34

deepmodules

Analyze depth of Go packages
Go
1
star
35

node-mysql-slowlog

Application level slow log for mysql connections. Good for debugging slow queries when you haven't turned on or have access to the database slow log.
JavaScript
1
star