Skip to content
This repository has been archived by the owner on Jan 11, 2018. It is now read-only.

Latest commit

 

History

History
168 lines (113 loc) · 5.11 KB

DEVELOPER.md

File metadata and controls

168 lines (113 loc) · 5.11 KB

Developing Blaze-elements

This project is a multip package monorepo handled by Lerna

This document describes how to set up your development environment to build and test blaze-elements. It also explains the basic mechanics of using git, node, npm, yarn.

See the contribution guidelines if you'd like to contribute to Blaze-elements.

Prerequisite Software

Before you can build and test, you must install and configure the following products on your development machine:

  • Git and/or the GitHub app (for Mac or Windows); GitHub's Guide to Installing Git is a good source of information.

  • Node.js, (version >=5.4.1 <6) which is used to run a development web server, run tests, and generate distributable files. We also use Node's Package Manager, npm (version >=3.5.3 <4.0), which comes with Node. Depending on your system, you can install Node either from source or as a pre-packaged bundle.

  • yarn which is Fast, reliable, and secure dependency management, so it's our prefered way for installing packages instead of slow npm. You can install it via npm install -g yarn or follow this guidelines

Getting the Sources

Fork and clone the Blaze-elements repository:

  1. Login to your GitHub account or create one by following the instructions given here.
  2. Fork the main Blaze-elements repository.
  3. Clone your fork of the Blaze-elements repository and define an upstream remote pointing back to the Blaze-elements repository that you forked in the first place.
# Clone your GitHub repository:
git clone [email protected]:<github username>/blaze-elements.git

# Go to the blaze directory:
cd blaze-elements

# Add the main Blaze repository as an upstream remote to your repository:
git remote add upstream https://github.com/wc-catalogue/blaze-elements.git

Installing NPM Modules

Next, install the JavaScript modules needed to build and test Blaze-elements:

# Install Blaze-elements project dependencies (package.json)
yarn

Running the development server

Run the development server for all packages:

# from project root
yarn start

open http://localhost:8080

Run the development server for particular package:

cd packages/<elemenet-directory>

yarn start

open http://localhost:8080

Generating new package using template

# Create empty folder for desired package
mkdir packages/somepackagename

# Run config generation task
yarn toolbelt:generate:configs

NOTE: templates are stored under toolbelt/templates

Running Tests Locally

To run tests:

# from project root
yarn test                   # Run all blaze-elements tests
yarn test:watch             # Run all blaze-elements tests in watch mode ( good for development ) - will run FF,Chrome,Chrome Canary
yarn test:watch:firefox     # Run all blaze-elements tests in watch mode ( good for development ) - will run only FF

For particular package:

cd packages/button
yarn test                   # Run tests only for bl-button
yarn test:watch             # Run tests only for bl-button in watch mode ( good for development ) - will run FF,Chrome,Chrome Canary
yarn test:watch:firefox     # Run tests only for bl-button in watch mode ( good for development ) - will run only FF

All the tests are executed on our Continuous Integration infrastructure and a PR could only be merged once the tests pass.

  • Travis CI fails if you submit code with Typescript or TSLint errors or any of the test suites described above fails.

Formatting your source code

Blaze-elements uses typescript-formatter to format the source code. If the source code is not properly formatted, the CI will fail and the PR can not be merged.

You can automatically format your code by running:

$ yarn ts:format

and fix autofixable tslint errors by running:

$ yarn ts:lint:fix

Linting/verifying your source code

You can check that your code is properly formatted and adheres to coding style by running:

$ yarn ts:lint

Building

To build whole Blaze-elements suit run:

yarn build

To build just particular Blaze-elements package run:

cd packages/button
yarn build
  • Results are put in the dist folder.

Publish to npm

NOTE: This section is for collaborators only. Contributors without repo write access can ignore this section.

To release blaze-elements, you should perform the following steps:

@TODO