Last active
December 25, 2018 05:44
-
-
Save yosh1/30a8bb6b1f92bf9e6e67be46c6bd605e to your computer and use it in GitHub Desktop.
GitHubへのコミットに応じてTwitterのユーザーネームを更新するWEBアプリを一週間で作ろうとした話 ref: https://qiita.com/yoshi1125hisa/items/9201aa3c7bd34fe9e3fe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = Axios.create({ | |
baseURL: 'https://api.github.com/', | |
headers: { | |
'Content-Type': 'application/json', | |
'User-Agent': 'lang-display' | |
}, | |
responseType: 'json' | |
}) | |
const getUniqueRepositories = events => { | |
return events.map(event => { | |
return { | |
url: event.repo.url, | |
commitCount: event.payload.size | |
} | |
}) | |
} | |
const getLastDayPushedRepositories = events => { | |
const lastDay = moment().subtract(moment.duration(1, 'days')) | |
const lastDayPushEvents = events.filter(event => moment(event.created_at).date() === lastDay.date()) | |
return getUniqueRepositories(lastDayPushEvents) | |
} | |
module.exports = userName => { | |
axios.get(`users/${userName}/events`) | |
.then(res => { | |
if (res.status === 200) { | |
const pushEvents = res.data.filter(event => event.type === 'PushEvent') | |
} else { | |
console.error(`Status: ${res.status}\n${res.statusText}`); | |
} | |
}).catch( err => { | |
console.error(err) | |
}) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm ERR! code ELIFECYCLE | |
npm ERR! errno 1 | |
npm ERR! babel-node@6.5.3 postinstall: `node message.js; sleep 10; exit 1;` | |
npm ERR! Exit status 1 | |
npm ERR! | |
npm ERR! Failed at the babel-node@6.5.3 postinstall script. | |
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. | |
npm ERR! A complete log of this run can be found in: | |
npm ERR! /Users/yoshi1125hisa/.npm/_logs/2018-12-19T04_25_07_032Z-debug.log | |
コードbabel-node@latestで1のインストールに失敗しました |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment