Skip to content

Commit

Permalink
Be able to ignore PaaS specific processes and only login to NPM priva…
Browse files Browse the repository at this point in the history
…te package registry (#158)

Add flag on paas:login command to only perform the automated NPM login action (useful for Premium Licence users who don't owning a PaaS environment)
  • Loading branch information
alexandrebouthinon authored Sep 13, 2022
1 parent cb13e1a commit 5449a06
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $ npm install -g kourou
$ kourou COMMAND
running command...
$ kourou (-v|--version|version)
kourou/0.24.1 linux-x64 node-v16.13.2
kourou/0.24.2 darwin-x64 node-v16.17.0
$ kourou --help [COMMAND]
USAGE
$ kourou COMMAND
Expand Down Expand Up @@ -1006,6 +1006,7 @@ USAGE
OPTIONS
--help show CLI help
--only_npm Only perform the login on the private NPM registry
--project=project Current PaaS project
--username=username PaaS username
```
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kourou",
"description": "The CLI that helps you manage your Kuzzle instances",
"version": "0.24.1",
"version": "0.24.2",
"author": "The Kuzzle Team <support@kuzzle.io>",
"bin": {
"kourou": "./bin/run"
Expand Down
13 changes: 12 additions & 1 deletion src/commands/paas/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ class PaasLogin extends PaasKommand {
public static flags = {
help: flags.help(),
project: flags.string({
description: 'Current PaaS project'
description: 'Current PaaS project',
required: false
}),
username: flags.string({
description: 'PaaS username',
}),
only_npm: flags.boolean({
description: 'Only perform the login on the private NPM registry',
required: false,
default: false
})
};

async runSafe() {
Expand All @@ -32,6 +38,11 @@ class PaasLogin extends PaasKommand {
? process.env.KUZZLE_PAAS_PASSWORD
: await cli.prompt(` Password`, { type: 'hide' });

if (this.flags.only_npm) {
await this.authenticateNPM(username, password);
return;
}

await this.initPaasClient({ username, password });

const apiKey: ApiKey = await this.paas.auth.createApiKey('Kourou PaaS API Key');
Expand Down

0 comments on commit 5449a06

Please sign in to comment.