diff --git a/.gitignore b/.gitignore index a0e7a41d9a89f5ab7c4704d956e7780e3a714e1a..c49e3053189818fe4fd30aafa50c92a32dc69532 100644 --- a/.gitignore +++ b/.gitignore @@ -69,5 +69,5 @@ package-lock.json .babel.json .idea -example/.config -example/.pki +examples/.config +examples/.pki diff --git a/CODEOWNERS b/CODEOWNERS index cdc972171da5ea9960791f5f76dcaab27ba18853..a9a1994704b02d1b34a2efc1fd92bec1447b3fe9 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -3,7 +3,7 @@ # /docs/ @lijiarui @hczhcz @TingYinHelen @ax4 -/example/ @Gcaufy @hczhcz +/examples/ @Gcaufy @hczhcz /src/puppet-web/bridge.*.ts @mukaiu /src/puppet-web/browser.ts @binsee /src/puppet-web/browser-driver.*.ts @xjchengo diff --git a/README.md b/README.md index 0b24e1e574d56c001b4e045ff037c08b240e65ab..b830e654b5b41303c63b68e6cc930026dfc62a51 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Wechaty.instance() // Singleton This bot can log all messages to the console. -You can find more examples from [Wiki](https://github.com/chatie/wechaty/wiki/Example) and [Example Directory](https://github.com/chatie/wechaty/blob/master/example/). +You can find more examples from [Wiki](https://github.com/chatie/wechaty/wiki/Examples) and [Example Directory](https://github.com/chatie/wechaty/blob/master/examples/). GETTING STARTED --------------- diff --git a/examples/hot-reload-bot/index.js b/examples/hot-reload-bot/index.js index 70b792a705df4c7007f6bf5ae5274578a72b6a13..c61095ab5df93b9ff4b465f4872dfc2a1b4265e1 100644 --- a/examples/hot-reload-bot/index.js +++ b/examples/hot-reload-bot/index.js @@ -22,7 +22,7 @@ * * @deprecated * Use hot-import-bot instead - * See: https://github.com/Chatie/wechaty/tree/master/example/hot-import-bot + * See: https://github.com/Chatie/wechaty/tree/master/examples/hot-import-bot * * DEV: docker run -ti -e --rm --volume="$(pwd)":/bot zixia/wechaty index.js * PROD: docker run -ti -e NODE_ENV=production --rm --volume="$(pwd)":/bot zixia/wechaty index.js @@ -113,7 +113,7 @@ console.log(` ATTENTION: This example is DEPRECATED. -Please see https://github.com/Chatie/wechaty/tree/master/example/hot-reload-bot instead. +Please see https://github.com/Chatie/wechaty/tree/master/examples/hot-reload-bot instead. `) diff --git a/package.json b/package.json index a68a72ce7f399fe223fd1cbb4978997ab5a9d944..a9bf3c5fbf65267b5c562343aa56de84a6503f64 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "test:win32": "npm run test:unit:safe", "test:debug": "blue-tape -r ts-node/register -r source-map-support/register src/puppet-web/bridge.spec.ts", "io-client": "ts-node bin/io-client", - "demo": "ts-node example/ding-dong-bot.ts", + "demo": "ts-node examples/ding-dong-bot.ts", "start": "npm run demo" }, "git": { diff --git a/script/docker.sh b/script/docker.sh index b41b1d3db98d0de7f1c418ce6938328ea379611b..111b9c3378254c0688e088cee2b6e289a9083e76 100755 --- a/script/docker.sh +++ b/script/docker.sh @@ -25,8 +25,8 @@ case "$1" in ;; test) - echo "bats test/" - IMAGE_NAME="$imageName" bats test/ + echo "bats tests/" + IMAGE_NAME="$imageName" bats tests/ echo docker run -ti $options -v /dev/shm:/dev/shm "$imageName" test exec docker run -ti $options -v /dev/shm:/dev/shm "$imageName" test diff --git a/script/update-license.ts b/script/update-license.ts index e0819e2672bafa2e610aa60f5896ad2b7e1514bf..397ac1179d232bae62d83c7b07eaaa51d7b0d33c 100755 --- a/script/update-license.ts +++ b/script/update-license.ts @@ -138,7 +138,7 @@ async function glob(pattern): Promise { } async function main(): Promise { - const pattern = '{bin/**/*.ts,example/**/*.{js,ts},src/**/*.{ts,js},test/**/*.ts}' + const pattern = '{bin/**/*.ts,examples/**/*.{js,ts},src/**/*.{ts,js},tests/**/*.ts}' // const pattern = 't.ts' const srcFileList = await glob(pattern) const promiseList = srcFileList.map(updateLicense) diff --git a/src/contact.ts b/src/contact.ts index 99e8e551e2db62c5153f833c1357966b2bd46815..c30a3b6312ed1f0cd0cc1c254cbdaee3d93ea017 100644 --- a/src/contact.ts +++ b/src/contact.ts @@ -102,7 +102,7 @@ const specialContactList: string[] = [ * All wechat contacts(friend) will be encapsulated as a Contact. * * `Contact` is `Sayable`, - * [Example/Contact-Bot]{@link https://github.com/Chatie/wechaty/blob/master/example/contact-bot.ts} + * [Example/Contact-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/contact-bot.ts} */ export class Contact implements Sayable { private static pool = new Map() diff --git a/src/friend-request.ts b/src/friend-request.ts index 007a0b4da83243abe7105a7841ff4bbdf06ebafc..db08060fa35d88d4f0c5f5a59024d54d6b24c1d8 100644 --- a/src/friend-request.ts +++ b/src/friend-request.ts @@ -31,7 +31,7 @@ import Contact from './contact' * 2. receive request(in friend event) * 3. confirmation friendship(friend event) * - * [Example/Friend-Bot]{@link https://github.com/Chatie/wechaty/blob/master/example/friend-bot.ts} + * [Example/Friend-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/friend-bot.ts} */ export abstract class FriendRequest { diff --git a/src/message.ts b/src/message.ts index 32c6f71cced8e9fad3dabdbed8a1e5361b89fb3c..64c67915e8fd99580f1ae249635cd9443d99edb4 100644 --- a/src/message.ts +++ b/src/message.ts @@ -53,7 +53,7 @@ export type TypeName = 'attachment' * All wechat messages will be encapsulated as a Message. * * `Message` is `Sayable`, - * [Example/Ding-Dong-Bot]{@link https://github.com/Chatie/wechaty/blob/master/example/ding-dong-bot.ts} + * [Example/Ding-Dong-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts} */ export class Message implements Sayable { /** @@ -186,7 +186,7 @@ export class Message implements Sayable { /** * Reply a Text or Media File message to the sender. * - * @see {@link https://github.com/Chatie/wechaty/blob/master/example/ding-dong-bot.ts|Example/ding-dong-bot} + * @see {@link https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts|Example/ding-dong-bot} * @param {(string | MediaMessage)} textOrMedia * @param {(Contact|Contact[])} [replyTo] * @returns {Promise} diff --git a/src/room.ts b/src/room.ts index 0bf11e4d341e5a4698dd417170f4c715c0320633..4209725ab8e623870ce9920972bf9a968d26aafa 100644 --- a/src/room.ts +++ b/src/room.ts @@ -80,7 +80,7 @@ export interface MemberQueryFilter { * All wechat rooms(groups) will be encapsulated as a Room. * * `Room` is `Sayable`, - * [Example/Room-Bot]{@link https://github.com/Chatie/wechaty/blob/master/example/room-bot.ts} + * [Example/Room-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/room-bot.ts} */ export class Room extends EventEmitter implements Sayable { private static pool = new Map() diff --git a/src/wechaty.ts b/src/wechaty.ts index 05c8938b9b3bb2c353e953f44a1f71f7524614eb..74e750758e5a2ad2a616a9de6ca92aa8b4b7a830 100644 --- a/src/wechaty.ts +++ b/src/wechaty.ts @@ -294,7 +294,7 @@ export class Wechaty extends EventEmitter implements Sayable { * @param {WechatyEventFunction} listener - Depends on the WechatyEvent * @return {Wechaty} - this for chain * - * More Example Gist: [Example/Friend-Bot]{@link https://github.com/wechaty/wechaty/blob/master/example/friend-bot.ts} + * More Example Gist: [Example/Friend-Bot]{@link https://github.com/wechaty/wechaty/blob/master/examples/friend-bot.ts} * * @example Event:scan * wechaty.on('scan', (url: string, code: number) => { diff --git a/test/README.md b/tests/README.md similarity index 100% rename from test/README.md rename to tests/README.md diff --git a/test/contact.spec.ts b/tests/contact.spec.ts similarity index 100% rename from test/contact.spec.ts rename to tests/contact.spec.ts diff --git a/test/docker.bats b/tests/docker.bats similarity index 100% rename from test/docker.bats rename to tests/docker.bats diff --git a/test/electron.spec.ts b/tests/electron.spec.ts similarity index 100% rename from test/electron.spec.ts rename to tests/electron.spec.ts diff --git a/test/fixtures/docker/es6-import.js b/tests/fixtures/docker/es6-import.js similarity index 100% rename from test/fixtures/docker/es6-import.js rename to tests/fixtures/docker/es6-import.js diff --git a/test/fixtures/docker/import-require.ts b/tests/fixtures/docker/import-require.ts similarity index 100% rename from test/fixtures/docker/import-require.ts rename to tests/fixtures/docker/import-require.ts diff --git a/test/fixtures/docker/js-bot.js b/tests/fixtures/docker/js-bot.js similarity index 100% rename from test/fixtures/docker/js-bot.js rename to tests/fixtures/docker/js-bot.js diff --git a/test/fixtures/docker/syntax-error.js b/tests/fixtures/docker/syntax-error.js similarity index 100% rename from test/fixtures/docker/syntax-error.js rename to tests/fixtures/docker/syntax-error.js diff --git a/test/fixtures/docker/ts-bot.ts b/tests/fixtures/docker/ts-bot.ts similarity index 100% rename from test/fixtures/docker/ts-bot.ts rename to tests/fixtures/docker/ts-bot.ts diff --git a/test/fixtures/docker/type-error.ts b/tests/fixtures/docker/type-error.ts similarity index 100% rename from test/fixtures/docker/type-error.ts rename to tests/fixtures/docker/type-error.ts diff --git a/test/fixtures/docker/with-package-json/package.json b/tests/fixtures/docker/with-package-json/package.json similarity index 100% rename from test/fixtures/docker/with-package-json/package.json rename to tests/fixtures/docker/with-package-json/package.json diff --git a/test/fixtures/docker/with-package-json/with-import-error.ts b/tests/fixtures/docker/with-package-json/with-import-error.ts similarity index 100% rename from test/fixtures/docker/with-package-json/with-import-error.ts rename to tests/fixtures/docker/with-package-json/with-import-error.ts diff --git a/test/fixtures/docker/with-package-json/with-import.ts b/tests/fixtures/docker/with-package-json/with-import.ts similarity index 100% rename from test/fixtures/docker/with-package-json/with-import.ts rename to tests/fixtures/docker/with-package-json/with-import.ts diff --git a/test/fixtures/docker/with-package-json/with-require-error.js b/tests/fixtures/docker/with-package-json/with-require-error.js similarity index 100% rename from test/fixtures/docker/with-package-json/with-require-error.js rename to tests/fixtures/docker/with-package-json/with-require-error.js diff --git a/test/fixtures/docker/with-package-json/with-require.js b/tests/fixtures/docker/with-package-json/with-require.js similarity index 100% rename from test/fixtures/docker/with-package-json/with-require.js rename to tests/fixtures/docker/with-package-json/with-require.js diff --git a/test/fixtures/inject-file.js b/tests/fixtures/inject-file.js similarity index 100% rename from test/fixtures/inject-file.js rename to tests/fixtures/inject-file.js diff --git a/test/fixtures/profile/qq.wechaty.json b/tests/fixtures/profile/qq.wechaty.json similarity index 100% rename from test/fixtures/profile/qq.wechaty.json rename to tests/fixtures/profile/qq.wechaty.json diff --git a/test/fixtures/profile/wechat.wechaty.json b/tests/fixtures/profile/wechat.wechaty.json similarity index 100% rename from test/fixtures/profile/wechat.wechaty.json rename to tests/fixtures/profile/wechat.wechaty.json diff --git a/test/fixtures/smoke-testing.js b/tests/fixtures/smoke-testing.js similarity index 100% rename from test/fixtures/smoke-testing.js rename to tests/fixtures/smoke-testing.js diff --git a/test/node.spec.ts b/tests/node.spec.ts similarity index 100% rename from test/node.spec.ts rename to tests/node.spec.ts diff --git a/test/puppet-web/bridge.spec.ts b/tests/puppet-web/bridge.spec.ts similarity index 100% rename from test/puppet-web/bridge.spec.ts rename to tests/puppet-web/bridge.spec.ts diff --git a/test/puppet-web/event.spec.ts b/tests/puppet-web/event.spec.ts similarity index 100% rename from test/puppet-web/event.spec.ts rename to tests/puppet-web/event.spec.ts diff --git a/test/puppet-web/puppet-web.spec.ts b/tests/puppet-web/puppet-web.spec.ts similarity index 100% rename from test/puppet-web/puppet-web.spec.ts rename to tests/puppet-web/puppet-web.spec.ts diff --git a/test/puppeteer.spec.ts b/tests/puppeteer.spec.ts similarity index 100% rename from test/puppeteer.spec.ts rename to tests/puppeteer.spec.ts diff --git a/test/room.spec.ts b/tests/room.spec.ts similarity index 100% rename from test/room.spec.ts rename to tests/room.spec.ts diff --git a/test/wechaty.spec.ts b/tests/wechaty.spec.ts similarity index 100% rename from test/wechaty.spec.ts rename to tests/wechaty.spec.ts diff --git a/tsconfig.json b/tsconfig.json index 477163f58ff3756d832f8df589fe97b4e7208e90..3c77a8e791ef4ebafcadf50af3d7ac66689bf64b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -28,10 +28,10 @@ ] , "include": [ "bin/*.ts" - , "script/**/*.ts" - , "example/**/*.ts" + , "scripts/**/*.ts" + , "examples/**/*.ts" , "src/**/*.ts" - , "test/**/*.spec.ts" + , "tests/**/*.spec.ts" , "bot/**/*.ts" , "app/**/*.ts" ]