Grunt Octopack

So, I have a front end project that uses Grunt to compiles less and handlebar templates, and then puts them into a “dist” folder in the root of the project.

e.g.

  • dist
    • css
      • main.css
    • js
      • main.js
    • index.html

I then use Octopack to package up the files in the dist folder. All goes well, but the package also includes the dist folder. Is there a way to tell octopack to just include the files and folder in the dist folder? I’ve included the task below.

“octo-pack”: {
prod: {
options: {
version: grunt.option(‘build’),
type: ‘zip’,
dst: ‘./bin’
},
cwd: ‘dist’,
expand: true,
src: ‘**/*’
}
}

Many thanks
Jon

Hi Jon,
Its great to hear that you have been integrating Octopus Deploy with your project. As outlined in the grunt-octo readme you should be able to define a src parameter in the configuration that includes a glob to specify which files to include. In the config you provided i can see that you are specifying src: **/* which means include everything, however if you want just one directory you should be able to specify something like src: './dist/**/*' Have you given this a try and had it not succeed?
If so perhaps you have found a bug.
Looking forward to your reply,
Cheers
Robert

Hi Rob

Thanks for that, but I specified cwd: 'dist', expand: true, src: '**/*' , which in this case, is the same as writing src: 'dist/**/*' (I’ve tried both ways).

Also, src: './dist/**/*', actually creates a package with the root folder of “.” and then a containing folder of “dist”, and then the files I need.

What I’m looking for, is there to be no containing “dist” folder in the package, just the contents of it.

Cheers
Jon

Hi Jon,
Thanks for the clarification, I can now see what the problem is. The grunt-octo modules currently does not support the dynamic file list feature provided by grunt. It currently just uses the src property directly to find the files to include into the package using the glob pattern. That being said this project is open source so feel free to have a deeper look into how it works and issue a pull request if you feel you can contribute to provide better functionality.
I’m sorry this isn’t the response you were probably hoping to hear, so please let me know if there’s anything else I can do to help get your deployments back on track.
Cheers,
Robert