-1

I am trying to copy some patched files from my config to the node modules. I want to maintain the directory path with the file.

For example:

I am running:

copyfiles -u 1 ./config/patches/ ./node_modules/

I expect the files in:

./config/patches/core/testing1/fix1.js
./config/patches/core/testing2/fix2.js

to look like this:

./node_modules/core/testing1/fix1.js
./node_modules/core/testing2/fix2.js

However, nothing is copied in

Decrypter
  • 2,784
  • 12
  • 38
  • 57

1 Answers1

3

Change your copyfiles command to either of the following depending on how/where it is being invoked:

  1. Running the command directly via your CLI:

    If the copyfiles package has been installed globally, then run the following command via your CLI:

    copyfiles -u 2 "./config/patches/core/**" "./node_modules/"
    
  2. Running the command via an npm-script

    If the copyfiles package has been installed locally, then configure the scripts section of your package.json as follows:

    ...
    "scripts": {
      "quux": "copyfiles -u 2 \"./config/patches/core/**\" \"./node_modules/\""
    },
    ...
    

Notes:

  • The -u option has been set to 2 levels.
  • The input path goes down the tree one more level to the core directory.
  • Double globstars (**) have also been appended to the input path.
  • Both the input and output paths have been escaped in double quotes to avoid expansion. When the command is used in JSON (i.e. an npm-script as per the second example) the double quotes will need to be escaped (i.e. \"...\").
RobC
  • 22,977
  • 20
  • 73
  • 80