From 5c79a0d3140a064d2bae13ae077fa0bc61452413 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 31 Jul 2020 10:19:17 +0200 Subject: [PATCH] cli: just print warning if postpack fails --- packages/cli/src/commands/pack.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/pack.ts b/packages/cli/src/commands/pack.ts index 1f81b89767..58efece6e4 100644 --- a/packages/cli/src/commands/pack.ts +++ b/packages/cli/src/commands/pack.ts @@ -39,5 +39,12 @@ export const pre = async () => { export const post = async () => { // postpack isn't called by yarn right now, so it needs to be called manually - await fs.move(PKG_BACKUP_PATH, PKG_PATH, { overwrite: true }); + try { + await fs.move(PKG_BACKUP_PATH, PKG_PATH, { overwrite: true }); + } catch (error) { + console.warn( + `Failed to restore package.json during postpack, ${error}. ` + + 'Your package will be fine but you may have ended up with some garbage in the repo.', + ); + } };