reddit/node-mothership

Name: node-mothership

Owner: Reddit

Description: CLI tools for running platform projects

Created: 2016-04-25 21:38:25.0

Updated: 2018-05-08 19:06:22.0

Pushed: 2016-04-25 22:40:27.0

Homepage: null

Size: 13

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

mothership

A set of tools for building isomorphic web apps with @r/framework. Provides a build system, server GUI, project generator, and some helpful utilities.

Example
ership generate reddit-mobile
nerating project "reddit-mobile"...
ilding directory structure...
README
server.js
client.js
config.js
middleware/
assets/
tests/
nerating package.json...
stalling npm modules...
ilding initial packages...
lete! Run `mothership launch` to run the server.

ership launch
ching reddit-mobile at localhost:4444...
ched 4 processes.
ching repl...

it-mobile-app~$ debug web

ing all logging for web requests...
/ (80ms)
Installation

The easiest way to install is through NPM - just run npm install -g @r/mothership. This will add a binary, mothership, to your global node modules. If you want to use mothership's libraries, such as the build process, you can instead run npm install @r/mothership --save in your project. If installed locally, you can add npm scripts such as "start": "@r/mothership launch" to your package.json.

Alternatively, clone this repository and run npm install -g from the directory.

CLI Usage

mothership provides a binary for functions involving setting up and launching @r/framework applications.

generate

mothership generate will use a template to generate a new directory structure for a web project. It will set up a barebones application with one “Hello World” page, from which you can begin building your application. It will also run the first build for you, so you can launch the server and begin working immediately. It will not overwrite any existing files. It will run git init if git is available and there is not an existing repository.

Options
Launch

mothership launch will launch a webserver. It runs in dev mode by default, which will watch for file changes and reload web servers, and will launch a terminal interface which includes a CLI and REPL.

Options
Library Usage

mothership provides libraries to help build @r/framework applications.

Build

mothership.Build provides utilities for using webpack to build web applications.

Example
ompile.js

t { Build } = import "@r/mothership";
t options = {};

t build = new Build(options);
d.run();
d.watch();
Options

Build uses all standard webpack configuration options. Defaults are lised below:

t COMMON_CONFIG = {
tput: {
path: path.join(__dirname, 'bin'),
filename: "[name].js",

solve: {
extensions: ['', '.js'],

dule: {
loaders: [
  {
      test: /\.css$/,
      loader: ExtractTextPlugin.extract("style-loader", "css-loader")
  },
  {
      test: /\.less$/,
      loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
  },
  {
    test: /\.js$/,
    exclude: /node_modules/,
    loader: 'babel',
    query: {
      presets: [
        'es2015',
        'stage-2',
        'react',
      ],
      plugins: [
        'transform-class-properties',
        'transform-runtime',
      ],
    },
  },
],

ugins: [
new ExtractTextPlugin('[name].css'),

stcss: [
autoprefixer({
  browsers: ['last 2 versions'],
}),



This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.