@glpkg/installer
A CLI tool for installing NPM packages from GitLab Package Registry.
Installation
# From npm Registry
npm install -g @glpkg/installer
# Or use directly with npx
npx @glpkg/installer [command]
Quick Start
# Configure your token (one-time setup)
gitlab-config save YOUR_GITLAB_TOKEN
# Install a package
gitlab-install add @your-org/package
Commands
add - Install GitLab Packages
Install packages from GitLab registry:
gitlab-install add <packages...> [options]
Options:
-D, --save-dev- Install as devDependencies-g, --global- Install packages globally
Examples:
# Install specific version
gitlab-install add @your-org/package@1.0.0
# Install dev version
gitlab-install add @your-org/package@dev
# Install as devDependency
gitlab-install add @your-org/package -D
# Install globally (for CLI tools)
gitlab-install add @your-org/cli-tool -g
# Install multiple packages
gitlab-install add @your-org/pkg1 @your-org/pkg2
update - Update GitLab Packages
Update packages to their latest versions:
gitlab-install update [packages...] [options]
Options:
-g, --global- Update packages globally
Examples:
# Update all GitLab packages
gitlab-install update
# Update specific packages
gitlab-install update @your-org/package
# Update multiple packages
gitlab-install update @your-org/pkg1 @your-org/pkg2
# Update global packages
gitlab-install update -g
Token Configuration
The installer looks for a token in this order:
- Saved token via
gitlab-config save← Recommended GITLAB_AUTH_TOKENenvironment variable
Setup Token
gitlab-config save YOUR_GITLAB_TOKEN
Required Token Scopes
read_api- Read API accessread_registry- Read package registry
Configuration File
The tool creates .gitlab-packages.json to track configured scopes:
{
"scopes": ["@your-org", "@another-org"],
"registry": "https://gitlab.com/api/v4/packages/npm/"
}
How It Works
- Detects the package scope (e.g.,
@your-org) - Temporarily configures
.npmrcfor GitLab registry - Adds authentication token
- Runs
npm install - Restores original
.npmrc
Troubleshooting
Package not found
- Ensure the package exists in GitLab registry
- Check your token has
read_apiandread_registryscopes - Verify the token is correctly set:
gitlab-config check
Authentication errors
- Make sure your token hasn't expired
- Verify the token has the required permissions
- Run
gitlab-config checkto verify token is configured