Skip to content

Expanded shared library publishing guide with step-by-step instructio… - #141

Draft
cedricbrasey wants to merge 2 commits into
DEFRA:mainfrom
cedricbrasey:feature/shread-lib-updates
Draft

Expanded shared library publishing guide with step-by-step instructio…#141
cedricbrasey wants to merge 2 commits into
DEFRA:mainfrom
cedricbrasey:feature/shread-lib-updates

Conversation

@cedricbrasey

Copy link
Copy Markdown

…ns and images for configuring npm Trusted Publishing and manual publishing steps. Updated hosting details for sensitive libraries. Added new images.

…ns and images for configuring npm Trusted Publishing and manual publishing steps. Updated hosting details for sensitive libraries. Added new images.
…ns and images for configuring npm Trusted Publishing and manual publishing steps. Updated hosting details for sensitive libraries. Added new images.

@ben-sagar ben-sagar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are a few minor wording tweaks needed and a couple of things that need clarifying (if only for my benefit!)

## Where to host a shared library

Use the ecosystem's native registry by default. That means [npmjs.com](https://www.npmjs.com) for npm packages and [nuget.org](https://www.nuget.org) for NuGet packages. These registries are well supported, encourage good security practices and offer low-friction adoption for consumers. They also support Defra's commitment to working in the open and publishing code openly.
Use the ecosystem's native registry by default. That means using [npmjs.com](https://www.npmjs.com) for npm packages and [nuget.org](https://www.nuget.org) for NuGet packages. These registries are well supported, encourage good security practices and offer low-friction adoption for consumers. They also support Defra's commitment to working in the open and publishing code openly.

@ben-sagar ben-sagar Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was still fine without the word "using" but it doesn't do any harm I suppose.

Use the ecosystem's native registry by default. That means using [npmjs.com](https://www.npmjs.com) for npm packages and [nuget.org](https://www.nuget.org) for NuGet packages. These registries are well supported, encourage good security practices and offer low-friction adoption for consumers. They also support Defra's commitment to working in the open and publishing code openly.

For libraries containing sensitive or private code, use GitHub Packages instead.
Use [github.com](https://github.com/orgs/DEFRA/packages) for libraries containing sensitive or private code, use GitHub Packages instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence no longer makes sense, should the link be around GitHub Packages?

i.e.

Use GitHub Packages for libraries containing sensitive or private code.


For onboarding, contact [`#npm-support`](https://defra-digital.slack.com/archives/C0BA4SW20NS) in Slack. Defra npm org admins can be found there.

A Defra npm org admin must perform the first publish of any new `@defra`-scoped package. After that, your npm account can be made maintainer of the specific package. Teams can also be created within the organisation to manage access to one or more packages.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line will need changing based on the guidance you've added for publishing your own packages.

I don't think this part is true?

A Defra npm org admin must perform the first publish of any new @defra-scoped package.

- confirmation the package is suitable for public publishing

A Defra npm org admin will configure the Trusted Publishing policy on npmjs.com and perform the first publish.
A Defra npm org admin will then create an `npm` team and add you to this team as a member. You will receive to your registered email address an invitation to join the team. Make sure you follow the instructions in that email.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only true if we're putting people into specific teams, which we won't always necessarily do.

Also, this invitation only happens the first time someone is invited to the organisation - if they are already a member of the organisation they won't receive another invite when we add them to another team.

You should now see something along these lines. Press the enter key to open the browser.
```text
npm notice Log in on https://registry.npmjs.org/
npm notice npm tokens that bypass 2FA are being restricted for account changes and direct publishing. Learn how to prepare: https://gh.io/npm-gat-bypass2fa-deprecation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth excluding this notification - I know it's just an example, but this particular message will disappear shortly and having it here could be a bit misleading.

npm notice integrity: sha512-cV+gqctmZPrIi[...]SV67n3Qg0qGlQ==
npm notice total files: 3
npm notice
npm notice npm tokens that bypass 2FA are being restricted for account changes and direct publishing. Learn how to prepare: https://gh.io/npm-gat-bypass2fa-deprecation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto this one.

npm notice publish Provenance statement published to transparency log: https://search.sigstore.dev/?logIndex=2349495965
+ @defra/your-package-name@0.1.0
```
You have now published your package to npm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever discover why I couldn't initially see the settings page for your package, despite being an org owner?

Did you have to do anything, or do we think it was just a weird UI bug or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants