-
Notifications
You must be signed in to change notification settings - Fork 27
How to Create a Basic Library
A yeoman generator exists to aid the process of creating libraries. We will walk through the process for installing generator-fayde-library
.
# 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.
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 {
}
}
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
# Launch test site (for visual tests)
$ grunt testsite
# Launch unit tests
$ grunt test
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