Working with scoped npm packages and MyGet private registry
When we introduced npm support on MyGet last month, we did not yet have support for scoped packages. Today, we’re pleased to announce full support for them!
Scoped packages are packages that are "scoped" to a specific registry. E.g. all packages scoped
@acmecorp may be retrieved from a MyGet npm registry feed, while other scopes and non-scoped packages flow in from the default npm registry.
Creating a scoped package
A scoped package can be created by setting the
name property in
package.json file correctly, for example:
Dependencies can be scoped as well:
More information on scoped packages is available from the npm docs.
Publishing a scoped package
Scopes can be associated with a specific registry. This allows for seamless mixing of packages from various npm registries.
Let's associate the scope
@acmecorp with the
https://www.myget.org/F/your-feed-name/npm/ npm registry feed. We can do this manually, by adding the following to our
It's probably easier to generate these entries from the command line by running:
npm config set @acmecorp:registry=https://www.myget.org/F/your-feed-name/npm/
npm login --registry https://www.myget.org/F/your-feed-name/npm/ --scope=@acmecorp
npm config set always-auth true --registry https://www.myget.org/F/your-feed-name/npm/
From now on, we can publish and consume any package that has the
@acmecorp scope. Npm will automatically direct requests to the correct registry.
P.S.: We have VSIX support coming as well. Let us know if you want to enroll in the preview.