Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/cli/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Inquirerer, Question } from 'inquirerer';
import { Prompter, Question } from 'genomic';

import { KEY_SEQUENCES, setupTests, TestEnvironment } from '../test-utils';

const beforeEachSetup = setupTests();

describe('Inquirerer', () => {
describe('Prompter', () => {
let environment: TestEnvironment;

beforeEach(() => {
Expand All @@ -14,7 +14,7 @@ describe('Inquirerer', () => {
it('prompts user and correctly processes delayed input', async () => {
const { mockInput, mockOutput, writeResults, transformResults, enqueueInputResponse } = environment;

const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: false
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@pgpmjs/server-utils": "workspace:^",
"@pgpmjs/types": "workspace:^",
"find-and-require-package-json": "^0.8.2",
"inquirerer": "^2.4.0",
"genomic": "^4.0.0",
"js-yaml": "^4.1.0",
"minimist": "^1.2.8",
"pg-cache": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { findAndRequirePackageJson } from 'find-and-require-package-json';
import { CLIOptions, Inquirerer } from 'inquirerer';
import { CLIOptions, Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';

import codegen from './commands/codegen';
Expand All @@ -18,7 +18,7 @@ const createCommandMap = (): Record<string, Function> => {
};
};

export const commands = async (argv: Partial<ParsedArgs>, prompter: Inquirerer, options: CLIOptions & { skipPgTeardown?: boolean }) => {
export const commands = async (argv: Partial<ParsedArgs>, prompter: Prompter, options: CLIOptions & { skipPgTeardown?: boolean }) => {
let { first: command, newArgv } = extractFirst(argv);

// Run update check early so it shows on help/version paths too
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CLIOptions, Inquirerer } from 'inquirerer'
import { CLIOptions, Prompter } from 'genomic'
import { ParsedArgs } from 'minimist'
import { promises as fs } from 'fs'
import { join } from 'path'
Expand Down Expand Up @@ -48,7 +48,7 @@ async function loadConfig(path: string): Promise<Partial<GraphQLCodegenOptions>>

export default async (
argv: Partial<ParsedArgs>,
_prompter: Inquirerer,
_prompter: Prompter,
_options: CLIOptions
) => {
if (argv.help || argv.h) {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getEnvOptions } from '@constructive-io/graphql-env';
import { GraphQLExplorer as explorer } from '@constructive-io/graphql-explorer';
import { Logger } from '@pgpmjs/logger';
import { PgpmOptions } from '@pgpmjs/types';
import { CLIOptions, Inquirerer, Question } from 'inquirerer';
import { CLIOptions, Prompter, Question } from 'genomic';

const log = new Logger('explorer');

Expand Down Expand Up @@ -72,7 +72,7 @@ const questions: Question[] = [

export default async (
argv: Partial<Record<string, any>>,
prompter: Inquirerer,
prompter: Prompter,
_options: CLIOptions
) => {
// Show usage if explicitly requested
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/get-graphql-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CLIOptions, Inquirerer } from 'inquirerer'
import { CLIOptions, Prompter } from 'genomic'
import { ParsedArgs } from 'minimist'
import { promises as fs } from 'fs'
import { buildSchemaSDL, fetchEndpointSchemaSDL } from '@constructive-io/graphql-server'
Expand Down Expand Up @@ -26,7 +26,7 @@ const defaultSchemas = [

export default async (
argv: Partial<ParsedArgs>,
prompter: Inquirerer,
prompter: Prompter,
_options: CLIOptions
) => {
if (argv.help || argv.h) {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getEnvOptions } from '@constructive-io/graphql-env';
import { Logger } from '@pgpmjs/logger';
import { GraphQLServer as server } from '@constructive-io/graphql-server';
import { PgpmOptions } from '@pgpmjs/types';
import { CLIOptions, Inquirerer, OptionValue,Question } from 'inquirerer';
import { CLIOptions, Prompter, OptionValue,Question } from 'genomic';
import { getPgPool } from 'pg-cache';

const log = new Logger('server');
Expand Down Expand Up @@ -83,7 +83,7 @@ const questions: Question[] = [

export default async (
argv: Partial<Record<string, any>>,
prompter: Inquirerer,
prompter: Prompter,
_options: CLIOptions
) => {
// Show usage if explicitly requested
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { findAndRequirePackageJson } from 'find-and-require-package-json';
import { CLI, CLIOptions } from 'inquirerer';
import { CLI, CLIOptions } from 'genomic';

import { commands } from './commands';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test-utils/cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CLIOptions } from 'inquirerer';
import { CLIOptions } from 'genomic';
import readline from 'readline';
import { Readable, Transform, Writable } from 'stream';
import { cleanAnsi } from 'clean-ansi';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test-utils/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import { Inquirerer } from 'inquirerer';
import { Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';
import os from 'os';
import path from 'path';
Expand Down Expand Up @@ -53,7 +53,7 @@ export class TestFixture {
transformResults
} = this.environment;

const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down
2 changes: 1 addition & 1 deletion packages/csv-to-pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@pgsql/types": "^17.6.2",
"@pgsql/utils": "^17.8.4",
"csv-parser": "^2.3.3",
"inquirerer": "^2.4.0",
"genomic": "^4.0.0",
"js-yaml": "^3.14.0",
"pgsql-deparser": "^17.15.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/csv-to-pg/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import { CLI, type CommandHandler } from 'inquirerer';
import { CLI, type CommandHandler } from 'genomic';
import { readConfig } from './parse';
import { Parser } from './parser';
import { normalizePath } from './utils';
Expand Down
6 changes: 3 additions & 3 deletions pgpm/cli/__tests__/add.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';
import { sync as glob } from 'glob';
import { Inquirerer } from 'inquirerer';
import { Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';
import * as path from 'path';

Expand Down Expand Up @@ -28,7 +28,7 @@ describe('cmds:add', () => {
const runAddTest = async (argv: ParsedArgs, label: string) => {
const { mockInput, mockOutput, writeResults, transformResults } = environment;

const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -198,7 +198,7 @@ superuser = false
await setupModule(moduleDir);

const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down
4 changes: 2 additions & 2 deletions pgpm/cli/__tests__/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ process.env.PGPM_SKIP_UPDATE_CHECK = 'true';

import { PgpmPackage } from '@pgpmjs/core';
import { sync as glob } from 'glob';
import { Inquirerer } from 'inquirerer';
import { Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';
import * as path from 'path';

Expand Down Expand Up @@ -31,7 +31,7 @@ describe('cmds:extension', () => {
});

const runCommand = async (argv: ParsedArgs) => {
const prompter = new Inquirerer({
const prompter = new Prompter({
input: environment.mockInput,
output: environment.mockOutput,
noTty: true
Expand Down
20 changes: 10 additions & 10 deletions pgpm/cli/__tests__/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ process.env.PGPM_SKIP_UPDATE_CHECK = 'true';
import { PgpmPackage } from '@pgpmjs/core';
import { existsSync } from 'fs';
import { sync as glob } from 'glob';
import { Inquirerer } from 'inquirerer';
import { Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';
import * as path from 'path';

Expand Down Expand Up @@ -37,7 +37,7 @@ describe('cmds:init', () => {
const runInitTest = async (argv: ParsedArgs, label: string) => {
const { mockInput, mockOutput, writeResults, transformResults } = environment;

const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('cmds:init', () => {
describe('with custom templates', () => {
it('initializes workspace with --template-path', async () => {
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('cmds:init', () => {
// First create a workspace
const workspaceDir = path.join(fixture.tempDir, 'test-workspace-for-module');
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -193,7 +193,7 @@ describe('cmds:init', () => {
'initializes workspace with --repo',
async () => {
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('cmds:init', () => {
'initializes workspace with --repo and --from-branch',
async () => {
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('cmds:init', () => {
describe('init from packages/ folder', () => {
it('initializes module from packages/ folder (empty workspace)', async () => {
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -305,7 +305,7 @@ describe('cmds:init', () => {

it('initializes module from packages/ folder (with existing modules)', async () => {
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -369,7 +369,7 @@ describe('cmds:init', () => {
describe('prevent nested module creation', () => {
it('prevents nested module creation inside existing module', async () => {
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down Expand Up @@ -444,7 +444,7 @@ describe('cmds:init', () => {
describe('workspace root behavior', () => {
it('initializes module from workspace root (existing behavior)', async () => {
const { mockInput, mockOutput } = environment;
const prompter = new Inquirerer({
const prompter = new Prompter({
input: mockInput,
output: mockOutput,
noTty: true
Expand Down
4 changes: 2 additions & 2 deletions pgpm/cli/__tests__/package.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PgpmPackage } from '@pgpmjs/core';
import * as fs from 'fs';
import { sync as glob } from 'glob';
import { Inquirerer } from 'inquirerer';
import { Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';
import * as os from 'os';
import * as path from 'path';
Expand Down Expand Up @@ -31,7 +31,7 @@ describe('cmds:package', () => {
});

const runCommand = async (argv: ParsedArgs) => {
const prompter = new Inquirerer({
const prompter = new Prompter({
input: environment.mockInput,
output: environment.mockOutput,
noTty: true
Expand Down
34 changes: 17 additions & 17 deletions pgpm/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@
"pg": "^8.16.3",
"ts-node": "^10.9.2"
},
"dependencies": {
"@pgpmjs/core": "workspace:^",
"@pgpmjs/env": "workspace:^",
"@pgpmjs/logger": "workspace:^",
"@pgpmjs/types": "workspace:^",
"appstash": "^0.2.6",
"create-gen-app": "^0.10.0",
"find-and-require-package-json": "^0.8.2",
"inquirerer": "^2.4.0",
"js-yaml": "^4.1.0",
"minimist": "^1.2.8",
"pg-cache": "workspace:^",
"pg-env": "workspace:^",
"semver": "^7.6.2",
"shelljs": "^0.10.0",
"yanse": "^0.1.8"
},
"dependencies": {
"@genomic/scaffolds": "^2.0.0",
"@pgpmjs/core": "workspace:^",
"@pgpmjs/env": "workspace:^",
"@pgpmjs/logger": "workspace:^",
"@pgpmjs/types": "workspace:^",
"appstash": "^0.2.6",
"find-and-require-package-json": "^0.8.2",
"genomic": "^4.0.0",
"js-yaml": "^4.1.0",
"minimist": "^1.2.8",
"pg-cache": "workspace:^",
"pg-env": "workspace:^",
"semver": "^7.6.2",
"shelljs": "^0.10.0",
"yanse": "^0.1.8"
},
"keywords": [
"cli",
"command-line",
Expand Down
4 changes: 2 additions & 2 deletions pgpm/cli/src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { findAndRequirePackageJson } from 'find-and-require-package-json';
import { CLIOptions, Inquirerer } from 'inquirerer';
import { CLIOptions, Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';
import { teardownPgPools } from 'pg-cache';

Expand Down Expand Up @@ -71,7 +71,7 @@ export const createPgpmCommandMap = (skipPgTeardown: boolean = false): Record<st
};
};

export const commands = async (argv: Partial<ParsedArgs>, prompter: Inquirerer, options: CLIOptions & { skipPgTeardown?: boolean }) => {
export const commands = async (argv: Partial<ParsedArgs>, prompter: Prompter, options: CLIOptions & { skipPgTeardown?: boolean }) => {
if (argv.version || argv.v) {
const pkg = findAndRequirePackageJson(__dirname);
console.log(pkg.version);
Expand Down
4 changes: 2 additions & 2 deletions pgpm/cli/src/commands/add.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PgpmPackage } from '@pgpmjs/core';
import { CLIOptions, Inquirerer } from 'inquirerer';
import { CLIOptions, Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';
import * as path from 'path';

Expand Down Expand Up @@ -30,7 +30,7 @@ Examples:

export default async (
argv: Partial<ParsedArgs>,
prompter: Inquirerer,
prompter: Prompter,
_options: CLIOptions
) => {
// Show usage if explicitly requested
Expand Down
4 changes: 2 additions & 2 deletions pgpm/cli/src/commands/admin-users.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CLIOptions, Inquirerer } from 'inquirerer';
import { CLIOptions, Prompter } from 'genomic';
import { ParsedArgs } from 'minimist';

import { extractFirst } from '../utils';
Expand All @@ -24,7 +24,7 @@ Options:
--cwd Working directory (default: current directory)
`;

export default async (argv: Partial<ParsedArgs>, prompter: Inquirerer, options: CLIOptions) => {
export default async (argv: Partial<ParsedArgs>, prompter: Prompter, options: CLIOptions) => {
let { first: subcommand, newArgv } = extractFirst(argv);

// Prompt if no subcommand provided
Expand Down
Loading
Loading