From 83d2496351604cd64ce2addf0aa056db8d163c32 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Wed, 5 Apr 2023 13:44:35 +0100 Subject: [PATCH] continue deploying unstable packages even with an error --- test-packages/unstable-release/.eslintrc.cjs | 3 ++- test-packages/unstable-release/publish.js | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/test-packages/unstable-release/.eslintrc.cjs b/test-packages/unstable-release/.eslintrc.cjs index bc1f19a2b..79667c4c4 100644 --- a/test-packages/unstable-release/.eslintrc.cjs +++ b/test-packages/unstable-release/.eslintrc.cjs @@ -12,7 +12,8 @@ module.exports = { }, extends: ['eslint:recommended', 'plugin:prettier/recommended'], env: { - browser: true, + browser: false, + node: true, }, overrides: [ // node files diff --git a/test-packages/unstable-release/publish.js b/test-packages/unstable-release/publish.js index 84e11ee55..075787428 100644 --- a/test-packages/unstable-release/publish.js +++ b/test-packages/unstable-release/publish.js @@ -5,9 +5,25 @@ import { dirname } from 'path'; async function publish() { let publicWorkspaces = await listPublicWorkspaces(); + const errors = []; + for (let workspace of publicWorkspaces) { console.info(`Publishing ${workspace}`); - await execaCommand('npm publish --tag=unstable --verbose', { cwd: dirname(workspace) }); + try { + await execaCommand('npm publish --tag=unstable --verbose', { cwd: dirname(workspace) }); + } catch (err) { + console.info(`Publishing ${workspace} has failed. A full list of errors will be printed at the end of this run`); + errors.push(err); + continue; + } + + console.info(`Publishing ${workspace} completed successfully!`); + } + + if (errors.length) { + console.error('Errors were encountered while publishing these packages'); + errors.forEach(error => console.log(error.stderr)); + process.exit(1); } }