Skip to content

Commit

Permalink
fix: add detailed error if workspace tools are missing
Browse files Browse the repository at this point in the history
Co-authored-by: Jerry Tsui <tiger.tsui@gmail.com>
  • Loading branch information
mattwebbio and peniqliotuv committed Mar 8, 2023
1 parent e191b59 commit a27d9db
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tarballs/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ export async function build(c: BuildConfig, options: {
if (yarnVersion === '1') {
await exec('yarn --no-progress --production --non-interactive', {cwd: c.workspace()})
} else {
await exec('yarn workspaces focus --production', {cwd: c.workspace()})
try {
await exec('yarn workspaces focus --production', {cwd: c.workspace()})
} catch (error: unknown) {
if (error instanceof Error && error.message.includes('Command not found')) {
throw new Error('Missing workspace tools. Run `yarn plugin import workspace-tools`.')
}

throw error
}
}
} else {
const lockpath = fs.existsSync(path.join(c.root, 'package-lock.json')) ?
Expand Down

0 comments on commit a27d9db

Please sign in to comment.