0
0

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 3 years have passed since last update.

npm scriptのwatchで複数タスクを実行する方法

Last updated at Posted at 2021-12-08

概要

npm-run-allを使わない方法。
watchでビルドした後に自動でデプロイしたい。

方法

watch-deployでwatchして、複数の処理を&&で繋いでワンライナーで実行する。

; でコマンドを連結する場合、コマンド1がエラーであっても、次のコマンドが実行されるが、
&& で連結した場合はエラーが起きた時点で動作が停止する。

&&の代わりに&にすると並列処理になるらしい。

 package.json
  "scripts": {
    "build": "【ビルド処理】",
    "deploy": "【デプロイ処理】",
     "watch-deploy": "watch 'npm run build && npm run deploy' ./components",
   }
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?