Added question dialogs for README generation

Added all questions listed under fields for the README handeling.

Changelog: added
This commit is contained in:
2024-09-01 08:06:04 -05:00
parent 1b2b02af74
commit b4969fbfd5
3 changed files with 109 additions and 38 deletions

View File

@@ -48,19 +48,19 @@ The goal for this project is to create a tool for creating and managing applicat
- [ ] README Handeling
- [ ] Creation
- [ ] Editing
- [ ] Fields
- [ ] Project Title
- [ ] Project Description
- [ ] Steps to Running the project
- [ ] Guide to Contributing
- [ ] Project Goal
- [ ] Contributers List
- [ ] Project Support Link
- [ ] Development Status
- [ ] Supported Platforms
- [ ] Roadmap
- [ ] Integrations
- [ ] oftware Stack
- [x] Fields
- [x] Project Title
- [x] Project Description
- [x] Steps to Running the project
- [x] Guide to Contributing
- [x] Project Goal
- [x] Contributers List
- [x] Project Support Link
- [x] Development Status
- [x] Supported Platforms
- [x] Roadmap
- [x] Integrations
- [x] Software Stack
- [ ] Git Server Integrations
- [ ] Gitlab
- [ ] GitHub

View File

@@ -1,39 +1,17 @@
#!/usr/bin/env node
import { input, confirm } from "@inquirer/prompts";
import chalk from "chalk";
import figlet from "figlet";
//import shelljs from "shelljs";
import { initializeReadme } from "./initialize.js";
const init = async () => {
console.log(chalk.green(figlet.textSync("project-tool")));
};
const askQuestions = async () => {
// This just handles the contributors loop for adding Contributors to the project
async function projectContributors() {
let addContributor = true;
let contributors = [];
while (addContributor) {
contributors.push(
await input({
message: "Who are the contributors to this project?",
}),
);
addContributor = await confirm({
message: "Add another Contributor?",
default: false,
});
}
return contributors;
}
const answers = {
projectName: await input({ message: "What's your projects name?" }),
projectDescription: await input({ message: "Describe your project:" }),
projectContributors: await projectContributors(),
};
return answers;
return await initializeReadme();
};
const run = async () => {

93
initialize.js Normal file
View File

@@ -0,0 +1,93 @@
import { input, checkbox } from "@inquirer/prompts";
async function numberedList(message, finishingText) {
let results = [];
let count = 1;
let addResult = true;
finishingText = finishingText != "" ? "done" : finishingText;
console.log(message + ` (Type '${finishingText}' after last item.)`);
while (addResult) {
const result = await input({
message: `${count}:`,
});
if (result == "done") {
addResult = false;
} else {
results.push(result);
}
}
return results;
}
async function loopingQuestion(message, subMessage, finishingText = "done") {
let results = [];
let addResult = true;
console.log(message + ` (Type '${finishingText}' after last item.)`);
while (addResult) {
const result = await input({
message: subMessage,
});
if (result == "done") {
addResult = false;
} else {
results.push(result);
}
}
return results;
}
const initializeReadme = async () => {
async function supportedPlatforms() {
let platformList = [
"Linux",
"Android",
"Windows",
"iOS",
"iPadOS",
"MacOS",
];
let platforms = await checkbox({
message: "Select the platforms your project supports",
choices: platformList.map((platform) => {
return { value: platform };
}),
});
return platforms;
}
const answers = {
projectName: await input({ message: "What's your projects name?" }),
projectDescription: await input({ message: "Describe your project:" }),
runningTheProject: await numberedList(
"What are the steps that need to be taken to run the project?",
),
contributionGuide: await numberedList(
"What does it take to contribute to this project?",
),
projectGoal: await input({ message: "What is the Goal of the project?" }),
projectContributors: await loopingQuestion(
"Who are the contributors to this project?",
"Contributor:",
),
supportLink: await input({ message: "What is the support Link?" }),
developmentStatus: "Active",
supportedPlatforms: await supportedPlatforms(),
roadmap: await loopingQuestion(
"Give a list of tasks for the project Roadmap",
"Next task:",
),
integrations: await loopingQuestion(
"List the integrations that this project has",
"Next integration:",
),
softwareStack: await loopingQuestion(
"List the software used in this project",
"Software Name:",
),
};
return answers;
};
export { initializeReadme };