Skip to content

Task lambda_package create empty zip #4

Closed
@jeromeheissler

Description

I try to run the task on my iMac the generated zip doesn't contain any sources.

I added this piece of code to see files that are added to the archive. And I see nothing.

zipArchive.on('entry', function(data)   {
  console.log(data);
 });

Next I change the install_location to a directory on the project root, all the files to be compressed are listed correctly. But the archive is corrupt.

var install_location = "./.tmp";

Finally I changed the script that copies the archive to wait for the copy before deleting, and everything works.

output.on('close', function () {
  mkdirp('./' + options.dist_folder, function (err) {
    fs.createReadStream(install_location + '/' + archive_name + '.zip').pipe(
      fs.createWriteStream('./' + options.dist_folder + '/' + archive_name + '.zip')
    ).on('close', function(){
      rimraf(install_location, function () {
        grunt.config.set('lambda_deploy.' + task.target + '.package',
            './' + options.dist_folder + '/' + archive_name + '.zip');
        grunt.log.writeln('Created package at ' + options.dist_folder + '/' + archive_name + '.zip');
        done(true);
      });
    });
  });
});

I'm a beginner with node js and grunt, there is there a problem in my configuration or worries with the task ?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions