0

grunt-contrib-compressを使用して展開パッケージを圧縮しています。私は次の設定を持っています:

//  Zip up the distribution folder and give it a build name. The folder can then be uploaded to the Chrome Web Store.
grunt.registerTask('compress-extension', 'compress the files which are ready to be uploaded to the Chrome Web Store into a .zip', function () {

    //  There's no need to cleanup any old version because this will overwrite if it exists.
    grunt.config.set('compress', {
        dist: {
            options: {
                archive: 'Streamus v' + grunt.option('version') + '.zip'
            },
            files: [{
                src: ['dist/**'],
                dest: '',
            }]
        }
    });

    grunt.task.run('compress');
});

これにより、回避したいディレクトリ構造のレベルが 1 つ追加されます。圧縮後、構造は次のようになります。

'Streamus v0.xxx.zip' -> 'dist' -> '[sub directories]'

そして私はちょうど望んでいます:

'Streamus v0.xxx.zip' -> '[sub directories]'

これを行うための最も簡単な方法は何ですか? 圧縮の「ファイル」構成セクションでその欲求を表現できますか? 多分平らにしますか?

4

1 に答える 1

0

ああなるほど。「cwd」を除外するフォルダーに設定し、「src」に新しい cwd を考慮に入れると、必要に応じて機能します。

//  Zip up the distribution folder and give it a build name. The folder can then be uploaded to the Chrome Web Store.
grunt.registerTask('compress-extension', 'compress the files which are ready to be uploaded to the Chrome Web Store into a .zip', function () {

    //  There's no need to cleanup any old version because this will overwrite if it exists.
    grunt.config.set('compress', {
        dist: {
            options: {
                archive: 'Streamus v' + grunt.option('version') + '.zip'
            },
            files: [{
                src: ['**'],
                dest: '',
                cwd: 'dist/',
                expand: true
            }]
        }
    });

    grunt.task.run('compress');
});
于 2014-02-13T17:14:16.767 に答える