generator-platanus-angular-library v1.1.0
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,directiveorfilter) - Includes commonplace development files such as
.gitignoreand.jshintrcthat adhere to good practices - Includes
bower.jsonandpackage.jsonfiles 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-libraryYou 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:serviceto generate a service,yo platanus-angular-library:filterto generate a filter,yo platanus-angular-library:directiveto 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 lintchecks your JavaScript code for errors and warnings.gulp buildruns thelinttask 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 thedistfolder.gulp watchruns thelintandbuildtasks every time you make changes on a file in the./srcfolder of your project.
Publishing
gulp bumpincreases the version number on thepackage.jsonandbower.jsonfiles.gulp publish-gitruns thebumptask, creates a commit with the modified version and pushes a new tag that corresponds with it.gulp publish-npmruns both aforementioned tasks and publishes the new version into thenpmregistry.
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.