mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Merge remote-tracking branch 'upstream/master'
Conflicts: Gruntfile.js
This commit is contained in:
122
Gruntfile.js
122
Gruntfile.js
@@ -36,6 +36,10 @@ module.exports = function(grunt) {
|
||||
};
|
||||
|
||||
grunt.initConfig({
|
||||
clean: {
|
||||
before: ['dest'],
|
||||
after: ['build/closure/closure_compiled_binary.js']
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
indent:2,
|
||||
@@ -60,12 +64,39 @@ module.exports = function(grunt) {
|
||||
base : '.',
|
||||
port : 4321
|
||||
}
|
||||
}
|
||||
},
|
||||
express: {
|
||||
regular: {
|
||||
options: {
|
||||
port: 9001,
|
||||
hostname : 'localhost',
|
||||
bases: ['dest']
|
||||
}
|
||||
},
|
||||
serve : {
|
||||
options : {
|
||||
base : '.',
|
||||
port : 1234,
|
||||
keepalive : true
|
||||
debug: {
|
||||
options: {
|
||||
port: 9901,
|
||||
hostname : 'localhost',
|
||||
bases: ['src']
|
||||
}
|
||||
}
|
||||
},
|
||||
open : {
|
||||
regular : {
|
||||
path : 'http://localhost:9001/'
|
||||
},
|
||||
debug : {
|
||||
path : 'http://localhost:9901/?debug'
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
scripts: {
|
||||
files: ['src/**/*.*'],
|
||||
tasks: ['merge'],
|
||||
options: {
|
||||
spawn: false
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -79,11 +110,11 @@ module.exports = function(grunt) {
|
||||
separator : ';'
|
||||
},
|
||||
src : piskelScripts,
|
||||
dest : 'build/piskel-packaged.js'
|
||||
dest : 'dest/js/piskel-packaged.js'
|
||||
},
|
||||
css : {
|
||||
src : piskelStyles,
|
||||
dest : 'build/piskel-style-packaged.css'
|
||||
dest : 'dest/css/piskel-style-packaged.css'
|
||||
}
|
||||
},
|
||||
uglify : {
|
||||
@@ -92,10 +123,20 @@ module.exports = function(grunt) {
|
||||
},
|
||||
my_target : {
|
||||
files : {
|
||||
'build/piskel-packaged-min.js' : ['build/piskel-packaged.js']
|
||||
'dest/js/piskel-packaged-min.js' : ['dest/js/piskel-packaged.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
main: {
|
||||
files: [
|
||||
{src: ['src/piskel-boot.js'], dest: 'dest/piskel-boot.js'},
|
||||
{src: ['src/js/lib/iframeLoader.js'], dest: 'dest/js/lib/iframeLoader.js'},
|
||||
{expand: true, src: ['img/**'], cwd: 'src/', dest: 'dest/', filter: 'isFile'},
|
||||
{expand: true, src: ['**/*.html'], cwd: 'src/', dest: 'dest/', filter: 'isFile'}
|
||||
]
|
||||
}
|
||||
},
|
||||
closureCompiler: {
|
||||
options: {
|
||||
// [REQUIRED] Path to closure compiler
|
||||
@@ -146,26 +187,18 @@ module.exports = function(grunt) {
|
||||
|
||||
// This generated JS binary is currently not used and even excluded from source control using .gitignore.
|
||||
dest: 'build/closure/closure_compiled_binary.js'
|
||||
},
|
||||
}
|
||||
},
|
||||
nodewebkit: {
|
||||
options: {
|
||||
build_dir: './build', // Where the build version of my node-webkit app is saved
|
||||
mac: true,
|
||||
win: true,
|
||||
linux32: true,
|
||||
linux64: true
|
||||
},
|
||||
src: ['./**/*']
|
||||
},
|
||||
copy: {
|
||||
desktop: {
|
||||
files: [
|
||||
{expand: true, cwd: "build/", src: ['*'], dest: 'desktop/build/', filter: 'isFile'},
|
||||
{expand: true, cwd: "src/", src: ['**'], dest: 'desktop/'},
|
||||
]
|
||||
}
|
||||
}
|
||||
options: {
|
||||
build_dir: './dest', // Where the build version of my node-webkit app is saved
|
||||
mac: true,
|
||||
win: true,
|
||||
linux32: true,
|
||||
linux64: true
|
||||
},
|
||||
src: ['./**/*']
|
||||
}
|
||||
});
|
||||
|
||||
grunt.config.set('leadingIndent.indentation', 'spaces');
|
||||
@@ -179,12 +212,17 @@ module.exports = function(grunt) {
|
||||
src: ['src/css/**/*.css']
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-closure-tools');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-express');
|
||||
grunt.loadNpmTasks('grunt-ghost');
|
||||
grunt.loadNpmTasks('grunt-open');
|
||||
grunt.loadNpmTasks('grunt-leading-indent');
|
||||
grunt.loadNpmTasks('grunt-node-webkit-builder');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
@@ -193,23 +231,27 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('lint', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint']);
|
||||
|
||||
// Validate & Test
|
||||
grunt.registerTask('test', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'compile', 'connect:test', 'ghost:default']);
|
||||
grunt.registerTask('test', ['lint', 'compile', 'connect:test', 'ghost:default']);
|
||||
|
||||
// Validate & Test (faster version) will NOT work on travis !!
|
||||
grunt.registerTask('precommit', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'compile', 'connect:test', 'ghost:local']);
|
||||
grunt.registerTask('precommit', ['lint', 'compile', 'connect:test', 'ghost:local']);
|
||||
|
||||
// Compile JS code (eg verify JSDoc annotation and types, no actual minified code generated).
|
||||
grunt.registerTask('compile', ['closureCompiler:compile']);
|
||||
grunt.registerTask('compile', ['closureCompiler:compile', 'clean:after']);
|
||||
|
||||
grunt.registerTask('merge', ['concat:js', 'concat:css', 'uglify']);
|
||||
grunt.registerTask('merge', ['concat:js', 'concat:css', 'uglify', 'copy']);
|
||||
|
||||
// Validate & Build
|
||||
grunt.registerTask('default', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'concat:js', 'concat:css', 'compile', 'uglify']);
|
||||
grunt.registerTask('default', ['clean:before', 'lint', 'compile', 'merge']);
|
||||
|
||||
// Start webserver
|
||||
grunt.registerTask('serve', ['connect:serve']);
|
||||
|
||||
// Build stand alone app with nodewebkit
|
||||
grunt.registerTask('desktop', ['compile', 'merge', 'copy:desktop', 'nodewebkit']);
|
||||
|
||||
grunt.registerTask('desktop', ['default', 'nodewebkit']);
|
||||
|
||||
grunt.registerTask('server', ['merge', 'express:regular', 'open:regular', 'express-keepalive']);
|
||||
|
||||
// Start webserver and watch for changes
|
||||
grunt.registerTask('server:watch', ['server', 'watch']);
|
||||
|
||||
// Start webserver on src folder, in debug mode
|
||||
grunt.registerTask('server:debug', ['express:debug', 'open:debug', 'express-keepalive']);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user