diff --git a/.changeset/nervous-dolphins-fix.md b/.changeset/nervous-dolphins-fix.md new file mode 100644 index 00000000..6948ff4a --- /dev/null +++ b/.changeset/nervous-dolphins-fix.md @@ -0,0 +1,5 @@ +--- +"@sumup/foundry": minor +--- + +Added a new `debug` command to inspect the detected configuration options. diff --git a/.changeset/silly-seals-arrive.md b/.changeset/silly-seals-arrive.md new file mode 100644 index 00000000..4b5348ec --- /dev/null +++ b/.changeset/silly-seals-arrive.md @@ -0,0 +1,5 @@ +--- +"@sumup/foundry": minor +--- + +Removed the obsolete `publish` option which hasn't been used since v6. diff --git a/README.md b/README.md index a529ee9e..848f89ee 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,6 @@ Alternatively, you can pass your answers to the `init` command directly as flags ```sh -o, --openSource Whether the project is open-source [boolean] - --publish Whether to publish to NPM [boolean] -c, --configDir The directory to write configs to [string] [default: "."] --overwrite Whether to overwrite existing config files [boolean] [default: false] diff --git a/src/cli/debug.ts b/src/cli/debug.ts index 801b0e71..d4a9b950 100644 --- a/src/cli/debug.ts +++ b/src/cli/debug.ts @@ -13,15 +13,20 @@ * limitations under the License. */ -import { readPackageJson } from '../lib/files'; -import { - warnAboutMissingPlugins, - warnAboutUnsupportedPlugins, -} from '../lib/options'; +import { isArray, isEmpty, mapValues } from 'lodash/fp'; + +import { getOptions } from '../lib/options'; +import * as logger from '../lib/logger'; export function debug(): void { - const packageJson = readPackageJson(); + const options = getOptions(); + + const stringifiedOptions = mapValues( + (value) => (isArray(value) && !isEmpty(value) ? value.join(', ') : value), + options, + ); - warnAboutUnsupportedPlugins(packageJson); - warnAboutMissingPlugins(packageJson); + logger.empty(); + logger.info('Detected configuration:'); + logger.table(stringifiedOptions); } diff --git a/src/cli/defaults.ts b/src/cli/defaults.ts index 43694884..b082bcfd 100644 --- a/src/cli/defaults.ts +++ b/src/cli/defaults.ts @@ -18,6 +18,5 @@ import { InitOptions } from '../types/shared'; export const DEFAULT_OPTIONS: InitOptions = { configDir: '.', openSource: false, - publish: false, overwrite: false, }; diff --git a/src/cli/index.ts b/src/cli/index.ts index f1220538..2d1d5f44 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -33,10 +33,6 @@ void yargs desc: 'Whether the project is open-source', type: 'boolean', }, - publish: { - desc: 'Whether to publish to NPM', - type: 'boolean', - }, configDir: { alias: 'c', desc: 'The directory to write configs to', diff --git a/src/cli/init.ts b/src/cli/init.ts index 0d35a5d7..1a0b0349 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -44,7 +44,6 @@ import { DEFAULT_OPTIONS } from './defaults'; export interface InitParams { configDir: string; openSource?: boolean; - publish?: boolean; overwrite?: boolean; $0?: string; _?: string[]; diff --git a/src/lib/logger.ts b/src/lib/logger.ts index 30a2d165..a78e9312 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -58,3 +58,7 @@ export const debug = (arg: LogMessage): void => { export const empty = (): void => { console.log(''); }; + +export const table = (obj: Record): void => { + console.table(obj); +}; diff --git a/src/lib/options.ts b/src/lib/options.ts index 1ee78674..ce0b6d62 100644 --- a/src/lib/options.ts +++ b/src/lib/options.ts @@ -107,7 +107,6 @@ export function getOptions(): Required { frameworks: pick(config.frameworks, detectFrameworks), plugins: pick(config.plugins, detectPlugins), openSource: pick(config.openSource, detectOpenSource), - publish: Boolean(config.publish), }; } diff --git a/src/types/shared.ts b/src/types/shared.ts index 403c1511..0f51130f 100644 --- a/src/types/shared.ts +++ b/src/types/shared.ts @@ -63,7 +63,6 @@ export interface Options { frameworks?: Framework[]; plugins?: Plugin[]; openSource?: boolean; - publish?: boolean; } export interface InitOptions extends Options {