Skip to content

Commit 29a20b2

Browse files
author
alexlee-dev
committed
✨Create Interactive Option
1 parent efd4277 commit 29a20b2

3 files changed

Lines changed: 35 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- Interactive option. Use the flag `--interactive` to use this mode.
13+
1214
### Changed
1315

1416
### Removed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import * as Sentry from "@sentry/node";
12
import chalk from "chalk";
23
import commander from "commander";
3-
import * as Sentry from "@sentry/node";
4+
import inquirer from "inquirer";
45

56
Sentry.init({
67
dsn:
@@ -32,7 +33,13 @@ const main = async (): Promise<void> => {
3233
})
3334
.option(
3435
"--typescript",
35-
"use TypeScript as the cli application source language"
36+
"use TypeScript as the cli application source language",
37+
false
38+
)
39+
.option(
40+
"--interactive",
41+
"Have the bootstrapper walk you through the process",
42+
false
3643
)
3744
.on("--help", () => {
3845
console.log(
@@ -52,7 +59,29 @@ const main = async (): Promise<void> => {
5259
return handleIncorrectApplicationName(program);
5360
}
5461

55-
if (program.typescript) language = "ts";
62+
if (program.interactive) {
63+
// * Interactive walk-thru
64+
// * Language
65+
const answers = await inquirer.prompt([
66+
{
67+
type: "list",
68+
name: "language",
69+
message: "Please select a source language:",
70+
choices: [
71+
{ value: "js", name: "JavaScript" },
72+
{ value: "ts", name: "TypeScript" },
73+
],
74+
},
75+
]);
76+
const languageChoice: "js" | "ts" = answers.language;
77+
language = languageChoice;
78+
79+
// TODO - Compiler Choice (Babel vs. other)
80+
// TODO - Add Prettier
81+
// TODO - Add ESLint / Other Linter
82+
// TODO - Menu Color Option
83+
}
84+
if (program.typescript && !program.interactive) language = "ts";
5685

5786
await createProjectDirectory(applicationName, language);
5887

0 commit comments

Comments
 (0)