paulmelnikow / rollup-plugin-cpy

Rollup plugin to easily copy files and folders
MIT License
7 stars 1 forks source link

Mkdirp Does not Consider CWD #112

Open bigtimebuddy opened 3 years ago

bigtimebuddy commented 3 years ago

Was having issues with this line with this plugin trying to run mkdirp. Here's the offending line: https://github.com/paulmelnikow/rollup-plugin-cpy/blob/master/src/index.js#L28

Example

copy({
  files: "**/*.png",
  dest: '../dist',
  options: {
    cwd: path.join(__dirname, 'src'),
    parents: true
  }
});

This is trying to copy all images in src and copy them to dist, but maintaining the folder structure. The directory that should be created is resolve(dest, options.cwd) not dest. In this case, the plugin with create a folder one directory above, but cpy will copy fine. Maybe this mkdirp isn't even needed here since it seems to be handled by cpy.