diff --git a/.gitignore b/.gitignore index f5dbdb6..707bc01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea .DS_Storecss/*.map node_modules -dist \ No newline at end of file +dist +extension.zip \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 03ed8b4..34f1167 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -29,16 +29,67 @@ module.exports = function (grunt) { "oc_requesttoken": true } }, - all: ['js/*','!js/vendor'] + all: ['js/*', '!js/vendor'] + }, + mkdir: { + dist: { + options: { + mode: 0700, + create: ['dist'] + } + } + }, + copy: { + dist: { + src: [ + '**', + '!style/*/**/*', + '!style/*', + '!style', + '!node_modules/*', + '!node_modules/**', + '!dist/**', + '!dist/*', + '!.drone.yml', + '!.gitignore', + '!.jshintrc', + '!.scrutinizer.yml', + '!.travis.yml', + '!Gruntfile.js', + '!karma.conf.js', + '!launch_phpunit.sh', + '!Makefile', + '!package.json', + '!phpunit.*', + '!Dockerfile', + '!*.md', + '!*.zip', + '!swagger.yaml' + ], + dest: 'dist/' + } + }, + compress: { + dist: { + options: { + archive: 'extension.zip' + }, + files: [ + {src: ['**'], dest: '.', cwd: 'dist/'}, // includes files in path + ] + } } - }); + grunt.loadNpmTasks('grunt-mkdir'); + grunt.loadNpmTasks('grunt-contrib-compress'); + grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-jshint'); // Default task(s). grunt.registerTask('hint', ['jshint']); + grunt.registerTask('dist', ['jshint', 'mkdir:dist', 'copy:dist', 'compress:dist']); }; \ No newline at end of file diff --git a/package.json b/package.json index 3a52ac5..5130a47 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "jshint-stylish": "^2.2.1" }, "devDependencies": { + "grunt-contrib-compress": "^1.4.1", "grunt-contrib-copy": "^1.0.0", "grunt-mkdir": "^1.0.0" },