Reputation: 39088
I've altered my package.json scripts as follows (suggested by this post and this one). It works and does what's expected.
...
"deploy": "ng build && echo Do not forget to copy web.config!", ...
Then, I tried to substitute the echoing into actually copying a file like this.
...
"deploy": "ng build && copy ./src/web.config ./dist", ...
However, this fails with the error below.
''copy' is not recognized as an internal or external command, operable program or batch file.
I know that I can resolve this task by Grunting or Gulping but I'd like to keep it simple and see if it's possible. Is it?
I've tried to surround the paths with apostrophes and even running the copy command as a single command of the script. No luck.
Upvotes: 1
Views: 692
Reputation: 2904
copy
is not a valid bash command. Try using cp
instead.
You can write a nodejs script that just copies that file.
copy.js
var fs = require('fs');
fs.createReadStream('./src/web.config')
.pipe(fs.createWriteStream('./dist/web.config'));
...
"deploy": "ng build && node run ./copy.js .
I got it running using M$-DOS COPY
. It also works using PowerShell using Copy-Item
.
Don't forget you have to use backslashes on M$, which you also need to escape.
"deploy": "COPY .\\a\\test .\\b\\test"
or
"deploy": "Copy-Item .\\a\\test .\\b\\test"
Upvotes: 2