Publish npm Packages
Suppose you have an npm package and want to publish it to the newly created npm registry using:
Note that publishing packages with the same package version is not allowed. The server will return the 409 HTTP response.
Publish packages using npm command-line tool
Log in to the npm registry:
npm login --registry https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpmhttps://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
is the registry URLmycompany
is the name of your company in Space,mynpm
is the registry name.
If you are not sure about the URL, you can copy the URL of a particular npm registry on the Packages page.
When asked for credentials, specify your Space username and password. npm uses permanent tokens for authentication. Once you log in to the registry, Space will automatically create a permanent token specifically for accessing the npm registry. This token will be saved in your local
.npmrc
configuration file and used for all further connections to the specified registry. You can manage the created token on the My Profile | Security | Personal Tokens page.Open the directory containing the package you want to publish.
Publish the package to the registry:
npm publish --registry https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
Publish packages using Yarn command-line tool
Log in to the npm registry:
npm login --registry https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpmhttps://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
is the registry URLmycompany
is the name of your company in Space,mynpm
is the registry name.
If you are not sure about the URL, you can copy the URL of a particular npm registry on the Packages page.
When asked for credentials, specify your Space username and password.
npm
uses permanent tokens for authentication.Configure the registry to require authentication:
npm config set //npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm:always-auth trueOpen the directory containing the package you want to publish.
Publish the package to the registry:
yarn publish --registry https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
Publish packages using Unity
Add a registry connection to the .upmconfig.toml file:
[npmAuth."https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm"] token = TOKEN_GOES_HERE email = EMAIL_ADDRESS alwaysAuth = trueCreate a custom package that includes a manifest file. Navigate to the directory that contains the
package.json
file and publish it usingnpm
oryarn
.
Publish packages using pnpm command-line tool
Log in to the npm registry:
pnpm login --registry https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpmhttps://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
is the registry URLmycompany
is the name of your company in Space,mynpm
is the registry name.
If you are not sure about the URL, you can copy the URL of a particular npm registry on the Packages page.
When asked for credentials, specify your Space username and password. npm uses permanent tokens for authentication.
Configure the registry to require authentication:
pnpm config set //npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm:always-auth trueOpen the directory containing the package you want to publish.
Publish the package to the registry:
pnpm publish --registry https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
Publish npm packages from JetBrains TeamCity
Prerequisites: You have a working build configuration in TeamCity that creates a package. Your task is to publish this package to a Space Packages registry.
In Space, create an application account that you will use for connecting to Space from TeamCity.
Connect the TeamCity instance to the Packages registry where you want to publish packages. In TeamCity:
in project properties, choose Connection | Add Connection,
in the connection settings, specify the URL of the npm registry (it should look like
https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
) and the application permanent token.
Add the npm registry connection to your TeamCity build configuration: In the build configuration settings, choose Build Features | Add build feature.
In the Add Build Feature window:
choose NPM Registry Connection,
in Choose connection, choose the connection you have created in step 1.
In your build configuration, add a build step that publishes a package. For example, a step with the Node.js runner type that runs:
npm config set init.version 0.0.%build.number% npm init -y npm publish --registry https://npm.pkg.jetbrains.space/mycompany/p/projectkey/mynpm
Publish npm packages from Space Automation
For the instructions on how to publish npm packages from Space Automation, refer to Space Automation examples.