Skip to content

Commit b4e2867

Browse files
committed
chore(build): refactor update angular and run tests
1 parent eb20057 commit b4e2867

File tree

4 files changed

+102
-1
lines changed

4 files changed

+102
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ logs/*
22
!.gitkeep
33
node_modules/
44
tmp
5-
.DS_Store
5+
.DS_Store
6+
.idea

app/index-async.html.template

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<style>
6+
[ng-cloak] {
7+
display: none;
8+
}
9+
</style>
10+
<script>
11+
// include angular loader, which allows the files to load in any order
12+
@@NG_LOADER@@
13+
14+
// include a third-party async loader library
15+
/*!
16+
* $script.js v1.3
17+
* https://github.com/ded/script.js
18+
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
19+
* Follow our software http://twitter.com/dedfat
20+
* License: MIT
21+
*/
22+
!function(a,b,c){function t(a,c){var e=b.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){e[m]&&!/^c|loade/.test(e[m])||f||(e.onload=e[o]=null,f=1,c())},e.async=1,e.src=a,d.insertBefore(e,d.firstChild)}function q(a,b){p(a,function(a){return!b(a)})}var d=b.getElementsByTagName("head")[0],e={},f={},g={},h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange",p=function(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1};!b[m]&&b[n]&&(b[n](l,function r(){b.removeEventListener(l,r,j),b[m]="complete"},j),b[m]="loading");var s=function(a,b,d){function o(){if(!--m){e[l]=1,j&&j();for(var a in g)p(a.split("|"),n)&&!q(g[a],n)&&(g[a]=[])}}function n(a){return a.call?a():e[a]}a=a[k]?a:[a];var i=b&&b.call,j=i?b:d,l=i?a.join(""):b,m=a.length;c(function(){q(a,function(a){h[a]?(l&&(f[l]=1),o()):(h[a]=1,l&&(f[l]=1),t(s.path?s.path+a+".js":a,o))})},0);return s};s.get=t,s.ready=function(a,b,c){a=a[k]?a:[a];var d=[];!q(a,function(a){e[a]||d[k](a)})&&p(a,function(a){return e[a]})?b():!function(a){g[a]=g[a]||[],g[a][k](b),c&&c(d)}(a.join("|"));return s};var u=a.$script;s.noConflict=function(){a.$script=u;return this},typeof module!="undefined"&&module.exports?module.exports=s:a.$script=s}(this,document,setTimeout)
23+
24+
// load all of the dependencies asynchronously.
25+
$script([
26+
'lib/angular/angular.js',
27+
'lib/angular/angular-route.js',
28+
'js/app.js',
29+
'js/services.js',
30+
'js/controllers.js',
31+
'js/filters.js',
32+
'js/directives.js'
33+
], function() {
34+
// when all is done, execute bootstrap angular application
35+
angular.bootstrap(document, ['myApp']);
36+
});
37+
</script>
38+
<title>My AngularJS App</title>
39+
<link rel="stylesheet" href="css/app.css">
40+
</head>
41+
<body ng-cloak>
42+
<ul class="menu">
43+
<li><a href="#/view1">view1</a></li>
44+
<li><a href="#/view2">view2</a></li>
45+
</ul>
46+
47+
<div ng-view></div>
48+
49+
<div>Angular seed app: v<span app-version></span></div>
50+
51+
</body>
52+
</html>

scripts/test-all.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
function cleanUp() {
6+
kill $WEBSERVER_PID
7+
}
8+
9+
trap cleanUp EXIT
10+
11+
# Define reasonable set of browsers in case we are running manually from commandline
12+
if [[ -z "$BROWSERS" ]]
13+
then
14+
BROWSERS="Chrome"
15+
fi
16+
17+
if [[ -z "$BROWSERS_E2E" ]]
18+
then
19+
BROWSERS_E2E="Chrome"
20+
fi
21+
22+
ROOT_DIR=`dirname $0`/..
23+
24+
cd $ROOT_DIR
25+
npm install
26+
27+
./scripts/web-server.js > /dev/null &
28+
WEBSERVER_PID=$!
29+
30+
31+
./node_modules/karma/bin/karma start config/karma.conf.js --single-run --browsers $BROWSERS --reporters=dots --no-colors --no-color
32+
./node_modules/karma/bin/karma start config/karma-e2e.conf.js --browsers $BROWSERS_E2E --reporters=dots --no-colors --no-color

update-angular.sh renamed to scripts/update-angular.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ if [[ ! -e "$NG_BUILD_DIR/angular.js" ]]; then
55
exit 1
66
fi
77

8+
SCRIPT_DIR=$(dirname $0)
9+
ROOT_DIR=$SCRIPT_DIR/../
10+
VERSION=$(cat $NG_BUILD_DIR/version.txt)
11+
12+
cd $ROOT_DIR
13+
814
rm -fr app/lib/angular
915
mkdir app/lib/angular
1016
cp -r $NG_BUILD_DIR/* app/lib/angular
@@ -13,3 +19,13 @@ rm app/lib/angular/*.zip
1319
mv app/lib/angular/angular-mocks.js test/lib/angular
1420
mv app/lib/angular/angular-scenario.js test/lib/angular
1521
cp app/lib/angular/version.txt test/lib/angular
22+
23+
# Update the inlined angular-loader in app/index-async.html
24+
sed '/@@NG_LOADER@@/{
25+
s/@@NG_LOADER@@//g
26+
r app/lib/angular/angular-loader.min.js
27+
}' app/index-async.html.template > app/index-async.html
28+
29+
git add $ROOT_DIR/app
30+
git add $ROOT_DIR/test
31+
git commit -m "update(angular): bump to $VERSION"

0 commit comments

Comments
 (0)