Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packages: Publishing to npm fails for wp/X.Y branches because of older Node.js #53628

Closed
gziolo opened this issue Aug 14, 2023 · 4 comments · Fixed by #53762 or #54088
Closed

Packages: Publishing to npm fails for wp/X.Y branches because of older Node.js #53628

gziolo opened this issue Aug 14, 2023 · 4 comments · Fixed by #53762 or #54088
Assignees
Labels
npm Packages Related to npm packages [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@gziolo
Copy link
Member

gziolo commented Aug 14, 2023

Description

Additional context in #53565. While trying to manually publish WordPress packages to npm using the script executed from the local machine, I run into an error where npm ci failed because npm version set in trunk to be able to run the script doesn't meet the requirements for the branch where source code lives. In effect, the script bails out, and publishing isn't possible.

In effect, any backport to WordPress 6.3 and lower will fail from GitHub UI as explained:

https://github.com/WordPress/gutenberg/blob/trunk/docs/contributors/code/release.md#wordpress-releases

Everything should work correctly for WordPress 6.4, as the script and the future branch will use the same Node.js and npm versions.

Step-by-step reproduction instructions

I executed from trunk that is now on Node 16 and npm 8:

./bin/plugin/cli.js npm-latest --semver minor

It pulled changes from release/16.4 that was still on Node 14 and npm 6, so npm ci throws an error that it can finish when using npm 8.

The same issue will happen when trying to backport changes to WordPress core when using any of wp/X.Y branches that enforce usage of npm 6.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@gziolo gziolo added npm Packages Related to npm packages [Type] Bug An existing feature does not function as intended labels Aug 14, 2023
@gziolo
Copy link
Member Author

gziolo commented Aug 16, 2023

An example of npm publishing failure is logged in:

https://github.com/WordPress/gutenberg/actions/runs/5874702589/job/15929869480#step:8:409

Screenshot 2023-08-16 at 09 12 08

@gziolo
Copy link
Member Author

gziolo commented Aug 20, 2023

Unfortunately, it isn't work as expected. I missed the important part that are taken care by the Node.js script we use for all types of publishing – switching to the correct branch in the publish folder. More details in #53762 (comment).

@gziolo gziolo reopened this Aug 20, 2023
@gziolo
Copy link
Member Author

gziolo commented Aug 20, 2023

I think I set back all correct versions of packages on wp-6.3 dist-tag. At least I don’t see any changes reported when executing npx lerna updated on wp/6.3. For the record, I used the following command, e.g.:

npm dist-tag add @wordpress/wordcount@3.35.1 wp-6.3 --otp

I generated them from wp/6.3 with:

const { dependencies } = require( './package.json' );

for ( const name in dependencies ) {
	if ( ! name.startsWith( '@wordpress/' ) ) continue;
	const { private, version } = require( `./packages/${ name.replace(
		'@wordpress/',
		''
	) }/package.json` );
	if ( private ) continue;
	console.log(
		`npm dist-tag add ${ name }@${ version } wp-6.3 --otp`
	);
}

I also included 2FA code, but I had to run these commands in batches because OTP codes expire quickly.

@gziolo
Copy link
Member Author

gziolo commented Sep 5, 2023

I tested npm publishing with the following settings targeting WordPress 6.3:

Screenshot 2023-09-05 at 09 29 33

There were no changes to publish, but the job finished successfully performing all operations as designed:

Screenshot 2023-09-05 at 09 28 49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm Packages Related to npm packages [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
1 participant