Skip to content

Commit 1df9f51

Browse files
youknowriadmcsf
andcommitted
Small tweak to restoring package.json
Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com>
1 parent e8a0aa5 commit 1df9f51

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tools/gutenberg/build-gutenberg.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,11 @@ async function main() {
156156
console.log( `✅ Build completed in ${ duration }s` );
157157
} catch ( error ) {
158158
console.error( '❌ Build failed:', error.message );
159-
// Restore package.json even on failure
159+
throw error;
160+
} finally {
161+
// Restore Gutenberg's package.json regardless of success or failure
160162
await restorePackageJson();
161-
process.exit( 1 );
162163
}
163-
164-
// Restore Gutenberg's package.json after successful build
165-
await restorePackageJson();
166164
}
167165

168166
/**
@@ -171,7 +169,7 @@ async function main() {
171169
async function restorePackageJson() {
172170
console.log( '\n🔄 Restoring Gutenberg package.json...' );
173171
try {
174-
await exec( 'git', [ 'checkout', 'package.json' ], {
172+
await exec( 'git', [ 'checkout', '--', 'package.json' ], {
175173
cwd: gutenbergDir,
176174
} );
177175
console.log( '✅ package.json restored' );

0 commit comments

Comments
 (0)