From 1d2683387bf41748bda7021b9915334364132a36 Mon Sep 17 00:00:00 2001 From: Saurav Panda Date: Fri, 13 Dec 2024 00:06:36 -0800 Subject: [PATCH] added option to skip the configuration part --- packages/create-app/package.json | 2 +- packages/create-app/src/index.ts | 39 ++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/packages/create-app/package.json b/packages/create-app/package.json index 0d2f666..3faa9ed 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -1,6 +1,6 @@ { "name": "create-akiradocs", - "version": "1.0.47", + "version": "1.0.48", "description": "Create Akira Docs documentation sites with one command", "main": "./dist/index.js", "type": "module", diff --git a/packages/create-app/src/index.ts b/packages/create-app/src/index.ts index 5cda062..80035dd 100644 --- a/packages/create-app/src/index.ts +++ b/packages/create-app/src/index.ts @@ -173,16 +173,37 @@ async function main() { cli .command('[directory]', 'Create a new Akira Docs site') - .action(async (directory: string = '.') => { + .option('--yes', 'Skip prompts and use default values') + .action(async (directory: string = '.', options: { yes?: boolean }) => { try { - const editorResponse = await enquirer.prompt<{ includeEditor: boolean }>({ - type: 'confirm', - name: 'includeEditor', - message: 'Would you like to include the local editor? (Recommended for development)', - initial: true, - }); - - const configAnswers = await promptConfigQuestions(); + let editorResponse; + let configAnswers; + + if (options.yes) { + // Use default values without prompting + editorResponse = { includeEditor: true }; + configAnswers = { + siteTitle: 'My Documentation', + siteDescription: 'Documentation powered by Akira Docs', + companyName: 'My Company', + githubUrl: '', + twitterUrl: '', + linkedinUrl: '', + enableAnalytics: false, + googleAnalyticsId: '', + enableAutoTranslate: false + }; + } else { + // Existing prompt flow + editorResponse = await enquirer.prompt<{ includeEditor: boolean }>({ + type: 'confirm', + name: 'includeEditor', + message: 'Would you like to include the local editor? (Recommended for development)', + initial: true, + }); + + configAnswers = await promptConfigQuestions(); + } const spinner = ora('Creating project...').start();