11
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

npm package.json でファイルコピーする時 cpx 使わなくてもいい

Posted at

知ってた?

Mac も Windows も共通でファイルコピーするために
cpx
なんてインストールしなくてよかったんだよ。

node にスクリプトを直接流し込める

次のようにして、copyFileSync 呼べばいい。

package.json
{
  "scripts": {
    "filecopy": "node -e \"require('fs').copyFileSync('./a.txt', './b.txt')\""
  }
}

参考

cpx がリネームしてくれないので、なんとかならないかと調べていたらみつけた。

javascript - Rename file with NPM - Stack Overflow
https://stackoverflow.com/questions/35258871/rename-file-with-npm

11
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?