node package manager


Travis Status

Builder Archetype: Victory Component

A Victory component archetype for builder.


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

$ npm install --save builder-victory-component
$ npm 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.jsx
│   └── index.html
├── dist                        # Distribution build destination (standalone)
├── lib                         # Lib build destination (npm)
├── src                         # Component source
│   ├── components
│   │   └── *.jsx?
│   └── 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
        │       └── *.jsx?
        └── 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:

  "name": "my-cool-component"

The distribution files to output are:


and the exported class name is MyCoolComponent.

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

Usage Notes


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 
  extends: ./node_modules/builder-victory-component/config/eslint/.eslintrc-source
--- # <ROOT>/test/.eslintrc 
  extends: ../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.


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:

  • react & react-dom 0.14+
  • Most Victory components will also want to depend on `radium 0.16+``.

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.


Run $ builder help to see usage.

  builder <action> <task(s)>
  run, concurrent, envs, help
Flags: 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
    [builder-victory-component] cd lib || builder run build --expand-archetype
    [builder-victory-component] publishr postpublish
    [builder-victory-component] publishr postversion
    [builder-victory-component] builder run check
    [builder-victory-component] builder run test-frontend
    [builder-victory-component] builder run clean && builder run build
    [builder-victory-component] builder run build-lib && builder run build-dist
    [builder-victory-component] builder run clean-dist && builder run build-dist-min && builder run build-dist-dev
    [builder-victory-component] webpack --bail --config node_modules/builder-victory-component/config/webpack/ --colors
    [builder-victory-component] webpack --bail --config node_modules/builder-victory-component/config/webpack/webpack.config.js --colors
    [builder-victory-component] builder run clean-lib && babel src -d lib --copy-files
    [builder-victory-component] babel src -d lib --copy-files -w
    [builder-victory-component] builder run lint && builder run npm:test
    [builder-victory-component] builder run lint && builder run test-ci
    [builder-victory-component] builder run lint && builder run test-cov
    [builder-victory-component] builder run lint && builder run test-dev
    [builder-victory-component] builder run lint-perf && builder run test-perf
    [builder-victory-component] builder run clean-lib && builder run clean-dist
    [builder-victory-component] rimraf dist
    [builder-victory-component] rimraf lib
    [builder-victory-component] builder concurrent server-dev server-test
    [builder-victory-component] builder concurrent server-hot server-test
    [builder-victory-component] builder concurrent lint-source lint-demo lint-test
    [builder-victory-component] eslint --color --ext .js,.jsx demo
    [builder-victory-component] eslint --color --ext .js,.jsx perf
    [builder-victory-component] eslint --color --ext .js,.jsx src
    [builder-victory-component] eslint --color --ext .js,.jsx test
    [builder-victory-component] opener
    [builder-victory-component] builder concurrent dev open-demo
    [builder-victory-component] builder concurrent hot open-demo
    [ROOT] cd lib || builder run npm:postinstall
    [ROOT] builder run npm:postpublish
    [ROOT] builder run npm:postversion
    [ROOT] builder run npm:preversion
    [builder-victory-component] webpack-dev-server --port 3000 --config node_modules/builder-victory-component/config/webpack/demo/ --colors --content-base demo
    [builder-victory-component] webpack-dev-server --port 3000 --config node_modules/builder-victory-component/config/webpack/demo/ --colors --inline --hot --content-base demo
    [builder-victory-component] webpack-dev-server --port 3001 --config node_modules/builder-victory-component/config/webpack/webpack.config.test.js --colors
    [ROOT] builder run hot
    [ROOT] start-storybook -p 3001
    [ROOT] builder run check
    [builder-victory-component] builder run test-frontend-ci
    [builder-victory-component] builder run test-frontend-cov
    [builder-victory-component] builder run test-frontend-dev
    [builder-victory-component] karma start node_modules/builder-victory-component/config/karma/karma.conf.js
    [builder-victory-component] karma start --browsers PhantomJS,Firefox node_modules/builder-victory-component/config/karma/karma.conf.coverage.js
    [builder-victory-component] karma start node_modules/builder-victory-component/config/karma/karma.conf.coverage.js
    [builder-victory-component] karma start node_modules/builder-victory-component/config/karma/
    [builder-victory-component] karma start node_modules/builder-victory-component/config/karma/karma.conf.perf.js
    [builder-victory-component] builder run test-frontend-perf
    [ROOT] builder run npm:version
    [builder-victory-component] publishr dry-run -V