Skip to content

How to Create a Basic Library

BSick7 edited this page Jan 25, 2015 · 5 revisions

A yeoman generator exists to aid the process of creating libraries. We will walk through the process for installing generator-fayde-library.

Prerequisites

Using

# Install yeoman generator
$ npm install -g generator-fayde-library

# Run generator
# (NOTE: Make sure to run as administrator)
$ yo fayde-library

Once questions are answered, generator will create a scaffold. This scaffold provides build tools as well as a blueprint for theming and including other libraries.

Exposing a control

In a basic library, expose Controls through Typescript module syntax. The following example assumes the module namespace for the library to be ControlsLibrary.

module ControlsLibrary {
    export class FancyControl extends Fayde.Controls.Control {
    }
}

Preparing

The yeoman generator will prepare all dependencies; however, you will need to ensure these dependencies are set up if you are setting up an existing project from source control.

# Download dependencies and set up packages in test and testsite project
$ grunt lib:reset

Testing

# Launch test site (for visual tests)
$ grunt testsite

# Launch unit tests
$ grunt test

Distributing

Fayde utilizes bower for a package manager. bower uses semver to properly manage package versions.

# Increment build number and build distributable files.
$ grunt dist:upbuild

# Increment minor and build distributable files.
$ grunt dist:upminor

# Increment major and build distributable files.
$ grunt dist:upmajor

After the build finishes, we recommend pushing a git tag that matches the library version number.

# Replace <...> with proper version parts
$ git tag -l '<major>.<minor>.<build>'
$ git push --tags
Clone this wiki locally