generator-platanus-angular-library
v1.1.0
Published
A Yeoman generator for Angular libraries using Platanus conventions.
Downloads
2
Keywords
Readme
Platanus Angular Library Generator
This generator provides a basic template to create Angular libraries that use Platanus code conventions and utilities. It also helps you adhere to package naming and file structure conventions and get up and running in no time!
What it does
- Creates a new empty library with an initial component of your choosing (
service
,directive
orfilter
) - Includes commonplace development files such as
.gitignore
and.jshintrc
that adhere to good practices - Includes
bower.json
andpackage.json
files that are filled with your library's information for easy package publishing - Includes a set of Gulp tasks to help you even further with bumping versions, pushing tags and npm releases
Install
- Make sure you have installed Yeoman with
npm install -g yo
- Install our generator with
npm install -g generator-platanus-angular-library
- Done!
Starting a project
Easy as 1, 2, 3:
$ mkdir my-library
$ cd my-library
$ yo platanus-angular-library
You will be prompted to enter the following information about your library to help you name your files and prepare your package.json
and bower.json
:
- Namespace (platanus)
- Module Name (myLibrary)
- Library Name (angular-my-library)
- Component Type (service, directive or filter)
After you enter all the required information, the generator will create the necessary files and run npm install && bower install
to download the required dependencies. Once everything is in place, you can start your happy development process.
Subgenerators
To help you extend your library with more components, you can run these subgenerators to add new boilerplate services, directives or filters to your project.
yo platanus-angular-library:service
to generate a service,yo platanus-angular-library:filter
to generate a filter,yo platanus-angular-library:directive
to generate a directive.
Alternatively, you can just run yo platanus-angular-library:component
and you will be asked to select the type of the component you want to add.
Usage
Here's how to use all the goodies that come with our generator.
Building
gulp lint
checks your JavaScript code for errors and warnings.gulp build
runs thelint
task and annotates Angular dependencies in your code (using ngInclude), minifies and concatenates it in a single file named according to your previously set library name (angular-my-library.min.js
), and places it in thedist
folder.gulp watch
runs thelint
andbuild
tasks every time you make changes on a file in the./src
folder of your project.
Publishing
gulp bump
increases the version number on thepackage.json
andbower.json
files.gulp publish-git
runs thebump
task, creates a commit with the modified version and pushes a new tag that corresponds with it.gulp publish-npm
runs both aforementioned tasks and publishes the new version into thenpm
registry.
Testing
Included in your newly created library, comes a tests
folder with an example file that uses Karma and Jasmine. There's also a karma.conf.js
that is configured to work with angular-mocks
.
If you have installed the Karma CLI (npm install -g karma-cli
), you may run karma start
in the project's folder to run your tests.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Credits
Thank you [contributors](https://github.com/platanus/<%= libraryName %>/graphs/contributors)!
generator-platanus-angular-library is maintained by platanus.
License
generator-platanus-angular-library is © 2015 platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.