grunt-contrib-compress
grunt-contrib-compress copied to clipboard
Sometimes Generates Duplicate Files in Same Folder
I'm using grunt-contrib-compress as part of my build process to generate a ZIP file that contains all the files necessary for a website deployment. I was tinkering with a few settings, and I noticed this in one of the folders in the generated ZIP file:
The web.config file is in that folder twice. Keep in mind this is on a Windows machine, so (outside of a ZIP file) it's not even possible to have two files of the same name in the same folder, even if they have different casing (in this instance, the case is identical).
I'm using grunt-contrib-compress 1.4.3. Here's my configuration from my gruntfile.js:
compress: {
main: {
options: {
archive: "../dist/<%= config.projectName %>_" + currentDate() + ".zip"
},
files: [
{
src: [
"**/*",
"!*.csproj",
"!*.csproj.user",
"!Web.config",
"!web.config",
"!web.sample.config",
"**/media/Web.config",
"**/Views/Web.config",
"!unhandled-error-*.html",
"!unhandled-error-*.json",
"!Config/*.sample.config",
"!Config/umbracoSettings.config",
"!Properties/*.cs",
"!obj/**",
"!App_Data/TEMP/**",
"!App_Data/MediaIndexSet/**",
"!App_Data/Logs/**",
"!App_Data/cache/**",
"!App_Data/umbraco.config",
"!App_Data/Formulate/**",
"!App_Data/NuGetBackup/**",
"!media/*/**",
"!Media/*/**",
"!styles/*.css.map",
"!**/.gitignore",
"!**/Thumbs.db",
"!packages.config"
],
dest: "/",
expand: true,
cwd: "<%= config.projectDir %>/"
}
]
}
}
Note that if I change the line that says "**/media/Web.config"
to "**/Media/Web.config"
(i.e., I uppercased the "M"), the duplicate file is no longer there (i.e., it's just a single web.config). On the actual file system, the original folder has an uppercase "M". Note that I also tried adding both of those lines (i.e., both with uppercase and lowercase), and I still ended up with the duplicate web.config files.
Hi @Nicholas-Westby, I know this is a really old question. But, I am facing this error as well. Any way to resolve it?
I mentioned a workaround at the bottom of my original post.