Understand how npm scoped packages work with DepAegis, from creating scopes to configuring, publishing, and installing scoped packages in your organization.
A scoped package has a name that starts with an @ symbol followed by the scope name and a slash:
@myorg/ui-components
@myorg/utils
@myorg/design-tokensScopes act as namespaces. They solve two key problems:
@myorg/logger and @otherorg/logger can coexist, even on the same registry.@myorg.In DepAegis, a scope is backed by an organization. To create a new scope:
myorg). This becomes the scope: @myorg.Once the organization exists, any package published with the @myorg scope is automatically associated with it.
acme for @acme/*).The most common setup is to route a specific scope to DepAegis while keeping the default registry pointing to the public npm registry:
# Default: public npm registry (for packages like react, lodash)
registry=https://registry.npmjs.org/
# Route @myorg packages to DepAegis
@myorg:registry=https://app.depaegis.com/api/v1/npm/
# Authentication for DepAegis
//app.depaegis.com/:_authToken=${DEPAEGIS_TOKEN}If you have multiple organizations on DepAegis, add a registry line for each scope:
@frontend:registry=https://app.depaegis.com/api/v1/npm/
@backend:registry=https://app.depaegis.com/api/v1/npm/
@shared:registry=https://app.depaegis.com/api/v1/npm/
//app.depaegis.com/:_authToken=${DEPAEGIS_TOKEN}If DepAegis is configured as an upstream proxy, you can route everything through it:
registry=https://app.depaegis.com/api/v1/npm/
//app.depaegis.com/:_authToken=${DEPAEGIS_TOKEN}Set the scope in your package.json name field, then publish:
{
"name": "@myorg/ui-components",
"version": "1.0.0",
"description": "Shared UI component library",
"main": "dist/index.js",
"types": "dist/index.d.ts"
}npm publishnpm automatically routes the publish to the registry configured for the @myorg scope in your .npmrc.
To make the target registry explicit (so it works even if someone hasn't configured scoped registries):
{
"name": "@myorg/ui-components",
"version": "1.0.0",
"publishConfig": {
"registry": "https://app.depaegis.com/api/v1/npm/"
}
}@myorg exists in DepAegis.package.json name starts with @myorg/..npmrc routes @myorg to DepAegis with a valid token.Once your .npmrc is configured, installing a scoped package is identical to installing any other package:
# Add to dependencies
npm install @myorg/ui-components
# Add to devDependencies
npm install --save-dev @myorg/eslint-config
# Install a specific version
npm install @myorg/ui-components@2.1.0
# Install from a dist-tag
npm install @myorg/ui-components@beta
# Install multiple packages
npm install @myorg/ui-components @myorg/utils @myorg/design-tokensThe entries in your package.json will include the full scoped name:
{
"dependencies": {
"@myorg/ui-components": "^2.1.0",
"@myorg/utils": "~1.0.3"
}
}Keep scope and package names predictable so developers can find and install packages without looking up documentation:
@acme/ui-components
@acme/ui-icons
@acme/api-client
@acme/eslint-config
@acme/tsconfigAvoid creating too many organizations. A single organization with well-named packages is easier to manage than many small scopes:
| Approach | Example | Verdict |
|---|---|---|
| Single org | @acme/* | Recommended — simple permissions, easy to find |
| Per-team orgs | @acme-fe/*, @acme-be/* | OK for large orgs, adds configuration overhead |
| Per-package orgs | @ui-components/* | Avoid — too many scopes, hard to manage |
Use a project-level .npmrc committed to the repo, with the token as an environment variable. This ensures new team members get the correct configuration after cloning:
# .npmrc (committed)
@acme:registry=https://app.depaegis.com/api/v1/npm/
//app.depaegis.com/:_authToken=${DEPAEGIS_TOKEN}In DepAegis, configure your organization's permissions so that:
Even if your team's default registry is DepAegis, add publishConfig to every scoped package. This prevents accidental publishes to the wrong registry when someone has a different global .npmrc:
{
"name": "@acme/my-package",
"version": "1.0.0",
"publishConfig": {
"registry": "https://app.depaegis.com/api/v1/npm/"
}
}