Skip to content

Commit

Permalink
Stable Version 4.2.1.
Browse files Browse the repository at this point in the history
Updated dependencies
Better commonjs interop
Added a number of build examples

Fixes #166
Fixes #183
Fixes #185
  • Loading branch information
jmdobry committed Jul 1, 2015
1 parent cbeb9eb commit a286c76
Show file tree
Hide file tree
Showing 26 changed files with 312 additions and 133 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ coverage/Firefox*/*
coverage/

bower_components/

build_examples/**/bundle.js
1 change: 1 addition & 0 deletions build_examples/browserify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Running `browserify app.js > bundle.js` in this directory will produce `bundle.js`
11 changes: 11 additions & 0 deletions build_examples/browserify/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var angular = require('angular');

angular.module('app', [
// this is what you would do in a real app
// require('angular-cache')

// for the example to work
require('../../dist/angular-cache.js')
]).run(function ($rootScope, CacheFactory) {
$rootScope.test = 'It works! Using ' + (CacheFactory ? 'angular-cache' : 'undefined');
});
11 changes: 11 additions & 0 deletions build_examples/browserify/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>My App</title>
<!-- load bundled scripts -->
<script src="bundle.js"></script>
</head>
<body>
<h1>{{ test }}</h1>
</body>
</html>
3 changes: 3 additions & 0 deletions build_examples/r.js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Running `r.js -o require.config.js` in this directory will produce `bundle.js`

In `index.html` switch `script/main` between `main` (load scripts dynamically) and `bundle` (load bundled scripts)
9 changes: 9 additions & 0 deletions build_examples/r.js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
define('app', [
'angular',
'angular-cache'
], function (angular, angularCacheModuleName) {
return angular.module('app', ['angular-cache'])
.run(function ($rootScope) {
$rootScope.test = 'It works! Using ' + angularCacheModuleName;
});
});
14 changes: 14 additions & 0 deletions build_examples/r.js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<!-- load scripts dynamically -->
<script data-main="main" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.min.js"></script>

<!-- load bundled scripts -->
<!--<script data-main="bundle" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.min.js"></script>-->
</head>
<body ng-cloak>
<h1>{{ test }}</h1>
</body>
</html>
22 changes: 22 additions & 0 deletions build_examples/r.js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require.config({
paths: {
angular: '../../bower_components/angular/angular',
'angular-cache': '../../dist/angular-cache',
},
shim: {
'angular': {
exports: 'angular'
}
}
});

require([
'angular',
'app'
], function (angular, app) {
angular.element(document.getElementsByTagName('html')[0]).ready(function () {
// bootstrap the app manually
angular.bootstrap(document, ['app']);
});
}
);
6 changes: 6 additions & 0 deletions build_examples/r.js/require.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
({
name: 'main',
mainConfigFile: 'main.js',
out: 'bundle.js',
optimize: 'none'
})
1 change: 1 addition & 0 deletions build_examples/webpack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Running `webpack` in this directory will produce `bundle.js`
8 changes: 8 additions & 0 deletions build_examples/webpack/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var angular = require('angular');
var angularCacheModuleName = require('angular-cache');

var app = angular.module('app', [
angularCacheModuleName
]).run(function ($rootScope) {
$rootScope.test = 'It works, imported ' + angularCacheModuleName;
});
11 changes: 11 additions & 0 deletions build_examples/webpack/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>My App</title>
<!-- load bundled scripts -->
<script src="bundle.js"></script>
</head>
<body>
<h1>{{ test }}</h1>
</body>
</html>
11 changes: 11 additions & 0 deletions build_examples/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
entry: './app.js',
output: {
filename: 'bundle.js'
},
resolve: {
alias: {
'angular-cache': '../../dist/angular-cache.js'
}
}
};
1 change: 1 addition & 0 deletions build_examples/webpack_es6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Running `webpack` in this directory will produce `bundle.js`
8 changes: 8 additions & 0 deletions build_examples/webpack_es6/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import angular from 'angular';
import angularCacheModuleName from 'angular-cache';

let app = angular.module('app', [
angularCacheModuleName
]).run($rootScope => {
$rootScope.test = 'It works, imported ' + angularCacheModuleName;
});
11 changes: 11 additions & 0 deletions build_examples/webpack_es6/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>My App</title>
<!-- load bundled scripts -->
<script src="bundle.js"></script>
</head>
<body>
<h1>{{ test }}</h1>
</body>
</html>
16 changes: 16 additions & 0 deletions build_examples/webpack_es6/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
entry: './app.js',
output: {
filename: 'bundle.js'
},
resolve: {
alias: {
'angular-cache': '../../dist/angular-cache.js'
}
},
module: {
loaders: [
{ test: /(.+)\.js$/, loader: 'babel-loader?blacklist=useStrict' }
]
}
};
1 change: 1 addition & 0 deletions build_examples/webpack_es6_2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Running `webpack` in this directory will produce `bundle.js`
8 changes: 8 additions & 0 deletions build_examples/webpack_es6_2/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'angular';
import 'angular-cache';

let app = angular.module('app', [
'angular-cache'
]).run(($rootScope, CacheFactory) => {
$rootScope.test = 'It works, imported ' + (CacheFactory ? 'angular-cache' : 'undefined');
});
11 changes: 11 additions & 0 deletions build_examples/webpack_es6_2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>My App</title>
<!-- load bundled scripts -->
<script src="bundle.js"></script>
</head>
<body>
<h1>{{ test }}</h1>
</body>
</html>
16 changes: 16 additions & 0 deletions build_examples/webpack_es6_2/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
entry: './app.js',
output: {
filename: 'bundle.js'
},
resolve: {
alias: {
'angular-cache': '../../dist/angular-cache.js'
}
},
module: {
loaders: [
{ test: /(.+)\.js$/, loader: 'babel-loader?blacklist=useStrict' }
]
}
};
Loading

0 comments on commit a286c76

Please sign in to comment.