Comparing version 1.18.0 to 1.18.1
@@ -43,3 +43,3 @@ import { custom, generators, Issuer } from 'openid-client'; | ||
server.listen(0, '127.0.0.1', function () { | ||
log.info(`Listening on port ${this.address().port}`); | ||
log.debug(`Listening on port ${this.address().port}`); | ||
}); | ||
@@ -46,0 +46,0 @@ await new Promise((resolve) => server.once('listening', resolve)); |
@@ -16,9 +16,6 @@ import { join } from 'node:path'; | ||
}; | ||
export const authFlow = async ({ configDir, oauthHost, clientId, }) => { | ||
if (isCi()) { | ||
export const authFlow = async ({ configDir, oauthHost, clientId, forceAuth, }) => { | ||
if (!forceAuth && isCi()) { | ||
throw new Error('Cannot run interactive auth in CI'); | ||
} | ||
if (!clientId) { | ||
throw new Error('Missing client id'); | ||
} | ||
const tokenSet = await auth({ | ||
@@ -25,0 +22,0 @@ oauthHost: oauthHost, |
import { describe } from '@jest/globals'; | ||
import { testCliCommand } from '../test_utils.js'; | ||
import { testCliCommand } from '../test_utils/test_cli_command.js'; | ||
describe('branches', () => { | ||
@@ -4,0 +4,0 @@ testCliCommand({ |
import { describe } from '@jest/globals'; | ||
import { testCliCommand } from '../test_utils'; | ||
import { testCliCommand } from '../test_utils/test_cli_command'; | ||
describe('connection_string', () => { | ||
@@ -4,0 +4,0 @@ testCliCommand({ |
import { describe } from '@jest/globals'; | ||
import { testCliCommand } from '../test_utils.js'; | ||
import { testCliCommand } from '../test_utils/test_cli_command.js'; | ||
describe('databases', () => { | ||
@@ -4,0 +4,0 @@ testCliCommand({ |
import { describe, expect } from '@jest/globals'; | ||
import { testCliCommand } from '../test_utils.js'; | ||
import { testCliCommand } from '../test_utils/test_cli_command.js'; | ||
describe('help', () => { | ||
@@ -4,0 +4,0 @@ testCliCommand({ |
import { describe } from '@jest/globals'; | ||
import { testCliCommand } from '../test_utils.js'; | ||
import { testCliCommand } from '../test_utils/test_cli_command.js'; | ||
describe('operations', () => { | ||
@@ -4,0 +4,0 @@ testCliCommand({ |
import { describe } from '@jest/globals'; | ||
import { testCliCommand } from '../test_utils.js'; | ||
import { testCliCommand } from '../test_utils/test_cli_command.js'; | ||
describe('projects', () => { | ||
@@ -4,0 +4,0 @@ testCliCommand({ |
import { describe } from '@jest/globals'; | ||
import { testCliCommand } from '../test_utils.js'; | ||
import { testCliCommand } from '../test_utils/test_cli_command.js'; | ||
describe('roles', () => { | ||
@@ -4,0 +4,0 @@ testCliCommand({ |
@@ -6,6 +6,6 @@ import { join } from 'node:path'; | ||
export const defaultDir = join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'neonctl'); | ||
export const ensureConfigDir = async ({ 'config-dir': configDir, }) => { | ||
if (!existsSync(configDir) && !isCi()) { | ||
export const ensureConfigDir = async ({ 'config-dir': configDir, 'force-auth': forceAuth, }) => { | ||
if (!existsSync(configDir) && (!isCi() || forceAuth)) { | ||
mkdirSync(configDir, { recursive: true }); | ||
} | ||
}; |
@@ -0,1 +1,2 @@ | ||
import { basename } from 'node:path'; | ||
import yargs from 'yargs'; | ||
@@ -50,2 +51,8 @@ import { hideBin } from 'yargs/helpers'; | ||
}) | ||
.option('force-auth', { | ||
describe: 'Force authentication', | ||
type: 'boolean', | ||
hidden: true, | ||
default: false, | ||
}) | ||
.middleware(ensureConfigDir) | ||
@@ -91,2 +98,3 @@ // Auth flow | ||
.completion() | ||
.scriptName(basename(process.argv[1]) === 'neon' ? 'neon' : 'neonctl') | ||
.fail(async (msg, err) => { | ||
@@ -93,0 +101,0 @@ if (isAxiosError(err)) { |
@@ -8,3 +8,3 @@ { | ||
"type": "module", | ||
"version": "1.18.0", | ||
"version": "1.18.1", | ||
"description": "CLI tool for NeonDB Cloud management", | ||
@@ -45,2 +45,3 @@ "main": "index.js", | ||
"lint-staged": "^13.0.3", | ||
"oauth2-mock-server": "^6.0.0", | ||
"pkg": "^5.8.1", | ||
@@ -89,3 +90,3 @@ "prettier": "^2.7.1", | ||
"clean": "rm -rf dist", | ||
"generateParams": "ts-node --esm generateOptionsFromSpec.ts", | ||
"generateParams": "node --loader ts-node/esm ./generateOptionsFromSpec.ts", | ||
"start": "node src/index.js", | ||
@@ -92,0 +93,0 @@ "test": "node --experimental-vm-modules node_modules/.bin/jest" |
83810
39
1994
30