Skip to content

Commit 24c12c0

Browse files
committed
chore(build): automate release process
1 parent 2d1b71c commit 24c12c0

14 files changed

+734
-71
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
# Tabs in JS unless otherwise specified
13+
[**.js]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
node_modules
33
*.sw[mnpcod]
4+
*.log
45
example/cordova/iOS/www/js/framework
56

67
example/cordova/iOS/www/js/framework
@@ -16,3 +17,4 @@ UserInterfaceState.xcuserstate
1617

1718
bower_components/
1819
components/
20+
tmp

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ before_script:
66
- npm install -g grunt-cli
77
- export DISPLAY=:99.0
88
- sh -e /etc/init.d/xvfb start
9+
10+
script:
11+
- ./scripts/travis/ci.sh

Gruntfile.js

+68-42
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,50 @@
1+
var cp = require('child_process');
2+
var buildConfig = require('./config/build');
3+
14
module.exports = function(grunt) {
25

36
grunt.initConfig({
7+
48
concat: {
59
options: {
610
separator: ';\n'
711
},
812
dist: {
9-
src: [
10-
'js/_license.js',
11-
12-
// Base
13-
'js/ionic.js',
14-
15-
// Utils
16-
'js/utils/**/*.js',
17-
18-
// Views
19-
'js/views/view.js',
20-
21-
'js/views/scrollView.js',
22-
23-
'js/views/actionSheetView.js',
24-
'js/views/checkboxView.js',
25-
'js/views/headerBarView.js',
26-
'js/views/listView.js',
27-
'js/views/ListViewScroll.js',
28-
'js/views/loadingView.js',
29-
'js/views/modalView.js',
30-
'js/views/navBarView.js',
31-
'js/views/popupView.js',
32-
'js/views/sideMenuView.js',
33-
'js/views/sliderView.js',
34-
'js/views/tabBarView.js',
35-
'js/views/toggleView.js',
36-
37-
// Controllers
38-
'js/controllers/viewController.js',
39-
40-
'js/controllers/navController.js',
41-
'js/controllers/sideMenuController.js',
42-
'js/controllers/tabBarController.js'
43-
44-
],
13+
src: buildConfig.files,
4514
dest: 'dist/js/ionic.js'
4615
},
4716
distAngular: {
48-
src: [
49-
'js/_license.js',
50-
'js/ext/angular/src/ionicAngular.js',
51-
'js/ext/angular/src/service/**/*.js',
52-
'js/ext/angular/src/directive/**/*.js'
53-
],
17+
src: buildConfig.angularFiles,
5418
dest: 'dist/js/ionic-angular.js'
5519
}
5620
},
21+
5722
jshint: {
5823
files: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js'],
5924
options: {
6025
jshintrc: '.jshintrc'
6126
}
6227
},
28+
29+
karma: {
30+
options: {
31+
configFile: 'config/karma.conf.js'
32+
},
33+
single: {
34+
options: {
35+
singleRun: true
36+
}
37+
},
38+
sauce: {
39+
options: {
40+
singleRun: true,
41+
configFile: 'config/karma-sauce.conf.js'
42+
}
43+
},
44+
watch: {
45+
}
46+
},
47+
6348
uglify: {
6449
dist: {
6550
files: {
@@ -71,20 +56,23 @@ module.exports = function(grunt) {
7156
preserveComments: 'some'
7257
}
7358
},
59+
7460
sass: {
7561
dist: {
7662
files: {
7763
'dist/css/ionic.css': 'scss/ionic.scss',
7864
}
7965
}
8066
},
67+
8168
cssmin: {
8269
dist: {
8370
files: {
8471
'dist/css/ionic.min.css': 'dist/css/ionic.css',
8572
}
8673
}
8774
},
75+
8876
'string-replace': {
8977
version: {
9078
files: {
@@ -103,6 +91,16 @@ module.exports = function(grunt) {
10391
}
10492
}
10593
},
94+
95+
bump: {
96+
options: {
97+
files: ['package.json'],
98+
commit: false,
99+
createTag: false,
100+
push: false
101+
}
102+
},
103+
106104
watch: {
107105
scripts: {
108106
files: ['js/**/*.js', 'ext/**/*.js'],
@@ -119,17 +117,45 @@ module.exports = function(grunt) {
119117
}
120118
}
121119
},
120+
122121
pkg: grunt.file.readJSON('package.json')
123122
});
124123

125124
require('load-grunt-tasks')(grunt);
126125

127126
grunt.registerTask('default', [
127+
'enforce',
128128
'jshint',
129129
'sass',
130130
'cssmin',
131131
'concat',
132132
'uglify',
133133
'string-replace'
134134
]);
135+
136+
grunt.registerMultiTask('karma', 'Run karma', function() {
137+
var done = this.async();
138+
var options = this.options();
139+
var config = options.configFile;
140+
var browsers = grunt.option('browsers');
141+
var singleRun = grunt.option('singleRun') || options.singleRun;
142+
var reporters = grunt.option('reporters');
143+
144+
cp.spawn('node', ['node_modules/karma/bin/karma', 'start', config,
145+
browsers ? '--browsers=' + browsers : '',
146+
singleRun ? '--single-run=' + singleRun : '',
147+
reporters ? '--reporters=' + reporters : ''
148+
], { stdio: 'inherit' })
149+
.on('exit', function(code) {
150+
if (code) return grunt.fail.warn('Karma test(s) failed. Exit code: ' + code);
151+
done();
152+
});
153+
});
154+
155+
grunt.registerTask('enforce', 'Install commit message enforce script if it doesn\'t exist', function() {
156+
if (!grunt.file.exists('.git/hooks/commit-msg')) {
157+
grunt.file.copy('scripts/validate-commit-msg.js', '.git/hooks/commit-msg');
158+
require('fs').chmodSync('.git/hooks/commit-msg', '0755');
159+
}
160+
});
135161
};

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,25 @@ way is to use Python:
8383
+ <https://twitter.com/adamdbradley>
8484
+ <https://github.com/adamdbradley>
8585

86+
## Development
87+
88+
* `npm install` to setup
89+
* `grunt` to jshint & build
90+
* `grunt karma:single` to test one-time
91+
* `grunt karma:watch` to test and re-run on source change
92+
* Additionally, a commit message validator is installed for this repository when running `grunt`. Read about it [here](https://github.com/ajoslin/conventional-changelog/blob/master/CONVENTIONS.md).
93+
94+
### Pushing Releases
95+
96+
(uses AngularJS's bash utils)
97+
98+
* Run `./scripts/release/finalize-version.sh --action=prepare` to:
99+
- Remove version suffix
100+
- Write new version to package/bower/component.json
101+
- Commit & tag the release
102+
* Run `./scripts/release/finalize-version.sh --action=publish` to:
103+
- Push out new version
104+
* Once new version is pushed out, run `./scripts/release/initialize-new-version.sh` (usage is shown in file), to bump to next version with bump type / version suffix / version name specified.
86105

87106
## LICENSE
88107

config/build.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
module.exports = {
2+
files: [
3+
'js/_license.js',
4+
5+
// Base
6+
'js/ionic.js',
7+
8+
// Utils
9+
'js/utils/**/*.js',
10+
11+
// Views
12+
'js/views/view.js',
13+
14+
'js/views/scrollView.js',
15+
16+
'js/views/actionSheetView.js',
17+
'js/views/headerBarView.js',
18+
'js/views/listView.js',
19+
'js/views/loadingView.js',
20+
'js/views/modalView.js',
21+
'js/views/navBarView.js',
22+
'js/views/popupView.js',
23+
'js/views/sideMenuView.js',
24+
'js/views/sliderView.js',
25+
'js/views/tabBarView.js',
26+
'js/views/toggleView.js',
27+
28+
// Controllers
29+
'js/controllers/viewController.js',
30+
31+
'js/controllers/navController.js',
32+
'js/controllers/sideMenuController.js',
33+
'js/controllers/tabBarController.js'
34+
35+
],
36+
angularFiles: [
37+
'js/_license.js',
38+
'js/ext/angular/src/ionicAngular.js',
39+
'js/ext/angular/src/service/**/*.js',
40+
'js/ext/angular/src/directive/**/*.js'
41+
]
42+
};

config/karma-sauce.conf.js

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
module.exports = function(config) {
3+
require('./karma.conf.js')(config);
4+
5+
//username: angular-bootstrap
6+
//password: password
7+
config.set({
8+
sauceLabs: {
9+
testName: 'ionic',
10+
username: 'ionic-test',
11+
accessKey: '59373b3d-1ee5-43b9-8df4-31107bd21e57',
12+
startConnect: true,
13+
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
14+
},
15+
//Saucelabs mobile emulation (esp android emulator)
16+
//can be really slow sometimes, we need to give it time to connectk
17+
captureTimeout: 60 * 1000,
18+
browserDisconnectTimeout: 60 * 1000,
19+
browserNoActivityTimeout: 60 * 1000,
20+
browserDisconnectTolerance: 2,
21+
transports: ['xhr-polling'],
22+
browsers: [
23+
// 'sauce_ios',
24+
'sauce_safari',
25+
// 'sauce_android',
26+
'sauce_chrome',
27+
'sauce_firefox',
28+
// 'sauce_ie9',
29+
// 'sauce_ie10',
30+
// 'sauce_ie11'
31+
],
32+
customLaunchers: {
33+
'sauce_ios': {
34+
base: 'SauceLabs',
35+
platform: 'OS X 10.9',
36+
browserName: 'iphone',
37+
version: '7'
38+
},
39+
'sauce_safari': {
40+
base: 'SauceLabs',
41+
browserName: 'safari',
42+
platform: 'OS X 10.9',
43+
version: '7'
44+
},
45+
'sauce_android': {
46+
base: 'SauceLabs',
47+
platform: 'Linux',
48+
browserName: 'android',
49+
version: '4.0'
50+
},
51+
'sauce_chrome': {
52+
base: 'SauceLabs',
53+
browserName: 'chrome'
54+
},
55+
'sauce_firefox': {
56+
base: 'SauceLabs',
57+
platform: 'Linux',
58+
browserName: 'firefox',
59+
version: '26'
60+
}
61+
},
62+
});
63+
};

0 commit comments

Comments
 (0)