Skip to content

Commit 146ac3b

Browse files
committed
Add support for component
1 parent 1fa3ebf commit 146ac3b

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

Gruntfile.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = function (grunt) {
88
grunt.loadNpmTasks('grunt-contrib-watch');
99
grunt.loadNpmTasks('grunt-contrib-connect');
1010
grunt.loadNpmTasks('grunt-karma');
11-
11+
1212
// Project configuration.
1313
grunt.initConfig({
1414
builddir: 'build',
@@ -25,7 +25,12 @@ module.exports = function (grunt) {
2525
clean: [ '<%= builddir %>' ],
2626
concat: {
2727
options: {
28-
banner: '<%= meta.banner %>\n(function (window, angular, undefined) {\n',
28+
banner: '<%= meta.banner %>\n\n'+
29+
'/* commonjs package manager support (eg componentjs) */\n'+
30+
'if (module && exports && module.exports === exports){\n'+
31+
' module.exports = \'ui.router\';\n'+
32+
'}\n\n'+
33+
'(function (window, angular, undefined) {\n',
2934
footer: '})(window, window.angular);'
3035
},
3136
build: {
@@ -124,8 +129,10 @@ module.exports = function (grunt) {
124129

125130
grunt.registerTask('prepare-release', function () {
126131
var bower = grunt.file.readJSON('bower.json'),
132+
component = grunt.file.readJSON('component.json'),
127133
version = bower.version;
128134
if (version != grunt.config('pkg.version')) throw 'Version mismatch in bower.json';
135+
if (version != component.version) throw 'Version mismatch in component.json';
129136

130137
promising(this,
131138
ensureCleanMaster().then(function () {
@@ -144,7 +151,7 @@ module.exports = function (grunt) {
144151
var version = grunt.config('pkg.version'), releasedir = grunt.config('builddir');
145152
promising(this,
146153
system('git add \'' + releasedir + '\'').then(function () {
147-
return system('git commit -m \'release ' + version + '\'');
154+
return system('git commit -m \'release ' + version + '\'');
148155
}).then(function () {
149156
return system('git tag \'' + version + '\'');
150157
})

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ to change. Using it in a project that requires guaranteed stability is not recom
2626

2727
## Get Started
2828

29-
**(1)** Get UI-Router in one of 3 ways:
29+
**(1)** Get UI-Router in one of 4 ways:
3030
- clone & [build](#developing) this repository
3131
- [download the release](http://angular-ui.github.io/ui-router/release/angular-ui-router.js) (or [minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js))
32-
- or via **[Bower](http://bower.io/)**: by running `$ bower install angular-ui-router` from your console
32+
- via **[Bower](http://bower.io/)**: by running `$ bower install angular-ui-router` from your console
33+
- or via **[Component](https://github.com/component/component)**: by running `$ component install angular-ui/ui-router` from your console
3334

34-
**(2)** Include `angular-ui-router.js` (or `angular-ui-router.min.js`) in your `index.html`, after including Angular itself
35+
**(2)** Include `angular-ui-router.js` (or `angular-ui-router.min.js`) in your `index.html`, after including Angular itself (For Component users: ignore this step)
3536

36-
**(3)** Add `'ui.router'` to your main module's list of dependencies
37+
**(3)** Add `'ui.router'` to your main module's list of dependencies (For Component users: replace `'ui.router'` with `require('angular-ui-router')`)
3738

3839
When you're done, your setup should look similar to the following:
3940

@@ -46,6 +47,8 @@ When you're done, your setup should look similar to the following:
4647
<script src="js/angular-ui-router.min.js"></script>
4748
<script>
4849
var myApp = angular.module('myApp', ['ui.router']);
50+
// For Component users, it should look like this:
51+
// var myApp = angular.module('myApp', [require('angular-ui-router')]);
4952
</script>
5053
...
5154
</head>
@@ -271,4 +274,3 @@ There are a number of targets in the gruntfile that are used to generating diffe
271274
* `grunt build`: Perform a normal build
272275
* `grunt dist`: Perform a clean build and generate documentation
273276
* `grunt dev`: Run dev server (sample app) and watch for changes, builds and runs karma tests on changes.
274-

component.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "angular-ui-router",
3+
"version": "0.2.0",
4+
"description": "State-based routing for AngularJS",
5+
"keywords": [
6+
"angular",
7+
"states",
8+
"routing"
9+
],
10+
"main": "release/angular-ui-router.min.js",
11+
"scripts": [
12+
"release/angular-ui-router.min.js"
13+
],
14+
"license": "MIT",
15+
"repo": "angular-ui/ui-router"
16+
}

0 commit comments

Comments
 (0)