Skip to content

Commit 7039ea4

Browse files
committed
chore(build): add version task
1 parent b868584 commit 7039ea4

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

Gruntfile.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ module.exports = function(grunt) {
1919
}
2020
},
2121

22+
version: {
23+
dist: {
24+
dest: 'dist/version.json'
25+
}
26+
},
27+
2228
copy: {
2329
dist: {
2430
files: [{
@@ -150,7 +156,8 @@ module.exports = function(grunt) {
150156
'concat',
151157
'copy',
152158
'uglify',
153-
'string-replace'
159+
'string-replace',
160+
'version'
154161
]);
155162

156163
grunt.registerMultiTask('karma', 'Run karma', function() {
@@ -171,4 +178,19 @@ module.exports = function(grunt) {
171178
done();
172179
});
173180
});
181+
182+
grunt.registerMultiTask('version', 'Generate version JSON', function() {
183+
var pkg = grunt.config('pkg');
184+
this.files.forEach(function(file) {
185+
var dest = file.dest;
186+
var d = new Date();
187+
var version = {
188+
version: pkg.version,
189+
codename: pkg.codename,
190+
date: grunt.template.today('yyyy-mm-dd'),
191+
time: d.getUTCHours() + ':' + d.getUTCMinutes() + ':' + d.getUTCSeconds()
192+
};
193+
grunt.file.write(dest, JSON.stringify(version, null, 2));
194+
});
195+
});
174196
};

scripts/cdn/publish.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ function run {
3333
cd $VERSION_DIR
3434
cp -R $BUILD_DIR/* $VERSION_DIR
3535

36-
# Create a version.txt file with the version and codename
37-
echo "$VERSION $CODENAME" > version.txt
38-
3936
echo "-- Generating versions.json..."
4037
cd $IONIC_CODE_DIR/builder
4138
python ./generate.py > /dev/null

0 commit comments

Comments
 (0)