@ecltest/ecl-utils (0.0.6)

Published 2025-08-21 20:15:59 +00:00 by Eric

Installation

@ecltest:registry=
npm install @ecltest/ecl-utils@0.0.6
"@ecltest/ecl-utils": "0.0.6"

About this package

Setting up and using NPM package registry:

1. Generate token (publisher)

Generate a token that will be used for publishing packages.

curl -H "Content-Type: application/json" \
	-d '{"name":"{name}","scopes":["write:package"]}' \
	-u "{owner}:{password}" \
	"https://code.juton.llc/api/v1/users/{owner}/tokens

IMPORTANT: This will return a response with a secret token that you will only ever see once! Don't lose it.

The response will look something like this:

{
  "id": 1,
  "name": "{name}",
  "sha1": "{token}",
  "token_last_eight": "...",
  "scopes": ["write:package"]
}

NOTE: "write:package" scope is effectively full access currently.

2. Export the token as an environment variable (publisher and consumer)

export NPM_TOKEN={token}

Exporting the token as an environment variable alows it to be used by a shared .npmrc file as follows:

@{scope}:registry=https://code.juton.llc/api/packages/{owner}/npm/
//code.juton.llc/api/packages/{owner}/npm/:_authToken=${NPM_TOKEN}

This effectively runs the commands:

npm config set "@{scope}:registry" "https://code.juton.llc/api/packages/{owner}/npm/"
npm config set -- "//code.juton.llc/api/packages/{owner}/npm/:_authToken" $NPM_TOKEN

3. Publish a package (publisher)

IMPORTANT: The project's package.json should have its name value set to the @{scope}/{package} so the path can be properly resolved when running npm install @{scope}/{package}.

e.g.

{
  ...
  "name": "@ecltest/ecl-utils"
}

To then publish the package according to the package.json name and version, run:

npm publish --scope="@{scope}" --registry="http://code.juton.llc/api/packages/{owner}/npm/"

4. Associate repo with package in forgejo (publisher, once)

Navigate to the packages tab of the repo in the Forgejo instance's UI. e.g. https://code.juton.llc/{owner}/{repo}/packages

Click the package name of the package that should be associated with the repository.

On the package details page, click "Settings" on the right side of the screen.

On the package settings page, confirm the repository name is the one you wish to associate the package with, and click the "Update Repository Link" button.

The package will now be associated with the repository.

NOTE: Updating the version field in package.json and then running npm i, prior to comitting and pushing to origin, will ensure unique packages are generated when publishing, which map to that particular repository commit.

5. Consume a package (consumer)

npm i @{scope}/{package}

e.g

npm i @ecltest/ecl-utils
Details
npm
2025-08-21 20:15:59 +00:00
3
Eric
ISC
latest
1.6 KiB
Assets (1)
Versions (4) View all
0.0.6 2025-08-21
0.0.5 2025-08-21
0.0.4 2025-08-21
0.0.3 2025-08-21