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' }); + } +}