You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.9 KiB
JavaScript

module.exports = function(grunt) {
require('time-grunt')(grunt);
var config = require('./.credentials.json');
var branch = grunt.option('branch') || config.branch;
var email = grunt.option('email') || config.email;
var token = grunt.option('token') || config.token;
var ptr = grunt.option('ptr') ? true : config.ptr;
grunt.loadNpmTasks('grunt-screeps');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-file-append');
var current_date = new Date();
grunt.log.subhead('Task start: ' + current_date.toLocaleString())
grunt.log.writeln('Branch: ' + branch)
grunt.initConfig({
screeps: {
options: {
email: email,
token: token,
branch: branch,
ptr: ptr
},
dist: {
src: ['dist/*.js']
}
},
clean: {
'dist': ['dist']
},
copy: { // Copy all source files into the dist folder, flattening the folder structure
screeps: {
files: [{
expand: true,
cwd: 'src/',
src: '**',
dest: 'dist/',
filter: 'isFile',
rename: function (dest, src) {
return dest + src.replace(/\//g, '_');
}
}],
}
},
file_append: {
versioning: {
files: [
{
append: "\nglobal.SCRIPT_VERSION = " + current_date.getTime() + "\n",
input: 'dist/version.js'
}
]
}
},
})
grunt.registerTask('default', ['clean', 'copy:screeps', 'file_append:versioning', 'screeps']);
}