Extract cli config type to types.ts

Signed-off-by: Min Kim <minkimcello@gmail.com>
This commit is contained in:
Min Kim
2024-12-21 14:54:27 -05:00
parent b30e7884f2
commit a97e354160
2 changed files with 13 additions and 10 deletions
+2 -10
View File
@@ -19,19 +19,11 @@ import { parse } from 'yaml';
import fs from 'fs-extra';
import { paths } from '../paths';
import { Template, TemplateLocation } from './types';
import { Template, TemplateLocation, CliConfig } from './types';
import defaultTemplates from '../../../templates/all-default-templates';
export function readCliConfig(
cliConfig:
| {
defaults?: boolean;
templates?: TemplateLocation[];
globals?: Record<string, string>;
}
| undefined,
) {
export function readCliConfig(cliConfig: CliConfig) {
let templates: TemplateLocation[] = [];
if (!cliConfig || cliConfig?.defaults) {
+11
View File
@@ -16,6 +16,17 @@
import { Answers, DistinctQuestion } from 'inquirer';
export type CliConfig =
| {
/** Setting this to false will omit default backstage-cli new templates */
defaults?: boolean;
/** Where you can explicitly declare templates */
templates?: TemplateLocation[];
/** For configuring global values that applies to all new plugins/packages */
globals?: Record<string, string>;
}
| undefined;
export interface CreateContext {
/** Whether we are creating something in a monorepo or not */
isMonoRepo: boolean;