diff --git a/packages/ckeditor5-dev-release-tools/lib/utils/publishpackageonnpmcallback.js b/packages/ckeditor5-dev-release-tools/lib/utils/publishpackageonnpmcallback.js index 5eed5444c..ae48db06d 100644 --- a/packages/ckeditor5-dev-release-tools/lib/utils/publishpackageonnpmcallback.js +++ b/packages/ckeditor5-dev-release-tools/lib/utils/publishpackageonnpmcallback.js @@ -13,7 +13,6 @@ */ export default async function publishPackageOnNpmCallback( packagePath, taskOptions ) { const { tools } = await import( '@ckeditor/ckeditor5-dev-utils' ); - const { default: fs } = await import( 'fs-extra' ); try { await tools.shExec( `npm publish --access=public --tag ${ taskOptions.npmTag }`, { @@ -22,7 +21,7 @@ export default async function publishPackageOnNpmCallback( packagePath, taskOpti verbosity: 'error' } ); - await fs.remove( packagePath ); + // Do nothing if `npm publish` says "OK". We cannot trust anything npm says. } catch { // Do nothing if an error occurs. A parent task will handle it. } diff --git a/packages/ckeditor5-dev-release-tools/tests/utils/publishpackageonnpmcallback.js b/packages/ckeditor5-dev-release-tools/tests/utils/publishpackageonnpmcallback.js index 7141e8b0b..1afefa50a 100644 --- a/packages/ckeditor5-dev-release-tools/tests/utils/publishpackageonnpmcallback.js +++ b/packages/ckeditor5-dev-release-tools/tests/utils/publishpackageonnpmcallback.js @@ -62,18 +62,18 @@ describe( 'publishPackageOnNpmCallback()', () => { } ); } ); - it( 'should remove package directory after publishing on npm', () => { + // See: https://github.com/ckeditor/ckeditor5/issues/17322. + it( 'should not remove package directory after publishing on npm', async () => { const packagePath = '/workspace/ckeditor5/packages/ckeditor5-foo'; - return publishPackageOnNpmCallback( packagePath, { npmTag: 'nightly' } ) - .then( () => { - expect( fs.remove ).toHaveBeenCalledTimes( 1 ); - expect( fs.remove ).toHaveBeenCalledWith( packagePath ); - } ); + await publishPackageOnNpmCallback( packagePath, { npmTag: 'nightly' } ); + + expect( fs.remove ).not.toHaveBeenCalled(); } ); - it( 'should not remove a package directory and not throw error when publishing on npm failed with code 409', async () => { - vi.mocked( tools.shExec ).mockRejectedValue( new Error( 'code E409' ) ); + // See: https://github.com/ckeditor/ckeditor5/issues/17120 + it( 'should not remove a package directory and not throw error when publishing on npm failed', async () => { + vi.mocked( tools.shExec ).mockRejectedValue( new Error( 'I failed because I can' ) ); const packagePath = '/workspace/ckeditor5/packages/ckeditor5-foo';