From 2494ca9a6a6f1dce8110de79224cd0ded0d23130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Kire=C3=A7lig=C3=B6l?= Date: Thu, 19 Sep 2024 19:21:39 +0300 Subject: [PATCH] chore: optimize build (#138) --- package.json | 2 +- scripts/build.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 scripts/build.js diff --git a/package.json b/package.json index fd7fd09..e56f6aa 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "scripts": { "lint": "eslint . --ext .ts,.tsx,.js --cache --cache-strategy content", "format": "yarn lint --fix", - "build": "yarn workspaces run build", + "build": "node ./scripts/build.js", "test": "yarn workspaces run test", "pack": "yarn workspaces run pack" }, diff --git a/scripts/build.js b/scripts/build.js new file mode 100644 index 0000000..4b4ce1d --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,15 @@ +const { execSync } = require('child_process'); + +const workspaces = JSON.parse( + execSync('yarn workspaces info --json').toString() +); + +const workspaceNames = Object.keys(workspaces); + +for (const workspaceName of workspaceNames) { + // don't build example workspaces + if (!workspaceName.includes('example-')) { + // run build for this workspace + execSync(`yarn workspace ${workspaceName} build`, { stdio: 'inherit' }); + } +}