Skip to content

Commit 78b1e3c

Browse files
committed
[Enhance] Command input flow
2 parents 64e7d1d + c6b17b6 commit 78b1e3c

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

bin/main.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import program from "commander"
55
import pkg from "../package.json"
66
import selectShell from "select-shell"
77
import chalk from "chalk"
8-
import inquirer = require("inquirer")
8+
import inquirer from "inquirer"
9+
import fs from "fs"
10+
import path from "path"
911

1012
const welcome = `
1113
███████╗██╗░░░░░░█████╗░░██╗░░░░░░░██╗░░░░░░██████╗░███████╗░█████╗░░█████╗░████████╗░░░░░░░█████╗░██╗░░░░░██╗
@@ -54,6 +56,10 @@ async function nameTheComponent() {
5456
])
5557
}
5658

59+
function createComponent(nameOfComponent: string) {
60+
console.log(fs.existsSync("templates/FunctionalComponent.tsx"))
61+
}
62+
5763
function selectTheNameOfTheComponent() {
5864
list.on("select", async (ontions) => {
5965
shell.echo(chalk.yellow("Select the name of the component."))

dist/bin/main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ const commander_1 = __importDefault(require("commander"));
1919
const package_json_1 = __importDefault(require("../package.json"));
2020
const select_shell_1 = __importDefault(require("select-shell"));
2121
const chalk_1 = __importDefault(require("chalk"));
22-
const inquirer = require("inquirer");
22+
const inquirer_1 = __importDefault(require("inquirer"));
23+
const fs_1 = __importDefault(require("fs"));
2324
const welcome = `
2425
███████╗██╗░░░░░░█████╗░░██╗░░░░░░░██╗░░░░░░██████╗░███████╗░█████╗░░█████╗░████████╗░░░░░░░█████╗░██╗░░░░░██╗
2526
██╔════╝██║░░░░░██╔══██╗░██║░░██╗░░██║░░░░░░██╔══██╗██╔════╝██╔══██╗██╔══██╗╚══██╔══╝░░░░░░██╔══██╗██║░░░░░██║
@@ -58,14 +59,17 @@ function isValidateComponentNaming(name) {
5859
}
5960
function nameTheComponent() {
6061
return __awaiter(this, void 0, void 0, function* () {
61-
return inquirer.prompt([
62+
return inquirer_1.default.prompt([
6263
{
6364
name: "value",
6465
message: "Name of your component (alphaNumeric): "
6566
}
6667
]);
6768
});
6869
}
70+
function createComponent(nameOfComponent) {
71+
console.log(fs_1.default.existsSync("templates/FunctionalComponent.tsx"));
72+
}
6973
function selectTheNameOfTheComponent() {
7074
list.on("select", (ontions) => __awaiter(this, void 0, void 0, function* () {
7175
shelljs_1.default.echo(chalk_1.default.yellow("Select the name of the component."));

templates/FunctionalComponent.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
interface FunctionalComponentsProps {
2+
3+
}
4+
5+
const FunctionalComponents: React.FC<FunctionalComponentsProps> = () => {
6+
return (
7+
<div></div>
8+
)
9+
}
10+
11+
export default FunctionalComponents
12+

0 commit comments

Comments
 (0)