From 631a9257cb37c4e814d6e798f635a39fe7637d13 Mon Sep 17 00:00:00 2001 From: Huan LI Date: Thu, 9 Apr 2020 15:41:48 +0800 Subject: [PATCH 1/3] add heroku local command and pull .env back support --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index d2dc270..d0d1612 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "node": "10" }, "scripts": { + "heroku:env": "heroku config -s -a oss-chat | sed 's/\\\\\\\\/\\\\/g' | tee .env", + "heroku:local": "heroku local", "clean": "shx rm -fr dist/*", "dist": "npm run build", "build": "tsc", From 10c782bfaf24da83469ff848ef358200087b1d0e Mon Sep 17 00:00:00 2001 From: Huan LI Date: Thu, 9 Apr 2020 15:41:57 +0800 Subject: [PATCH 2/3] add heroku local command and pull .env back support --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2f99ef1..82f1435 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ To be added... - [Scaling your Redux App with ducks](https://www.freecodecamp.org/news/scaling-your-redux-app-with-ducks-6115955638be/) - [Redux Style Guide](https://redux.js.org/style-guide/style-guide#do-not-put-non-serializable-values-in-state-or-actions) +- [Run your app locally using the Heroku Local command line tool](https://devcenter.heroku.com/articles/heroku-local) ## Copyright & License From c356cd55f267a74c70819476025fa3e47bcaf697 Mon Sep 17 00:00:00 2001 From: Huan LI Date: Thu, 9 Apr 2020 17:27:03 +0800 Subject: [PATCH 3/3] add CHANGELOG --- .gitignore | 1 + CHANGELOG.md | 99 +++++++++++++++++++++++ README.md | 24 +++--- package.json | 1 + scripts/sort-contributiveness.ts | 133 +++++++++++++++++++++++++++++++ 5 files changed, 245 insertions(+), 13 deletions(-) create mode 100644 CHANGELOG.md create mode 100755 scripts/sort-contributiveness.ts diff --git a/.gitignore b/.gitignore index 59c70eb..a5898eb 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,4 @@ dist/ /docs/build/ /docs/make.* *.swp +*.bak diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7badba6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,99 @@ + +# CHANGELOG + +## OssChat Contributors + +### 1 Active Contributors + +1. @[huan](https://github.com/huan): [\#96](https://github.com/kaiyuanshe/osschat/pull/96) [\#89](https://github.com/kaiyuanshe/osschat/pull/89) [\#33](https://github.com/kaiyuanshe/osschat/pull/33) [\#27](https://github.com/kaiyuanshe/osschat/pull/27) [\#25](https://github.com/kaiyuanshe/osschat/pull/25) [\#22](https://github.com/kaiyuanshe/osschat/pull/22) [\#21](https://github.com/kaiyuanshe/osschat/pull/21) [\#10](https://github.com/kaiyuanshe/osschat/pull/10) [\#9](https://github.com/kaiyuanshe/osschat/pull/9) [\#8](https://github.com/kaiyuanshe/osschat/pull/8) +1. @[lijiarui](https://github.com/lijiarui): [\#91](https://github.com/kaiyuanshe/osschat/pull/91) [\#84](https://github.com/kaiyuanshe/osschat/pull/84) [\#20](https://github.com/kaiyuanshe/osschat/pull/20) [\#17](https://github.com/kaiyuanshe/osschat/pull/17) [\#16](https://github.com/kaiyuanshe/osschat/pull/16) [\#5](https://github.com/kaiyuanshe/osschat/pull/5) +1. @[dailidong](https://github.com/dailidong): [\#87](https://github.com/kaiyuanshe/osschat/pull/87) [\#86](https://github.com/kaiyuanshe/osschat/pull/86) [\#74](https://github.com/kaiyuanshe/osschat/pull/74) [\#73](https://github.com/kaiyuanshe/osschat/pull/73) [\#72](https://github.com/kaiyuanshe/osschat/pull/72) [\#62](https://github.com/kaiyuanshe/osschat/pull/62) +1. @[jixuan1989](https://github.com/jixuan1989): [\#93](https://github.com/kaiyuanshe/osschat/pull/93) [\#92](https://github.com/kaiyuanshe/osschat/pull/92) [\#30](https://github.com/kaiyuanshe/osschat/pull/30) +1. @[zhuangbiaowei](https://github.com/zhuangbiaowei): [\#26](https://github.com/kaiyuanshe/osschat/pull/26) [\#24](https://github.com/kaiyuanshe/osschat/pull/24) [\#6](https://github.com/kaiyuanshe/osschat/pull/6) +1. @[tuohai666](https://github.com/tuohai666): [\#77](https://github.com/kaiyuanshe/osschat/pull/77) [\#70](https://github.com/kaiyuanshe/osschat/pull/70) +1. @[francis-du](https://github.com/francis-du): [\#76](https://github.com/kaiyuanshe/osschat/pull/76) [\#54](https://github.com/kaiyuanshe/osschat/pull/54) + +### 2 Contributors + +1. @[DSExtension](https://github.com/DSExtension): [\#55](https://github.com/kaiyuanshe/osschat/pull/55) +1. @[qiaojialin](https://github.com/qiaojialin): [\#51](https://github.com/kaiyuanshe/osschat/pull/51) +1. @[morningman](https://github.com/morningman): [\#80](https://github.com/kaiyuanshe/osschat/pull/80) +1. @[windmemory](https://github.com/windmemory): [\#23](https://github.com/kaiyuanshe/osschat/pull/23) + +# Change Log + +## [Unreleased](https://github.com/kaiyuanshe/osschat/tree/HEAD) + +[Full Changelog](https://github.com/kaiyuanshe/osschat/compare/f8da589c26a9b12ed5908a9a98beaa2c043273cb...HEAD) + +**Implemented enhancements:** + +- Strong Available Checking: HA ding/dong with Redux Observable on Chatie cloud service [\#97](https://github.com/kaiyuanshe/osschat/issues/97) +- Support WeChat Work [\#85](https://github.com/kaiyuanshe/osschat/issues/85) +- \[DOC\] - Create a static documentation site based on Readthedocs [\#75](https://github.com/kaiyuanshe/osschat/issues/75) +- \[Request\] Create a GitHub team: osschat [\#67](https://github.com/kaiyuanshe/osschat/issues/67) +- OSS.Chat is ready to go [\#64](https://github.com/kaiyuanshe/osschat/issues/64) +- How to install osschat for Apache project [\#63](https://github.com/kaiyuanshe/osschat/issues/63) +- New Feature HA: Add Support to High Available mode [\#58](https://github.com/kaiyuanshe/osschat/issues/58) +- \[Feature\] Support regex/Wildcard in orgRepo config [\#57](https://github.com/kaiyuanshe/osschat/issues/57) +- Feature: report every issue message card to chatops room [\#56](https://github.com/kaiyuanshe/osschat/issues/56) +- Log received messages to ChatOps room [\#49](https://github.com/kaiyuanshe/osschat/issues/49) +- Test Issue to WeChat [\#43](https://github.com/kaiyuanshe/osschat/issues/43) +- Create GitHub apps: osschat \[bot\] [\#32](https://github.com/kaiyuanshe/osschat/issues/32) +- A new issue that be created or replied, will be sent to the wechat group by oss bot. [\#11](https://github.com/kaiyuanshe/osschat/issues/11) +- Enable ChatOps [\#7](https://github.com/kaiyuanshe/osschat/issues/7) +- Initialize the Project Repository [\#2](https://github.com/kaiyuanshe/osschat/issues/2) + +**Fixed bugs:** + +- rejection: Error: no message rawPayload for image [\#69](https://github.com/kaiyuanshe/osschat/issues/69) +- Bug: can not deal with upper case names \(org & repo\) properly [\#53](https://github.com/kaiyuanshe/osschat/issues/53) +- Duplicated Issue Card [\#48](https://github.com/kaiyuanshe/osschat/issues/48) + +**Closed issues:** + +- \[Feature\] Write “how to use” document [\#66](https://github.com/kaiyuanshe/osschat/issues/66) +- Compile failed [\#31](https://github.com/kaiyuanshe/osschat/issues/31) + +**Merged pull requests:** + +- WIP for HA ding/dong with Redux Observable [\#96](https://github.com/kaiyuanshe/osschat/pull/96) ([huan](https://github.com/huan)) +- move repo name to the end of the message title for comments [\#93](https://github.com/kaiyuanshe/osschat/pull/93) ([jixuan1989](https://github.com/jixuan1989)) +- move repo name to the end of the message title [\#92](https://github.com/kaiyuanshe/osschat/pull/92) ([jixuan1989](https://github.com/jixuan1989)) +- hide bot key [\#91](https://github.com/kaiyuanshe/osschat/pull/91) ([lijiarui](https://github.com/lijiarui)) +- Add High Available mode support [\#89](https://github.com/kaiyuanshe/osschat/pull/89) ([huan](https://github.com/huan)) +- add How to use link on Readme [\#87](https://github.com/kaiyuanshe/osschat/pull/87) ([dailidong](https://github.com/dailidong)) +- add user group for dolphinscheduler [\#86](https://github.com/kaiyuanshe/osschat/pull/86) ([dailidong](https://github.com/dailidong)) +- add wx-work bot template [\#84](https://github.com/kaiyuanshe/osschat/pull/84) ([lijiarui](https://github.com/lijiarui)) +- Update config.ts to add Apache Doris incubating [\#80](https://github.com/kaiyuanshe/osschat/pull/80) ([morningman](https://github.com/morningman)) +- add shardingsphere group [\#77](https://github.com/kaiyuanshe/osschat/pull/77) ([tuohai666](https://github.com/tuohai666)) +- \[DOC\] - Create a static documentation site based on Readthedocs. [\#76](https://github.com/kaiyuanshe/osschat/pull/76) ([francis-du](https://github.com/francis-du)) +- update spell error [\#74](https://github.com/kaiyuanshe/osschat/pull/74) ([dailidong](https://github.com/dailidong)) +- Create how\_to\_use.md [\#73](https://github.com/kaiyuanshe/osschat/pull/73) ([dailidong](https://github.com/dailidong)) +- add oss chat for dolphinscheduler [\#72](https://github.com/kaiyuanshe/osschat/pull/72) ([dailidong](https://github.com/dailidong)) +- add shardingsphere [\#70](https://github.com/kaiyuanshe/osschat/pull/70) ([tuohai666](https://github.com/tuohai666)) +- test the entire process for writting “how to use” doc [\#62](https://github.com/kaiyuanshe/osschat/pull/62) ([dailidong](https://github.com/dailidong)) +- update dsextension to DSExtension [\#55](https://github.com/kaiyuanshe/osschat/pull/55) ([DSExtension](https://github.com/DSExtension)) +- Add Quicksql Wechat group config [\#54](https://github.com/kaiyuanshe/osschat/pull/54) ([francis-du](https://github.com/francis-du)) +- add IoTDB wechat link [\#51](https://github.com/kaiyuanshe/osschat/pull/51) ([qiaojialin](https://github.com/qiaojialin)) +- enable github webhook & issue to wechat [\#33](https://github.com/kaiyuanshe/osschat/pull/33) ([huan](https://github.com/huan)) +- Add Preliminary for compiling source code [\#30](https://github.com/kaiyuanshe/osschat/pull/30) ([jixuan1989](https://github.com/jixuan1989)) +- Enable Urllink [\#27](https://github.com/kaiyuanshe/osschat/pull/27) ([huan](https://github.com/huan)) +- feat: Add debug mode [\#26](https://github.com/kaiyuanshe/osschat/pull/26) ([zhuangbiaowei](https://github.com/zhuangbiaowei)) +- show room id [\#25](https://github.com/kaiyuanshe/osschat/pull/25) ([huan](https://github.com/huan)) +- feat: list robot joined rooms [\#24](https://github.com/kaiyuanshe/osschat/pull/24) ([zhuangbiaowei](https://github.com/zhuangbiaowei)) +- feat:add vote manager to manage group with vote rules [\#23](https://github.com/kaiyuanshe/osschat/pull/23) ([windmemory](https://github.com/windmemory)) +- init FAQ [\#22](https://github.com/kaiyuanshe/osschat/pull/22) ([huan](https://github.com/huan)) +- Find chatops room by id instead of the topic. [\#21](https://github.com/kaiyuanshe/osschat/pull/21) ([huan](https://github.com/huan)) +- add issue&pr template [\#20](https://github.com/kaiyuanshe/osschat/pull/20) ([lijiarui](https://github.com/lijiarui)) +- add how to run [\#17](https://github.com/kaiyuanshe/osschat/pull/17) ([lijiarui](https://github.com/lijiarui)) +- add room join demo \#12 [\#16](https://github.com/kaiyuanshe/osschat/pull/16) ([lijiarui](https://github.com/lijiarui)) +- add sponsors in README [\#10](https://github.com/kaiyuanshe/osschat/pull/10) ([huan](https://github.com/huan)) +- Chatops [\#9](https://github.com/kaiyuanshe/osschat/pull/9) ([huan](https://github.com/huan)) +- Chatops \(\#7\) [\#8](https://github.com/kaiyuanshe/osschat/pull/8) ([huan](https://github.com/huan)) +- add Me to Committers [\#6](https://github.com/kaiyuanshe/osschat/pull/6) ([zhuangbiaowei](https://github.com/zhuangbiaowei)) +- add committer [\#5](https://github.com/kaiyuanshe/osschat/pull/5) ([lijiarui](https://github.com/lijiarui)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/README.md b/README.md index 82f1435..05b77ea 100644 --- a/README.md +++ b/README.md @@ -21,23 +21,22 @@ OSSChat will serve users as a cloud service. TBD -## Preliminary +## Run OSSChat locally -To compile OSSChat, typescript environment is needed. If you have `npm`, you can run: +To run OSSChat, Node.js is required. + +Install [Node.js](https://nodejs.org) first if you are not. ```shell npm install +npm run heroku:local ``` -## Run - -```shell -./node_modules/.bin/ts-node bin/main.ts -``` +Then visit -### Localhost +### Output Messages -You can get the following result, open , scan qrcode and begin to use the bot! +After started the bot you should see the following log messages: ```shell 16:57:45 INFO Wechaty (heroku-wechaty) start() v0.29.7 is starting... @@ -54,14 +53,13 @@ OSSChat v0.0.24) ### Advance -1. Using docker to get a more stable version -2. Using an advance puppet to get a more stable version +1. Using an advance puppet to get a more stable version. Learn more about it from the [Wechaty Puppet Directory](https://github.com/wechaty/wechaty-puppet/wiki/Directory) -## Staging +## DevOps & CI/CD We are current DevOps the master branch from the repo to Heroku under the protection of Travis CI. -You can visit the staging system at +You can visit the online system at ## How to use diff --git a/package.json b/package.json index d0d1612..4c0647f 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "heroku:env": "heroku config -s -a oss-chat | sed 's/\\\\\\\\/\\\\/g' | tee .env", "heroku:local": "heroku local", + "changelog": "github_changelog_generator -u kaiyuanshe -p osschat && sed -i'.bak' /greenkeeper/d CHANGELOG.md && sed -i'.bak' '/An in-range update of/d' CHANGELOG.md && ts-node scripts/sort-contributiveness.ts < CHANGELOG.md > CHANGELOG.new.md 2>/dev/null && cat CHANGELOG.md >> CHANGELOG.new.md && mv CHANGELOG.new.md CHANGELOG.md", "clean": "shx rm -fr dist/*", "dist": "npm run build", "build": "tsc", diff --git a/scripts/sort-contributiveness.ts b/scripts/sort-contributiveness.ts new file mode 100755 index 0000000..c7bd2f1 --- /dev/null +++ b/scripts/sort-contributiveness.ts @@ -0,0 +1,133 @@ +#!/usr/bin/env ts-node +/** + * Wechaty - https://github.com/wechaty/wechaty + * + * @copyright 2016-now Huan LI + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +import * as readline from 'readline' + +const contributeMap: { + [contributor: string]: string[], +} = {} + +function parseLine (line: string): string[] | null { + // [\#264](https://github.com/wechaty/wechaty/pull/264) ([lijiarui](https://github.com/lijiarui)) + // const regex = /(\[\\#\d+\]\([^\)]+\))\s+(\(\[[^]]+\]\([^)]+\)))/i + const regex = /(\[\\#\d+\])(\([^)]+\))\s+\((\[[^\]]+\]\([^)]+\))/ + const matches = regex.exec(line) + if (!matches) { + return null + } + // console.info('match!') + // console.info(matches[1]) // [\#264] + // console.info(matches[2]) // (https://github.com/wechaty/wechaty/pull/264) + // console.info(matches[3]) // ([lijiarui](https://github.com/lijiarui) + return matches +} + +function processLine (line: string): void { + const matches = parseLine(line) + if (matches) { + // console.info('match:', line) + // console.info(matches) + const link = matches[1] + matches[2] + const contributor = matches[3] + // console.info('link:', link) + // console.info('contributor:', contributor) + if (!(contributor in contributeMap)) { + contributeMap[contributor] = [] + } + contributeMap[contributor].push(link) + // console.info(contributiveness) + } else { + console.error('NO match:', line) + } +} + +function outputContributorMd () { + const MIN_MAINTAINER_COMMIT_NUM = 2 + function isMaintainer (committer: string): boolean { + return contributeMap[committer].length >= MIN_MAINTAINER_COMMIT_NUM + } + + const activeContributorList = Object + .keys(contributeMap) + .filter(isMaintainer) + .sort(desc) + + function desc (committerA: string, committerB: string): number { + return contributeMap[committerB].length - contributeMap[committerA].length + } + + console.info([ + '', + '# CHANGELOG', + '', + '## OssChat Contributors', + '', + '### 1 Active Contributors', + '', + ].join('\n')) + + for (const contributor of activeContributorList) { + console.info(`1. @${contributor}: ${contributeMap[contributor].join(' ')}`) + } + + console.info([ + '', + '### 2 Contributors', + '', + ].join('\n')) + + const SKIP_NAME_LIST = [ + 'snyk-bot', + 'gitter-badger', + ] + const SKIP_REGEX = new RegExp(SKIP_NAME_LIST.join('|'), 'i') + for (const contributor of Object.keys(contributeMap).sort(desc)) { + if (SKIP_REGEX.test(contributor)) { + continue + } + if (!activeContributorList.includes(contributor)) { + console.info(`1. @${contributor}: ${contributeMap[contributor].join(' ')}`) + } + } + console.info() + +} + +async function main () { + // https://stackoverflow.com/a/20087094/1123955 + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + terminal: false, + }) + + rl.on('line', processLine) + await new Promise(resolve => rl.on('close', resolve)) + + outputContributorMd() + + return 0 +} + +main() + .then(process.exit) + .catch(e => { + console.error(e) + process.exit(1) + })