mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(build): add version task
This commit is contained in:
24
Gruntfile.js
24
Gruntfile.js
@@ -19,6 +19,12 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
|
||||
version: {
|
||||
dist: {
|
||||
dest: 'dist/version.json'
|
||||
}
|
||||
},
|
||||
|
||||
copy: {
|
||||
dist: {
|
||||
files: [{
|
||||
@@ -150,7 +156,8 @@ module.exports = function(grunt) {
|
||||
'concat',
|
||||
'copy',
|
||||
'uglify',
|
||||
'string-replace'
|
||||
'string-replace',
|
||||
'version'
|
||||
]);
|
||||
|
||||
grunt.registerMultiTask('karma', 'Run karma', function() {
|
||||
@@ -171,4 +178,19 @@ module.exports = function(grunt) {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('version', 'Generate version JSON', function() {
|
||||
var pkg = grunt.config('pkg');
|
||||
this.files.forEach(function(file) {
|
||||
var dest = file.dest;
|
||||
var d = new Date();
|
||||
var version = {
|
||||
version: pkg.version,
|
||||
codename: pkg.codename,
|
||||
date: grunt.template.today('yyyy-mm-dd'),
|
||||
time: d.getUTCHours() + ':' + d.getUTCMinutes() + ':' + d.getUTCSeconds()
|
||||
};
|
||||
grunt.file.write(dest, JSON.stringify(version, null, 2));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -33,9 +33,6 @@ function run {
|
||||
cd $VERSION_DIR
|
||||
cp -R $BUILD_DIR/* $VERSION_DIR
|
||||
|
||||
# Create a version.txt file with the version and codename
|
||||
echo "$VERSION $CODENAME" > version.txt
|
||||
|
||||
echo "-- Generating versions.json..."
|
||||
cd $IONIC_CODE_DIR/builder
|
||||
python ./generate.py > /dev/null
|
||||
|
||||
Reference in New Issue
Block a user