twolfson / grunt-zip

Zip and unzip files via a grunt plugin
MIT License
87 stars 19 forks source link

Using this without typing into cmd: grunt zip #49

Closed AliOsseili closed 6 years ago

AliOsseili commented 6 years ago

As the title says, how can I make it so all I have to do is type: grunt and it will find zip as a task to do in my gruntfile, because when I do that it doesn't even detect it at all and pretends its not there, here's what I got: const os = require('os'); module.exports = function(grunt) { require('load-grunt-tasks')(grunt);

grunt.initConfig({
    'electron-packager': {
        build: {
            options:{
                platform        : os.platform(),
                arch            : os.arch(),
                dir             : '.',
                out             : './build',
                name            : 'nameOfProgram',
                electronVersion : '1.8.2',
                ignore          : './build',
                asar      : false,
                overwrite : true                    
            }
        },
        compress: {
        //default:{
            options: {
              archive: 'archive.zip'
        },
            files: [{
              expand: true,
              cwd: 'build/',
              src: ['**/*'],
              dest: 'ZipHere/'
            }]
         // },
        },
        zip: {
            'long-format': {
                src: ['build/**'],
                dest: 'ZipHere/zipme.zip'
            },
        }           
    }

});
grunt.loadNpmTasks('grunt-electron-packager');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-zip');
grunt.registerTask('default', ['electron-packager']);

};

twolfson commented 6 years ago

Grunt can run tasks directly when specified via the CLI like:

grunt zip

We can also define the default task via registerTask('default')

grunt
# Same as: grunt default

We can add more tasks to a registerTask() via:

 grunt.registerTask('default', ['compress', 'zip', 'electron-packager']);