Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49581ef

Browse files
committed
add ESLint; run a test file
1 parent 9a662a5 commit 49581ef

15 files changed

+2377
-399
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# dependencies
2+
*/node_modules/*
3+
4+
# public files

.eslintrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"airbnb-base"
9+
],
10+
"globals": {
11+
"Atomics": "readonly",
12+
"SharedArrayBuffer": "readonly"
13+
},
14+
"parserOptions": {
15+
"ecmaVersion": 2018,
16+
"sourceType": "module"
17+
},
18+
"rules": {
19+
}
20+
}

README.md

Lines changed: 15 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,43 @@
1-
# DOCKER-WECHATY-GETTING-STARTED
1+
# Coderbunker Wechaty Bot
22

3-
[![Powered by Wechaty](https://img.shields.io/badge/Powered%20By-Wechaty-blue.svg)](https://github.com/chatie/wechaty)
4-
[![Docker Pulls](https://img.shields.io/docker/pulls/zixia/wechaty.svg?maxAge=2592000)](https://hub.docker.com/r/zixia/wechaty/)
5-
[![Docker Stars](https://img.shields.io/docker/stars/zixia/wechaty.svg?maxAge=2592000)](https://hub.docker.com/r/zixia/wechaty/)
6-
[![Docker Layers](https://images.microbadger.com/badges/image/zixia/wechaty.svg)](https://microbadger.com/#/images/zixia/wechaty)
7-
[![Build Status](https://travis-ci.com/Chatie/docker-wechaty-getting-started.svg?branch=master)](https://travis-ci.com/Chatie/docker-wechaty-getting-started)
83

9-
[![dockeri.co](http://dockeri.co/image/zixia/wechaty)](https://hub.docker.com/r/zixia/wechaty/)
10-
11-
Getting Started Template for Docker Users
124

135
## FEATURES
146

15-
1. Wechaty is fully dockerized. So it will be very easy to be used as a MicroService.
16-
1. Clone this repository, then you will be able to use Docker to run Wechaty with ZERO configuration.
7+
178

189
## REQUIREMENTS
1910

2011
1. Docker
21-
1. Global Internet Connection
12+
2. Node.js v10.16.0
13+
3. yarn
2214

2315
## USAGE
2416

25-
### 1. Run Bot Examples
26-
27-
#### 1.1 Run Vanilla Javascript Example
28-
29-
Source code at `src/javascript-vanilla.js`
17+
### 1. Install Dependencies
3018

31-
```shell
32-
bin/docker-run-javascript-vanilla.sh
3319
```
34-
35-
#### 1.2. Run ES6 Javascript Example
36-
37-
Source code at `src/javascript-es6.js`
38-
39-
```shell
40-
bin/docker-run-javascript-es6.sh
20+
yarn install
4121
```
4222

43-
#### 1.3 Run TypeScript Example
23+
### 2. Make Docker Run
4424

45-
Source code at `src/typescript.ts`
25+
### 3. Run the Project
4626

47-
```shell
48-
bin/docker-run-typescript.sh
4927
```
50-
51-
### 2. Set Environment Variables
52-
53-
The above scripts(`bin/docker-run-*.sh`) will pass all environment variables that start with `WECHATY_` from current shell to the Docker container.
54-
55-
All you need is just to set it under the shell before you run the `bin/docker-run-*.sh`.
56-
57-
```shell
58-
export WECHATY_LOG=verbose
28+
yarn start
5929
```
6030

61-
## DOCKER
31+
### Others
6232

63-
### Install Docker
33+
#### Code Style Testing with ESLint
6434

65-
Quick & easy install Docker via:
35+
Coderbunker Wechaty Bot supports Airbnb's JavaScript Style by ESLint. To test if your code is with the right code style, you have to run ESLint:
6636

67-
```shell
68-
curl -sSL https://get.docker.com | sh
6937
```
70-
71-
Or
72-
73-
```shell
74-
wget -qO- https://get.docker.com/ | sh
38+
yarn run lint
7539
```
7640

77-
Get to know more about Docker at: <https://www.docker.com/>
78-
79-
### Use Docker Registry China Mirror
80-
81-
Thanks Docker, there's a official registry mirror in China, and you can use it by adding `registry.docker-cn.com/` in front of the image name:
82-
83-
```diff
84-
- docker pull zixia/wechaty
85-
+ docker pull registry.docker-cn.com/zixia/wechaty
86-
```
87-
88-
Learn more about CN mirror:
89-
90-
- https://www.docker-cn.com/registry-mirror
91-
- https://docs.docker.com/registry/recipes/mirror/#use-case-the-china-registry-mirror
92-
93-
## TEST
94-
95-
BATS: [HOW TO USE BATS TO TEST YOUR COMMAND LINE TOOLS](https://www.engineyard.com/blog/bats-test-command-line-tools)
96-
97-
## SEE ALSO
98-
99-
1. Wechaty Getting Started: <https://github.com/wechaty/wechaty-getting-started>
100-
2. Heroku Wechaty Getting Started: <https://github.com/wechaty/heroku-wechaty-getting-started>
101-
102-
## AUTHOR
103-
104-
[Huan LI](http://linkedin.com/in/zixia) \<[email protected]\>
105-
106-
<a href="https://stackexchange.com/users/265499">
107-
<img src="https://stackexchange.com/users/flair/265499.png" width="208" height="58" alt="profile for zixia on Stack Exchange, a network of free, community-driven Q&amp;A sites" title="profile for zixia on Stack Exchange, a network of free, community-driven Q&amp;A sites">
108-
</a>
109-
110-
## COPYRIGHT & LICENSE
41+
## SPECIAL THANKS
11142

112-
- Code & Docs © 2018 Huan LI \<[email protected]\>
113-
- Code released under the Apache-2.0 License
114-
- Docs released under Creative Commons
43+
Based on [wechaty/docker-wechaty-getting-started](https://github.com/wechaty/docker-wechaty-getting-started)

bin/docker-config.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# WECHATY_IMAGE=zixia/wechaty:0.20
1+
WECHATY_IMAGE=zixia/wechaty:0.22
22

33
# Docker Registry Officla Mirror for China Users
44
# https://www.docker-cn.com/registry-mirror
55
# https://docs.docker.com/registry/recipes/mirror/#use-case-the-china-registry-mirror
6-
WECHATY_IMAGE=registry.docker-cn.com/zixia/wechaty:0.20
6+
#WECHATY_IMAGE=registry.docker-cn.com/zixia/wechaty:0.20
77

88
function docker::env () {
99
for var in "$@"

bin/docker-run-bot.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
bash -x bin/docker-run.sh src/app.js

bin/docker-run-javascript-es6.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

bin/docker-run-javascript-vanilla.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

bin/docker-run-typescript.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)