From 53cd1fa743d1ef39de77821a17e152d6c234d52a Mon Sep 17 00:00:00 2001 From: Yash Khare Date: Sat, 28 Nov 2020 01:11:03 +0530 Subject: [PATCH 1/2] =?UTF-8?q?=E2=99=BF=20chore:=20Add=20gitgo=20automati?= =?UTF-8?q?cally=20if=20not=20present?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitgo | 23 +++++++++---------- bin/index.js | 58 +++++++++++++++++++++++++++++++++++++++++++++-- package-lock.json | 2 +- 3 files changed, 68 insertions(+), 15 deletions(-) diff --git a/.gitgo b/.gitgo index 2ba36c8..c8cf6c4 100644 --- a/.gitgo +++ b/.gitgo @@ -1,17 +1,18 @@ { "current_issue": { - "number": "53", + "number": "", "labels": [ - "cli", - "enhancement" + "" ], - "title": "Empty specific attributes from .gitgo before pushing it on github" + "title": "" }, "commit_guidelines": [ - "fix #" + "fix:", + " feat:", + " chore:" ], "custom_guidelines": false, - "selected_commit_type": "♿ Improving accessibility", + "selected_commit_type": "", "emojis": { "initial_commit": "tada", "feature": "sparkles", @@ -30,14 +31,12 @@ "wip": "construction" }, "existing_branches": [ - "main", - "test-branch-gen", - "test-commit-gen" + "" ], "current_branch": [ - "Empty-attributes-github" + "" ], - "current_commit_message": "♿ fix #53 Empty specific attributes from .gitgo before pushing it on github", + "current_commit_message": "", "use_emojis": true, "commit_config": false -} +} \ No newline at end of file diff --git a/bin/index.js b/bin/index.js index 1a92cbd..f87bb5a 100755 --- a/bin/index.js +++ b/bin/index.js @@ -59,8 +59,62 @@ program }), "\n" ); - // asks task based questions - getConfigQuestions(); + fs.stat('./.gitgo', function(err, stat) { + if(err == null) { + // asks task based questions + getConfigQuestions(); + } else if (err.code === 'ENOENT') { + // file does not exist + var conf = { + "current_issue": { + "number": "", + "labels": [ + "" + ], + "title": "" + }, + "commit_guidelines": [ + "" + ], + "custom_guidelines": false, + "selected_commit_type": "", + "emojis": { + "initial_commit": "tada", + "feature": "sparkles", + "ui": "art", + "code_quality": "package", + "performance": "racehorse", + "security": "lock", + "config": "wrench", + "accessibility": "wheelchair", + "dev_tools": "rocket", + "docs": "pencil", + "release": "gem", + "bug_fix": "bug", + "crash": "boom", + "cleanup": "fire", + "wip": "construction" + }, + "existing_branches": [], + "current_branch": [ + "" + ], + "current_commit_message": "", + "use_emojis": false, + "commit_config": false + }; + fs.writeFile( + "./.gitgo", + JSON.stringify(conf, null, 2), + (err) => { + if (err) console.log("Error writing file:", err); + } + ); + getConfigQuestions(); + } else { + console.log('Some other error: ', err.code); + } + }); } else { // checks if the directory is a git based repo or not console.log( diff --git a/package-lock.json b/package-lock.json index 49441f3..781af66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gitg0", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { From 9a7f5ab75f84bbd7f6a9cfb0bccb1b24a8b24cbb Mon Sep 17 00:00:00 2001 From: yashk2000 Date: Fri, 27 Nov 2020 19:44:38 +0000 Subject: [PATCH 2/2] :wrench: general: Fix linting with prettier --- bin/index.js | 96 +++++++++++++++++++++++----------------------------- 1 file changed, 43 insertions(+), 53 deletions(-) diff --git a/bin/index.js b/bin/index.js index f87bb5a..af5a7bc 100755 --- a/bin/index.js +++ b/bin/index.js @@ -59,60 +59,50 @@ program }), "\n" ); - fs.stat('./.gitgo', function(err, stat) { - if(err == null) { - // asks task based questions - getConfigQuestions(); - } else if (err.code === 'ENOENT') { - // file does not exist - var conf = { - "current_issue": { - "number": "", - "labels": [ - "" - ], - "title": "" - }, - "commit_guidelines": [ - "" - ], - "custom_guidelines": false, - "selected_commit_type": "", - "emojis": { - "initial_commit": "tada", - "feature": "sparkles", - "ui": "art", - "code_quality": "package", - "performance": "racehorse", - "security": "lock", - "config": "wrench", - "accessibility": "wheelchair", - "dev_tools": "rocket", - "docs": "pencil", - "release": "gem", - "bug_fix": "bug", - "crash": "boom", - "cleanup": "fire", - "wip": "construction" - }, - "existing_branches": [], - "current_branch": [ - "" - ], - "current_commit_message": "", - "use_emojis": false, - "commit_config": false - }; - fs.writeFile( - "./.gitgo", - JSON.stringify(conf, null, 2), - (err) => { - if (err) console.log("Error writing file:", err); - } - ); - getConfigQuestions(); + fs.stat("./.gitgo", function (err, stat) { + if (err == null) { + // asks task based questions + getConfigQuestions(); + } else if (err.code === "ENOENT") { + // file does not exist + var conf = { + current_issue: { + number: "", + labels: [""], + title: "", + }, + commit_guidelines: [""], + custom_guidelines: false, + selected_commit_type: "", + emojis: { + initial_commit: "tada", + feature: "sparkles", + ui: "art", + code_quality: "package", + performance: "racehorse", + security: "lock", + config: "wrench", + accessibility: "wheelchair", + dev_tools: "rocket", + docs: "pencil", + release: "gem", + bug_fix: "bug", + crash: "boom", + cleanup: "fire", + wip: "construction", + }, + existing_branches: [], + current_branch: [""], + current_commit_message: "", + use_emojis: false, + commit_config: false, + }; + fs.writeFile("./.gitgo", JSON.stringify(conf, null, 2), (err) => { + if (err) console.log("Error writing file:", err); + }); + getConfigQuestions(); } else { - console.log('Some other error: ', err.code); + console.log("Some other error: ", err.code); } }); } else {