node-committer
Advanced tools
| 'use strict'; | ||
| const prURL = 'https://github.com/nodejs/node/pull/'; | ||
| const issueURL = 'https://github.com/nodejs/node/issues/'; | ||
| const createFormat = (pr, reviewers, issue) => { | ||
| return `PR-URL: ${prURL}${pr}\n` + | ||
| (issue !== '' ? `Fixes: ${issueURL}${issue}\n` : '') + | ||
| reviewers.map((reviewer) => `Reviewed-By: ${reviewer}`).join('\n'); | ||
| }; | ||
| module.exports = createFormat; |
| 'use strict'; | ||
| const axios = require('axios'); | ||
| const readmeURL = 'https://raw.githubusercontent.com/nodejs/node/master/README.md'; | ||
| const fetchMemberInfo = () => { | ||
| const users = {}; | ||
| return axios | ||
| .get(readmeURL) | ||
| .then((res) => { | ||
| const strs = res.data.split('\n'); | ||
| for (let i = 0; i < strs.length; i++) { | ||
| const user = strs[i]; | ||
| if (user.match(/\* \[.*]\(https:\/\/github.com\/.*\) -$/) !== null) { | ||
| const key = user | ||
| .match(/\[.*\]/g)[0] | ||
| .slice(1, -1); | ||
| const info = strs[i + 1] | ||
| .replace(/\*\*/g, '') | ||
| .replace('<', '<') | ||
| .replace('>', '>') | ||
| .replace(/ \(.*\)$/g, ''); // personal pronoun | ||
| users[key] = info; | ||
| i++; | ||
| } | ||
| } | ||
| return users; | ||
| }); | ||
| }; | ||
| module.exports = fetchMemberInfo; |
+47
| 'use strict'; | ||
| const inquirer = require('inquirer'); | ||
| const createFormat = require('./create-format'); | ||
| const questions = [ | ||
| { | ||
| type : 'input', | ||
| name : 'pr', | ||
| message : 'What\'s Pull-Request number?', | ||
| validate: (v) => { | ||
| if (v.match(/[1-9]+/)) return true; | ||
| return false; | ||
| } | ||
| }, | ||
| { | ||
| type : 'checkbox', | ||
| name : 'reviewer', | ||
| choices: [], | ||
| message: 'Who made this review?' | ||
| }, | ||
| { | ||
| type : 'input', | ||
| name : 'issue', | ||
| message : 'What\'s Issue number?', | ||
| validate: (v) => { | ||
| if (v.match(/[1-9]*/)) return true; | ||
| return false; | ||
| } | ||
| } | ||
| ]; | ||
| const main = (memberList) => { | ||
| questions[1].choices = Object.keys(memberList); | ||
| questions[1].choices.push(new inquirer.Separator('-----------')); | ||
| inquirer | ||
| .prompt(questions) | ||
| .then((ans) => { | ||
| const reviewers = ans.reviewer.map((e) => memberList[e]); | ||
| console.log(); | ||
| console.log(createFormat(ans.pr, reviewers, ans.issue)); | ||
| }); | ||
| }; | ||
| module.exports = main; |
+3
-2
@@ -5,7 +5,8 @@ { | ||
| "author": "(http://about-hiroppy.com) abouthiroppy <git@about-hiroppy.com>", | ||
| "version": "0.2.1", | ||
| "version": "0.2.2", | ||
| "license": "MIT", | ||
| "description": "Commit formatter for node.", | ||
| "files": [ | ||
| "bin" | ||
| "bin", | ||
| "lib" | ||
| ], | ||
@@ -12,0 +13,0 @@ "keywords": [ |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
5887
61.51%8
60%96
433.33%