Skip to content

Commit

Permalink
Merge pull request #218 from Cloud-Code-AI/217-auto-select-default-co…
Browse files Browse the repository at this point in the history
…nfiguration-while-create-app

added option to skip the configuration part
  • Loading branch information
sauravpanda authored Dec 13, 2024
2 parents a329244 + 1d26833 commit 3eb3e2c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/create-app/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
39 changes: 30 additions & 9 deletions packages/create-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 3eb3e2c

Please sign in to comment.