0
0

More than 3 years have passed since last update.

プロジェクトルートで「yarn」を使用し、下位フォルダのpackage.jsonをまとめて実行する

Posted at

■ディレクトリ構成

root
 |-package.json
 |-dir1
    |-package.json
 |-dir2
    |-package.json
 |-dir3
    |-package.json

■ルートディレクトリの「package.json」

下位フォルダの「package.json」を実行する場合、「prefix」オプションが使用できます。

package.json
{
  "scripts": {
    "dev": "run-p dev:*",
    "dev:dir1": "npm run dev --prefix dir1",
    "dev:dir2": "npm run dev --prefix dir2",
    "dev:dir3": "npm run dev --prefix dir3"
}

■ルートでコマンド実行

下記で dir1 & dir2 & dir3 配下の package.json が並列で実行されます。

yarn dev

■関連

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