diff --git a/packages/contentful--create-contentful-app/src/index.ts b/packages/contentful--create-contentful-app/src/index.ts index 916a0e75f..f48a3c61d 100755 --- a/packages/contentful--create-contentful-app/src/index.ts +++ b/packages/contentful--create-contentful-app/src/index.ts @@ -131,6 +131,12 @@ async function initProject(appName: string, options: CLIOptions) { } if (!isInteractive && isContentfulTemplate(templateSource) && normalizedOptions.function) { + // If function flag is specified, but no function name is provided, we default to external-references + // for legacy support. + if (normalizedOptions.function === true) { + normalizedOptions.function = 'external-references'; + } + await cloneFunction( fullAppFolder, !!normalizedOptions.javascript, @@ -194,7 +200,7 @@ async function initProject(appName: string, options: CLIOptions) { ].join('\n') ) .option('-a, --action', 'include a hosted app action in the ts or js template') - .option('-f, --function ', 'include the specified function template') + .option('-f, --function [function-template-name]', 'include the specified function template') .action(initProject); await program.parseAsync(); })(); diff --git a/packages/contentful--create-contentful-app/src/types.ts b/packages/contentful--create-contentful-app/src/types.ts index 3beaec64c..229f8a08f 100644 --- a/packages/contentful--create-contentful-app/src/types.ts +++ b/packages/contentful--create-contentful-app/src/types.ts @@ -6,7 +6,7 @@ export type CLIOptions = Partial<{ source: string; example: string; action: boolean; - function: string; + function: string | boolean; }>; export const ContentfulExample = {