https://github.com/taskforcesh/nandu-cli
Nandu CLI - Open NPM Registry
https://github.com/taskforcesh/nandu-cli
Last synced: 8 months ago
JSON representation
Nandu CLI - Open NPM Registry
- Host: GitHub
- URL: https://github.com/taskforcesh/nandu-cli
- Owner: taskforcesh
- Created: 2021-11-11T15:50:48.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-12T07:07:45.000Z (almost 4 years ago)
- Last Synced: 2024-11-03T18:35:01.747Z (about 1 year ago)
- Language: TypeScript
- Size: 220 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# Nandu CLI
Nandu Open NPM Registry CLI
[](https://oclif.io)
[](https://npmjs.org/package/nandu-cli)
[](https://npmjs.org/package/nandu-cli)
[](https://github.com/taskforcesh/nandu-cli/blob/master/package.json)
* [Nandu CLI](#nandu-cli)
* [Quick Start](#quick-start)
* [Usage](#usage)
* [Commands](#commands)
# Quick Start
In order to quickly get a working Nandu NPM registry you can follow this steps and recommendations.
Nandu uses env variables for configuring all its settings, inclusive the ROOT user credentials. The root
user is the one that can bootstrap the service, by creating new users and so on. Also the root user
has godlike permissions, therefore it is important to only use it for bootstrapping, and the first thing to
do is to create a new user and give it "admin" permissions.
When you start Nandu for the first time it will create such root user that you can then use to interact with the
registry.
```bash
$ nandu start
Nandu is running on port 4567.
```
You will get a lot of debug logs unless you set ```NODE_ENV``` to ```production```.
By default Nandu will use Sqlite for storing the registry metadata, and the database file will be
stored at ```./storage/db/nandu.db```. You can change this setting with the ```NANDU_SEQUELIZE_URI``` env
variable.
The next step is to create an authentication token for the root user, you need to use the nandu cli for this as well,
```bash
$ nandu token:create root
username: root
password: ******
New token created for user root {
id: 'ad4ac909-2cea-40ba-be4e-03ec4fbb57bf',
token: 'c0463461-23fb-4642-a927-820b0d71ffb8',
readonly: false,
created: '2021-11-11T08:09:47.532Z'
}
```
You can create tokens on behalf of other users if the user you use for creating the tokens has the correct permissions.
# Usage
```sh-session
$ npm install -g nandu-cli
$ nandu COMMAND
running command...
$ nandu (-v|--version|version)
nandu-cli/1.2.3 linux-x64 node-v14.18.2
$ nandu --help [COMMAND]
USAGE
$ nandu COMMAND
...
```
# Commands
* [`nandu help [COMMAND]`](#nandu-help-command)
* [`nandu start`](#nandu-start)
* [`nandu token`](#nandu-token)
* [`nandu token:create USER`](#nandu-tokencreate-user)
* [`nandu token:ls USER`](#nandu-tokenls-user)
* [`nandu user`](#nandu-user)
* [`nandu user:add USER`](#nandu-useradd-user)
## `nandu help [COMMAND]`
display help for nandu
```
USAGE
$ nandu help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
```
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.5/src/commands/help.ts)_
## `nandu start`
Starts Nandu Open NPM Server
```
USAGE
$ nandu start
OPTIONS
-f, --force
-h, --help show CLI help
-p, --port=port [default: 4567] listen to port
EXAMPLE
$ nandu start -p 4567
```
_See code: [src/commands/start.ts](https://github.com/taskforcesh/nandu-cli/blob/v1.2.3/src/commands/start.ts)_
## `nandu token`
Manage NPM Registry tokens
```
USAGE
$ nandu token
EXAMPLE
$ nandu token:create myuser
```
_See code: [src/commands/token/index.ts](https://github.com/taskforcesh/nandu-cli/blob/v1.2.3/src/commands/token/index.ts)_
## `nandu token:create USER`
create a new token for given user
```
USAGE
$ nandu token:create USER
OPTIONS
-h, --help show CLI help
--cidr-whitelist=cidr-whitelist comma separated list of whitelisted cidrs
--readonly generate a readonly token
--registry=registry (required) URI pointing to your Nandu NPM Registry
--token=token Token to be used for authentication, uses NPM_TOKEN env variable if unspecified
EXAMPLE
$ nandu start -p 4567
```
_See code: [src/commands/token/create.ts](https://github.com/taskforcesh/nandu-cli/blob/v1.2.3/src/commands/token/create.ts)_
## `nandu token:ls USER`
list tokens for given user
```
USAGE
$ nandu token:ls USER
OPTIONS
-h, --help show CLI help
--registry=registry (required) URI pointing to your Nandu NPM Registry
--token=token Token to be used for authentication, uses NPM_TOKEN env variable if unspecified
EXAMPLE
$ nandu start -p 4567
```
_See code: [src/commands/token/ls.ts](https://github.com/taskforcesh/nandu-cli/blob/v1.2.3/src/commands/token/ls.ts)_
## `nandu user`
Manage NPM Registry users
```
USAGE
$ nandu user
EXAMPLE
$ nandu user:add myuser
```
_See code: [src/commands/user/index.ts](https://github.com/taskforcesh/nandu-cli/blob/v1.2.3/src/commands/user/index.ts)_
## `nandu user:add USER`
add or update a new token for given user
```
USAGE
$ nandu user:add USER
OPTIONS
-h, --help show CLI help
--registry=registry (required) URI pointing to your Nandu NPM Registry
--token=token Token to be used for authentication, uses NPM_TOKEN env variable if unspecified
EXAMPLE
$ nandu user:add myuser
```
_See code: [src/commands/user/add.ts](https://github.com/taskforcesh/nandu-cli/blob/v1.2.3/src/commands/user/add.ts)_