FormidableLabs/builder-victory-component

Name: builder-victory-component

Owner: Formidable

Description: Builder archetype for Victory components

Created: 2015-11-03 22:28:47.0

Updated: 2017-11-06 21:14:58.0

Pushed: 2017-11-07 00:46:44.0

Homepage:

Size: 204

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Travis Status

Builder Archetype: Victory Component

A Victory component archetype for builder.

Installation

To use the production and development workflows, install both this package and the development module:

m install --save builder-victory-component
m install --save-dev builder-victory-component-dev
Project Structure

This archetype assumes an architecture as follows:


.builderrc                  # Configures builder archetype
.eslintrc                   # Configures eslint
package.json
demo                        # Component demo
??? app.js
??? index.html
dist                        # Distribution build destination (standalone)
lib                         # Lib build destination (npm)
src                         # Component source
??? components
?   ??? *.js
??? index.js
perf                        # Component performance benchmarks
??? .eslintrc               # Configures eslint for tests
??? client
    ??? main.js
    ??? bench
    ?   ??? components
    ?       ??? *bench.js?
    ??? test.html
test                        # Component tests
??? .eslintrc               # Configures eslint for tests
??? client
    ??? main.js
    ??? spec
    ?   ??? components
    ?       ??? *.js
    ??? test.html

The name field in package.json (the published npm package name) is assumed to be:

  1. The desired file name of the distribution files and dash-cased.
  2. The desired default exported class name when converted to PascalCase.

So, if a package.json has:


ame": "my-cool-component"

The distribution files to output are:

/my-cool-component.js
/my-cool-component.js.map
/my-cool-component.min.js
/my-cool-component.min.js.map

and the exported class name is MyCoolComponent.

An example project using this structure is: formidable-react-component-boilerplate

Usage Notes
Eslint

The implementing project will need to add an .eslintrc file in the root which should extend the archetype eslint configuration. Another .eslintrc file should be placed in the test/ directory, extending the test eslint configuration. The presence of these files ensures support for most editor and IDE lint plugins.

These files will be added automatically when generating a new Victory component using builder-init builder-victory-component:

# <ROOT>/.eslintrc
tends: ./node_modules/builder-victory-component/config/eslint/.eslintrc-source
aml
# <ROOT>/test/.eslintrc
tends: ../node_modules/builder-victory-component/config/eslint/.eslintrc-test
Babel Configuration

This archetype does not currently specify its own .babelrc. Your project should specify its own in the root directory if you want non-default Babel settings (like using stage 0, for instance). See the recommended settings.

peerDependencies

This archetype is meant to be used in a very specific context: A Victory component. As such, it's assumed that the implementing component bring along these dependencies:

The reason we don't specify these in the archetype package.json's peerDependencies is to lower the friction to testing out beta builds of React by specifying a peer of react 0.14.x. Similarly, specifying a peer of >=0.14.x would imply that we're compatible with future React releases, something we can't promise.

Tasks

Run $ builder help to see usage.

e:

ilder <action> <task(s)>

ons:

n, concurrent, envs, help

s: General

builderrc: Path to builder config file (default: `.builderrc`)

help: Display help and exit

version: Display version and exit

quiet: Silence logging

log-level: Level to log at (`info`, `warn`, `error`, `none`)

env: JSON string of environment variables to add to process

env-path: JSON file path of environment variables to add to process

 Configs:

s_port_dev
[builder-victory-component] 3000

s_port_test
[builder-victory-component] 3001

s:

m:postinstall
[builder-victory-component] builder run build --expand-archetype

m:postpublish
[builder-victory-component] publishr postpublish -V

m:postversion
[builder-victory-component] publishr postversion -V

m:preversion
[builder-victory-component] builder run check

m:test
[builder-victory-component] builder run test-frontend

m:version
[builder-victory-component] builder run clean && builder run build

ild
[builder-victory-component] builder concurrent --queue=1 build-libs build-dist

ild-babel
[builder-victory-component] babel src --copy-files

ild-dist
[builder-victory-component] builder run clean-dist && builder concurrent --queue=1 build-dist-min build-dist-dev

ild-dist-dev
[builder-victory-component] webpack --bail --config node_modules/builder-victory-component/config/webpack/webpack.config.dev.js --colors

ild-dist-min
[builder-victory-component] webpack --bail --config node_modules/builder-victory-component/config/webpack/webpack.config.js --colors

ild-es
[builder-victory-component] builder run clean-es && builder run --env '{"BABEL_ENV":"es"}' build-babel -- -d es

ild-lib
[builder-victory-component] builder run clean-lib && builder run --env '{"BABEL_ENV":"commonjs"}' build-babel -- -d lib

ild-libs
[builder-victory-component] builder concurrent --queue=1 build-lib build-es

ild-watch
[builder-victory-component] builder concurrent build-lib build-es -- -w

eck
[builder-victory-component] builder run lint && builder run npm:test

eck-ci
[builder-victory-component] builder run lint && builder run test-ci

eck-cov
[builder-victory-component] builder run lint && builder run test-cov

eck-dev
[builder-victory-component] builder run lint && builder run test-dev

eck-perf
[builder-victory-component] builder run lint-perf && builder run test-perf

ean
[builder-victory-component] builder concurrent clean-lib clean-dist clean-es

ean-dist
[builder-victory-component] rimraf dist

ean-es
[builder-victory-component] rimraf es

ean-lib
[builder-victory-component] rimraf lib

v
[builder-victory-component] builder concurrent server-dev server-test

t
[builder-victory-component] builder concurrent server-hot server-test

nt
[builder-victory-component] builder concurrent lint-source lint-demo lint-test

nt-demo
[builder-victory-component] eslint --color demo

nt-perf
[builder-victory-component] eslint --color perf

nt-source
[builder-victory-component] eslint --color src

nt-test
[builder-victory-component] eslint --color test

en-demo
[builder-victory-component] opener http://127.0.0.1:3000

en-dev
[builder-victory-component] builder concurrent dev open-demo

en-hot
[builder-victory-component] builder concurrent hot open-demo

rver-dev
[builder-victory-component] webpack-dev-server --config node_modules/builder-victory-component/config/webpack/demo/webpack.config.dev.js --colors --content-base demo

rver-hot
[builder-victory-component] webpack-dev-server --config node_modules/builder-victory-component/config/webpack/demo/webpack.config.hot.js --colors --inline --hot --content-base demo

rver-test
[builder-victory-component] webpack-dev-server --config node_modules/builder-victory-component/config/webpack/webpack.config.test.js --colors

st-ci
[builder-victory-component] builder run test-frontend-ci

st-cov
[builder-victory-component] builder run test-frontend-cov

st-dev
[builder-victory-component] builder run test-frontend-dev

st-frontend
[builder-victory-component] karma start node_modules/builder-victory-component/config/karma/karma.conf.js

st-frontend-ci
[builder-victory-component] karma start --browsers PhantomJS,Firefox node_modules/builder-victory-component/config/karma/karma.conf.coverage.js

st-frontend-cov
[builder-victory-component] karma start node_modules/builder-victory-component/config/karma/karma.conf.coverage.js

st-frontend-dev
[builder-victory-component] karma start node_modules/builder-victory-component/config/karma/karma.conf.dev.js

st-frontend-perf
[builder-victory-component] karma start node_modules/builder-victory-component/config/karma/karma.conf.perf.js

st-perf
[builder-victory-component] builder run test-frontend-perf

rsion-dry-run
[builder-victory-component] publishr dry-run -V

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.