mirror of
https://codeberg.org/forgejo/docs.git
synced 2025-04-26 05:30:40 +03:00
Clarifications and adjustments
Now with extra safety. Two modifications made copypasting safer for end users.
This commit is contained in:
parent
dc1516d231
commit
58a93e9910
1 changed files with 9 additions and 9 deletions
|
@ -47,11 +47,12 @@ npm config set -- '//forgejo.example.com/api/packages/testuser/npm/:_authToken'
|
|||
|
||||
## Publish a package
|
||||
|
||||
Publish a package by running the following command in your project:
|
||||
When publishing a package, npm uses configs and defaults if the arguments are not specified in the command or project. The following commands demonstrate a default publish, publishing to a specific registry, and a specific scope and registry:
|
||||
|
||||
```shell
|
||||
npm publish
|
||||
npm publish --scope=@{scope} --registry=${{github.SERVER_URL}}/api/packages/{owner}/npm/
|
||||
npm publish --registry={SERVER_URL}/api/packages/{owner}/npm/
|
||||
npm publish --scope=@{scope} --registry={SERVER_URL}/api/packages/{owner}/npm/
|
||||
```
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. First, you must delete that version of the existing package, either in UI at `SERVER_URL/OWNER/-/packages/npm/PACKAGE_NAME/PACKAGE_VERSION/settings` or `unpublish` in CLI.
|
||||
|
@ -74,7 +75,6 @@ For example:
|
|||
```shell
|
||||
npm unpublish @test/test_package
|
||||
npm unpublish @test/test_package@1.0.0
|
||||
npm unpublish @test/test_package --force #After npm error code EUSAGE:Refusing to delete entire project.
|
||||
```
|
||||
|
||||
Note: This behavior is different than the public npm repository. Once you delete or unpublish a package, you can re-publish a package with the same name and version immediately.
|
||||
|
@ -135,7 +135,7 @@ npm view
|
|||
npm search
|
||||
```
|
||||
|
||||
## When commands fail
|
||||
## Troubleshooting
|
||||
|
||||
Run these commands before the command that fails:
|
||||
|
||||
|
@ -144,7 +144,7 @@ npm config set loglevel verbose #The default log level is notice
|
|||
npm config ls -l #Lists the full config, including defaults. User config is at the bottom.
|
||||
```
|
||||
|
||||
The [npm CLI Docs](https://docs.npmjs.com/cli) provide hints when something goes wrong. There's probably a config setting you need to use before running the failing one. Incorrect [Auth-related config](https://docs.npmjs.com/cli/configuring-npm/npmrc#auth-related-configuration) can silently/cryptically fail at the default log level.
|
||||
The [npm CLI Docs](https://docs.npmjs.com/cli) may help you find missing config settings required prior to the failing command. Incorrect [Auth-related config](https://docs.npmjs.com/cli/configuring-npm/npmrc#auth-related-configuration) can silently/cryptically fail at the default log level.
|
||||
|
||||
## Forgejo Actions Example
|
||||
|
||||
|
@ -169,10 +169,10 @@ jobs:
|
|||
run: npm install
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Only if using a self-signed cert
|
||||
#WARNING: This will override the default CA settings (null == only use known CAs) and prevent npm from communicating with the public npm registry
|
||||
# To reverse this, use: npm config set cafile=
|
||||
run: npm config set cafile {location of ca-cert.pem}
|
||||
# WARNING: The following commented step will override the default CA settings (null == only use known CAs) and prevent npm from communicating with the public npm registry
|
||||
# To undo it, add another step: 'run: npm config set cafile='
|
||||
#- name: Only if using a self-signed cert
|
||||
# run: npm config set cafile {location of ca-cert.pem}
|
||||
- name: Publish to registry
|
||||
run: npm publish --scope=@{scope} --registry=${{github.SERVER_URL}}/api/packages/{owner}/npm/
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue