From e14233104df808cb30ded795d126afd83853b949 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Tue, 13 Feb 2024 14:29:08 -0700 Subject: [PATCH] fix: add missing files --- src/config/plugin.ts | 2 +- src/main.ts | 2 +- src/symbols.ts | 1 + .../fixtures/single-cmd-cli-deprecated/package.json | 10 ++++++++++ .../fixtures/single-cmd-cli-deprecated/src/index.ts | 9 +++++++++ .../fixtures/single-cmd-cli-deprecated/tsconfig.json | 7 +++++++ 6 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/symbols.ts create mode 100644 test/command/fixtures/single-cmd-cli-deprecated/package.json create mode 100644 test/command/fixtures/single-cmd-cli-deprecated/src/index.ts create mode 100644 test/command/fixtures/single-cmd-cli-deprecated/tsconfig.json diff --git a/src/config/plugin.ts b/src/config/plugin.ts index 34d968942..6759f4e07 100644 --- a/src/config/plugin.ts +++ b/src/config/plugin.ts @@ -64,7 +64,7 @@ function determineCommandDiscoveryOptions( if (!commandDiscovery) return if (typeof commandDiscovery === 'string' && defaultCmdId) { - return {globPatterns: GLOB_PATTERNS, strategy: 'single', target: commandDiscovery} + return {strategy: 'single', target: commandDiscovery} } if (typeof commandDiscovery === 'string') { diff --git a/src/main.ts b/src/main.ts index 659e26186..f2da624c1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -51,7 +51,7 @@ export async function run(argv?: string[], options?: Interfaces.LoadOptions): Pr const config = await Config.load(options ?? require.main?.filename ?? __dirname) - // If this is a single command CLI, then insert the '.' command into the argv array to serve as the command id. + // If this is a single command CLI, then insert the SINGLE_COMMAND_CLI_SYMBOL into the argv array to serve as the command id. if (config.isSingleCommandCLI) { argv = [SINGLE_COMMAND_CLI_SYMBOL, ...argv] } diff --git a/src/symbols.ts b/src/symbols.ts new file mode 100644 index 000000000..f7918d96c --- /dev/null +++ b/src/symbols.ts @@ -0,0 +1 @@ +export const SINGLE_COMMAND_CLI_SYMBOL = Symbol('#SINGLE_COMMAND_CLI').toString() diff --git a/test/command/fixtures/single-cmd-cli-deprecated/package.json b/test/command/fixtures/single-cmd-cli-deprecated/package.json new file mode 100644 index 000000000..aab6f1da7 --- /dev/null +++ b/test/command/fixtures/single-cmd-cli-deprecated/package.json @@ -0,0 +1,10 @@ +{ + "name": "single-cmd-cli", + "version": "0.0.0", + "description": "Single Command CLI", + "private": true, + "oclif": { + "default": ".", + "commands": "./dist" + } +} diff --git a/test/command/fixtures/single-cmd-cli-deprecated/src/index.ts b/test/command/fixtures/single-cmd-cli-deprecated/src/index.ts new file mode 100644 index 000000000..4a11aea3a --- /dev/null +++ b/test/command/fixtures/single-cmd-cli-deprecated/src/index.ts @@ -0,0 +1,9 @@ +// eslint-disable-next-line node/no-unpublished-import +import {Command} from '../../../../../src/index' + +export default class FooBar extends Command { + public static description = 'Description of single command CLI.' + public async run(): Promise { + this.log('hello world!') + } +} diff --git a/test/command/fixtures/single-cmd-cli-deprecated/tsconfig.json b/test/command/fixtures/single-cmd-cli-deprecated/tsconfig.json new file mode 100644 index 000000000..968ea6fbe --- /dev/null +++ b/test/command/fixtures/single-cmd-cli-deprecated/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDirs": ["./src"] + }, + "include": ["./src/**/*"] +}