Skip to content

Commit

Permalink
fix: remove the profile type option(#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradumnasaraf authored Jun 2, 2023
1 parent b279270 commit 2cc4906
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 43 deletions.
1 change: 0 additions & 1 deletion src/createjson/helper/createUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const fs = require("fs");
async function createUser(githubUsername, answers) {
jsonSchema = {
name: `${answers.name}`,
type: `${answers.type}`,
bio: `${answers.bio}`,
};
if (answers.links) {
Expand Down
18 changes: 9 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ console.log(
);

const choices = [
"🔗 Create a LinkFree JSON file",
"🔧 Update an existing JSON file",
"🤝 Provide a testimonial to a LinkFree user",
"📅 Add an event",
"🐛 Report a bug",
"Create a LinkFree JSON file",
"Update an existing JSON file",
"Provide a testimonial to a LinkFree user",
"Add an event",
"Report a bug",
];

prompt([
Expand All @@ -31,19 +31,19 @@ prompt([
.then(async (answers) => {
const { selectedtask } = answers;
switch (selectedtask) {
case "🔗 Create a LinkFree JSON file": {
case "Create a LinkFree JSON file": {
createJson();
break;
}
case "🔧 Update an existing JSON file": {
case "Update an existing JSON file": {
checkUpdate();
break;
}
case "🤝 Provide a testimonial to a LinkFree user": {
case "Provide a testimonial to a LinkFree user": {
giveTestimonial();
break;
}
case "📅 Add an event": {
case "Add an event": {
addEvent();
break;
}
Expand Down
6 changes: 0 additions & 6 deletions src/shared/questions/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ async function basics() {
name: "name",
message: "What is your name (e.g. Jone Doe)?",
},
{
type: "select",
name: "type",
message: "Your profile type?",
choices: ["Personal", "Community"],
},
{
type: "input",
name: "bio",
Expand Down
34 changes: 7 additions & 27 deletions src/updatejson/updateJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,6 @@ const updateJson = async (githubUsername) => {
}
});

await prompt([
{
type: "confirm",
name: "type",
message: "Do you want to change your profile type?",
},
]).then(async (answers) => {
if (answers.type) {
isProfileUpdated = true;
await prompt([
{
type: "select",
name: "type",
message: "Your new profile type?",
choices: ["Personal", "Community"],
},
]).then((answers) => (json.type = answers.type));
}
});

await prompt([
{
type: "confirm",
Expand Down Expand Up @@ -108,19 +88,19 @@ const updateJson = async (githubUsername) => {
type: "select",
name: "operation",
message: "What you want to do?",
choices: ["add a tag?", "remove a tag?", "update a tag?"],
choices: ["Add a tag?", "Remove a tag?", "Update a tag?"],
},
]).then(async (answers) => {
switch (answers.operation) {
case "add a tag?": {
case "Add a tag?": {
if (json.tags) {
json.tags = [...json.tags, ...(await addtags(true))];
} else {
json.tags = [...(await addtags(true))];
}
break;
}
case "remove a tag?": {
case "Remove a tag?": {
if (json.tags) {
json.tags = [...(await removetags(json.tags))];
if (json.tags.length === 0) {
Expand Down Expand Up @@ -161,19 +141,19 @@ const updateJson = async (githubUsername) => {
type: "select",
name: "operation",
message: "What you want to do?",
choices: ["add a social?", "remove a social?", "update a social?"],
choices: ["Add a social?", "Remove a social?", "Update a social?"],
},
]).then(async (answers) => {
switch (answers.operation) {
case "add a social?": {
case "Add a social?": {
if (json.socials) {
json.socials = [...json.socials, ...(await addsocials(true))];
} else {
json.socials = [...(await addsocials(true))];
}
break;
}
case "remove a social?": {
case "Remove a social?": {
if (json.socials) {
json.socials = [...(await removesocials(json.socials))];
if (json.socials.length === 0) {
Expand Down Expand Up @@ -396,7 +376,7 @@ const updateJson = async (githubUsername) => {
} else {
console.log(
chalk.black.bgYellow(
`No updates were made in ${githubUsername}.json `
` No updates were made in ${githubUsername}.json `
)
);
}
Expand Down

0 comments on commit 2cc4906

Please sign in to comment.