Octo-pack including the dist folder

I am deploying an Angular app to Azure, using grunt and octo-pack. This is working and the package is uploaded to Octopus. However, the package includes the dist folder, so when Octopus deploys the package, instead of deploying the contents of the dist folder to the website root, it is adding a dist folder and deploying the files inside there.

Here is the grunt section:

‘octo-pack’: {
prod: {
options: {
dst: ‘./bin’
},
src: [‘dist/**/*’]
}
}

How can I only include the contents fo the dist folder?

Looking at the octo-pack code, I can see the problem. It adds the files to the package with the full source path. I have submitted a PR on GitHub that will add this essential functionality.

Hi Karl, thanks for reaching out.

The inability to remove top level directories from the package is indeed an issue. After talking with the team we decided to implement the Grunt cwd (current working directory) option as a way to allow packages to be built without including intermediate directories.

You can see how this works with the demo project at https://github.com/mcasperson/GruntOctoExample/blob/master/Gruntfile.js. The built in cwd option is used in the Gruntfile to indicate the base level that files should be included from.

If you get version 0.0.50 of grunt-octo you can take advantage of the cwd option.

Regards

Matt C

Thanks Matt,

Updated the octo-pack files as suggested and kick off a build…it doesn’t work.

I’ll investigate further when I am back in the office and get back to you.

Regards,

Karl

Hi Matt,

I set my grunt file as follows:

'octo-pack': {
  prod: {
    options: {
      dst: './bin'
    },
    cwd: 'dist',
    src: ['**/*']
  }
},

When I run publish, only the bower_components folder and contents are taken from the dist folder.

What have I missed?

Thanks in advance,

Karl

Hi Karl,

Can you please paste in the directory structure of the dist folder so I can reproduce the problem locally?

Hi,

I have attached the dist folder, but I removed the images to save on file size.

What do you want to do about the Pull Request I submitted?

Regards,

Karl

dist.zip (298 KB)

Hi Karl,

I’ve included the attached dist folder in a grunt project that I’ve checked into https://github.com/mcasperson/GruntTest. When I run grunt locally, which is set to pack the dist folder by default, the resulting zip file contains all the files.

Can you test the sample project and see if you get the same results?

Hi Matt,

So…this is embarrassing! I’m really sorry, I messed up!

I updated the npm package for grunt-octo, but on checking the package.json, I can see it was still using 0.0.49. I set it to 0.0.50 and ran ‘npm install’ and it all works as advertised!

Sorry to have wasted your time and thank you for your help and assistance.

Regards,

Karl

That’s no problem Karl.

If version 0.0.50 provides the functionality you need I’ll close the PR, but thanks for pointing out the original problem. I’m sure others will appreciate this new functionality.

Cheers
Matt C

Thank you Matt.

Kind regards,

Karl