diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..df3e785 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +# Editor configuration, see http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +max_line_length = 0 +trim_trailing_whitespace = false + +# 4 tab indentation +[Makefile] +indent_style = tab +indent_size = 4 diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml new file mode 100644 index 0000000..32553a6 --- /dev/null +++ b/.github/workflows/npm.yml @@ -0,0 +1,99 @@ +name: NPM + +on: [push, pull_request] + +jobs: + build: + name: Build + strategy: + matrix: + os: + - ubuntu-latest + node-version: + - 16 + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: npm + cache-dependency-path: package.json + + - name: Install Dependencies + run: npm install + + - name: Test + run: npm test + + pack: + name: Pack + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + cache: npm + cache-dependency-path: package.json + + - name: Install Dependencies + run: npm install + + - name: Generate Package JSON + run: ./scripts/generate-package-json.sh + + - name: Pack Testing + run: ./scripts/npm-pack-testing.sh + + publish: + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v')) + name: Publish + needs: + - build + - pack + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + cache: npm + cache-dependency-path: package.json + + - name: Install Dependencies + run: npm install + + - name: Generate Package JSON + run: ./scripts/generate-package-json.sh + + - name: Set Publish Config + run: ./scripts/package-publish-config-tag.sh + + - name: Build Dist + run: npm run dist + + - name: Check Branch + id: check-branch + run: | + if [[ ${{ github.ref }} =~ ^refs/heads/(main|v[0-9]+\.[0-9]+.*)$ ]]; then + echo ::set-output name=match::true + fi # See: https://stackoverflow.com/a/58869470/1123955 + - name: Is A Publish Branch + if: steps.check-branch.outputs.match == 'true' + run: | + NAME=$(npx pkg-jq -r .name) + VERSION=$(npx pkg-jq -r .version) + if npx version-exists "$NAME" "$VERSION" + then echo "$NAME@$VERSION exists on NPM, skipped." + else npm publish + fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Is Not A Publish Branch + if: steps.check-branch.outputs.match != 'true' + run: echo 'Not A Publish Branch' diff --git a/README.md b/README.md index 3552243..7dbb0ee 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ # WECHATY-CHATOPERA +[![ES Modules](https://img.shields.io/badge/ES-Modules-brightgreen)](https://github.com/Chatie/tsconfig/issues/16) + ## INTRODUCTION Bring your bots into Wechat with Wechaty Chatopera Plugin. @@ -24,24 +26,24 @@ Bring your bots into Wechat with Wechaty Chatopera Plugin. To use the plugin: ```ts -import { WechatyChatopera } from "wechaty-chatopera"; +import { WechatyChatopera } from 'wechaty-chatopera' const config = { /** * Chatopera Service ID */ - clientId: "YOUR_CLIENTID", - secret: "YOUR_SECRET", - personalAccessToken: "YOUR_PERSONAL_ACCESS_TOKEN", + clientId: 'YOUR_CLIENTID', + secret: 'YOUR_SECRET', + personalAccessToken: 'YOUR_PERSONAL_ACCESS_TOKEN', faqBestReplyThreshold: 0.8, faqSuggReplyThreshold: 0.2 repoConfig: {} -}; +} -const ChatoperaPlugin = WechatyChatopera(config); +const ChatoperaPlugin = WechatyChatopera(config) -const wechaty = new Wechaty(); -wechaty.use(ChatoperaPlugin); +const wechaty = new Wechaty() +wechaty.use(ChatoperaPlugin) ``` In `config`, either {`personalAccessToken`, `repoConfig`} or {`clientId`, `secret`} must be present. diff --git a/examples/chatopera-bot.ts b/examples/chatopera-bot.ts index 6bdb25e..ede037a 100644 --- a/examples/chatopera-bot.ts +++ b/examples/chatopera-bot.ts @@ -9,7 +9,7 @@ import { log, } from 'wechaty' -import { WechatyChatoperaConfig, WechatyChatopera } from '../src/mod' +import { WechatyChatoperaConfig, WechatyChatopera } from '../src/mod.js' function onLogin (user: Contact) { log.info('Login %s', user) @@ -46,7 +46,7 @@ const bot = new Wechaty({ * https://github.com/wechaty/wechaty-puppet/wiki/Directory */ - puppet: 'wechaty-puppet-hostie', + puppet: 'wechaty-puppet-service', }) const chatoperaConfig: WechatyChatoperaConfig = { diff --git a/package.json b/package.json index 13c8c2c..0dedcc0 100644 --- a/package.json +++ b/package.json @@ -2,46 +2,54 @@ "name": "wechaty-chatopera", "version": "0.4.1", "description": "Chatopera Plugin for Wechaty, deliver chatbots in low-code way. ", - "directories": { - "doc": "docs", - "example": "examples", - "test": "tests" + "type": "module", + "exports": { + ".": { + "import": "./dist/esm/src/mod.js", + "require": "./dist/cjs/src/mod.js" + } + }, + "typings": "./dist/esm/src/mod.d.ts", + "engines": { + "node": ">=16", + "npm": ">=7", + "wechaty": ">=0.77" }, "dependencies": { "@chatopera/sdk": "^2.8.0", "language-monitor": "^1.0.3", - "wechaty-plugin-contrib": "^0.14.2" + "wechaty-plugin-contrib": "^0.17.2" }, "devDependencies": { - "@chatie/eslint-config": "^0.12.1", + "@chatie/eslint-config": "^0.16.2", "@chatie/git-scripts": "^0.6.2", "@chatie/semver": "^0.4.7", - "@chatie/tsconfig": "^0.10.1", - "@types/body-parser": "^1.19.0", - "@types/express": "^4.17.6", - "pkg-jq": "^0.2.4", - "shx": "^0.3.2", - "tstest": "^0.4.10", - "wechaty": "^0.50.5", - "wechaty-puppet-mock": "^0.28.2", - "wechaty-vorpal": "^0.6.11" + "@chatie/tsconfig": "^0.20.6", + "@types/body-parser": "^1.19.1", + "@types/express": "^4.17.13", + "cross-env": "^7.0.3", + "npm-run-all": "^4.1.5", + "pkg-jq": "^0.2.11", + "shx": "^0.3.3", + "tstest": "^0.7.3", + "typescript": "^4.4.4", + "wechaty": "^0.77", + "wechaty-puppet-mock": "^0.35" }, - "main": "dist/src/mod.js", - "typings": "dist/src/mod.d.ts", "scripts": { + "build": "tsc && tsc -p tsconfig.cjs.json", "clean": "shx rm -fr dist/*", - "dist": "npm run clean && tsc", - "pack": "npm pack", - "lint": "npm run lint:es && npm run lint:ts && npm run lint:md", + "dist": "npm-run-all clean build dist:commonjs", + "dist:commonjs": "jq -n \"{ type: \\\"commonjs\\\" }\" > dist/cjs/package.json", + "lint": "npm-run-all lint:es lint:ts lint:md", "lint:md": "markdownlint README.md", - "lint:ts": "tsc --noEmit", - "example": "ts-node examples/ding-dong-bot.ts", + "lint:ts": "tsc --isolatedModules --noEmit", + "example": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" node examples/ding-dong-bot.ts", "start": "npm run example", - "test": "npm run lint && npm run test:unit", + "test": "npm-run-all lint test:unit", "test:pack": "bash -x scripts/npm-pack-testing.sh", - "test:unit": "blue-tape -r ts-node/register \"src/**/*.spec.ts\" \"src/*.spec.ts\" \"tests/*.spec.ts\" \"tests/**/*.spec.ts\"", - "lint:es": "eslint --fix --ignore-pattern tests/fixtures/ \"{bin,examples,scripts,src,tests}/**/*.ts\"", - "prepublish": "npm run dist" + "test:unit": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" tap \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\"", + "lint:es": "eslint --fix --ignore-pattern tests/fixtures/ \"{bin,examples,scripts,src,tests}/**/*.ts\"" }, "repository": { "type": "git", @@ -77,6 +85,9 @@ "dist/", "src/" ], + "tap": { + "check-coverage": false + }, "publishConfig": { "tag": "next" }, diff --git a/scripts/generate-package-json.sh b/scripts/generate-package-json.sh new file mode 100755 index 0000000..111e894 --- /dev/null +++ b/scripts/generate-package-json.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e + +SRC_PACKAGE_JSON_TS_FILE='src/package-json.ts' + +[ -f ${SRC_PACKAGE_JSON_TS_FILE} ] || { + echo ${SRC_PACKAGE_JSON_TS_FILE}" not found" + exit 1 +} + +cat <<_SRC_ > ${SRC_PACKAGE_JSON_TS_FILE} +/** + * This file was auto generated from scripts/generate-version.sh + */ +import type { PackageJson } from 'type-fest' +export const packageJson: PackageJson = $(cat package.json) as any +_SRC_ diff --git a/scripts/generate-version.sh b/scripts/generate-version.sh deleted file mode 100755 index e8ef7f9..0000000 --- a/scripts/generate-version.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -set -e - -SRC_VERSION_TS_FILE='src/version.ts' - -[ -f ${SRC_VERSION_TS_FILE} ] || { - echo ${SRC_VERSION_TS_FILE}" not found" - exit 1 -} - -VERSION=$(npx pkg-jq -r .version) - -cat <<_SRC_ > ${SRC_VERSION_TS_FILE} -/** - * This file was auto generated from scripts/generate-version.sh - */ -export const VERSION: string = '${VERSION}' -_SRC_ diff --git a/scripts/npm-pack-testing.sh b/scripts/npm-pack-testing.sh index 86a8912..69d51d1 100755 --- a/scripts/npm-pack-testing.sh +++ b/scripts/npm-pack-testing.sh @@ -3,27 +3,59 @@ set -e VERSION=$(npx pkg-jq -r .version) -if npx --package @chatie/semver semver-is-prod $VERSION; then +if npx --package @chatie/semver semver-is-prod "$VERSION"; then NPM_TAG=latest else NPM_TAG=next fi npm run dist -npm run pack +npm pack TMPDIR="/tmp/npm-pack-testing.$$" mkdir "$TMPDIR" +trap "rm -fr '$TMPDIR'" EXIT + mv ./*-*.*.*.tgz "$TMPDIR" cp tests/fixtures/smoke-testing.ts "$TMPDIR" cd $TMPDIR + npm init -y -npm install *-*.*.*.tgz \ - @chatie/tsconfig \ +npm install --production ./*-*.*.*.tgz \ + @chatie/tsconfig@$NPM_TAG \ + pkg-jq \ "wechaty@$NPM_TAG" \ -./node_modules/.bin/tsc \ +# +# CommonJS +# +npx tsc \ + --target es6 \ + --module CommonJS \ + \ + --moduleResolution node \ + --esModuleInterop \ + --lib esnext \ + --noEmitOnError \ + --noImplicitAny \ + --skipLibCheck \ + smoke-testing.ts + +echo +echo "CommonJS: pack testing..." +node smoke-testing.js + +# +# ES Modules +# +npx pkg-jq -i '.type="module"' + +npx tsc \ + --target es2020 \ + --module es2020 \ + \ + --moduleResolution node \ --esModuleInterop \ --lib esnext \ --noEmitOnError \ @@ -31,4 +63,6 @@ npm install *-*.*.*.tgz \ --skipLibCheck \ smoke-testing.ts +echo +echo "ES Module: pack testing..." node smoke-testing.js diff --git a/src/asker.spec.ts b/src/asker.spec.ts index 1df37e7..f2718c1 100755 --- a/src/asker.spec.ts +++ b/src/asker.spec.ts @@ -1,9 +1,9 @@ -// #!/usr/bin/env ts-node +// #!/usr/bin/env -S node --no-warnings --loader ts-node/esm // import test from 'tstest' -// import { asker } from './asker' -// import { normalizeConfig } from './normalize-config' +// import { asker } from './asker.js' +// import { normalizeConfig } from './normalize-config.js' // test('asker()', async t => { // // use our normalizeConfig() helper function to get the config: @@ -17,3 +17,5 @@ // answers = await ask('中文', 'test-user-id') // t.equal(answers.length, 0, 'should get no answer for 中文') // }) + +export {} diff --git a/src/asker.ts b/src/asker.ts index fb256b9..cfe3a2d 100644 --- a/src/asker.ts +++ b/src/asker.ts @@ -3,11 +3,11 @@ import { Room, } from 'wechaty' -import { +import type { RepoConfig, ChatoperaOptions, ChatoperaResponse, -} from './chatopera' +} from './chatopera.js' import { md5, @@ -16,7 +16,7 @@ import { import fs from 'fs' import path from 'path' -const { Chatbot, Chatopera } = require('@chatopera/sdk') +import chatoperaSdk from '@chatopera/sdk' const OSSCHAT_FAQ_HASH = 'OSSCHAT_FAQ_HASH' @@ -27,24 +27,32 @@ interface RoomBotConfig { secret: string; } - interface FaqAnswer { +const { + Chatopera, + Chatbot, +} = chatoperaSdk as { + Chatopera: any, + Chatbot: any, +} // Issue #8 - https://github.com/wechaty/wechaty-chatopera/pull/8#issuecomment-945093665 + +interface FaqAnswer { rtype: string content: string enabled: boolean } - interface FaqItem { - id?: string - post: string - categories: string - replies: FaqAnswer[] - extends?: string[] - enabled: boolean - } +interface FaqItem { + id?: string + post: string + categories: string + replies: FaqAnswer[] + extends?: string[] + enabled: boolean +} - interface FaqData { - [fullName: string]: FaqItem[] - } +interface FaqData { + [fullName: string]: FaqItem[] +} /** * capitalize the first letter @@ -223,7 +231,7 @@ async function initBot (defaultOptions?: ChatoperaOptions, repoConfig?: RepoConf log.verbose('WechatyChatopera', 'existed bot for %s(%s)', fullName, botName) } - let roomId = repoConfig[fullName] + let roomId = repoConfig[fullName]! if (!Array.isArray(roomId)) { roomId = [roomId] } @@ -265,7 +273,7 @@ function asker (defaultOptions: ChatoperaOptions, repoConfig?: RepoConfig) { question: string, contactId: string, room?: Room, - ): Promise { + ): Promise { log.verbose('WechatyChatopera', 'ask(%s, %s, %s)', question, contactId, room) const options = await findOption(room?.id) diff --git a/src/chatopera.ts b/src/chatopera.ts index 26c8fb2..dfeba97 100644 --- a/src/chatopera.ts +++ b/src/chatopera.ts @@ -1,4 +1,4 @@ -import { matchers } from 'wechaty-plugin-contrib' +import type { matchers } from 'wechaty-plugin-contrib' export interface RepoConfig { [fullName: string]: string | string[] diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..9fabd10 --- /dev/null +++ b/src/config.ts @@ -0,0 +1,7 @@ +import { packageJson } from './package-json.js' + +const VERSION = packageJson.version || '0.0.0' + +export { + VERSION, +} diff --git a/src/mod.ts b/src/mod.ts index 7cd787f..cdb2dc9 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -1,5 +1,7 @@ -export { VERSION } from './version' +export { VERSION } from './config.js' +export type { + WechatyChatoperaConfig, +} from './plugin.js' export { WechatyChatopera, - WechatyChatoperaConfig, -} from './plugin' +} from './plugin.js' diff --git a/src/normalize-config.ts b/src/normalize-config.ts index a88bb52..ec19ade 100644 --- a/src/normalize-config.ts +++ b/src/normalize-config.ts @@ -1,9 +1,9 @@ -import { WechatyChatoperaConfig } from './plugin' +import type { WechatyChatoperaConfig } from './plugin.js' import { ChatoperaOptions, DEFAULT_CHATOPERA_FAQ_BESTREPLY_THRES, DEFAULT_CHATOPERA_FAQ_SUGGREPLY_THRES, -} from './chatopera' +} from './chatopera.js' function normalizeConfig (config: WechatyChatoperaConfig): ChatoperaOptions { diff --git a/src/package-json.spec.ts b/src/package-json.spec.ts new file mode 100755 index 0000000..5d9cac5 --- /dev/null +++ b/src/package-json.spec.ts @@ -0,0 +1,10 @@ +#!/usr/bin/env -S node --no-warnings --loader ts-node/esm + +import { test } from 'tstest' + +import { packageJson } from './package-json.js' + +test('Make sure the packageJson is fresh in source code', async t => { + const keyNum = Object.keys(packageJson).length + t.equal(keyNum, 0, 'packageJson should be empty in source code, only updated before publish to NPM') +}) diff --git a/src/package-json.ts b/src/package-json.ts new file mode 100644 index 0000000..0a9806f --- /dev/null +++ b/src/package-json.ts @@ -0,0 +1,11 @@ +/** + * This file will be overwrite when we publish NPM module + * by scripts/generate_version.ts + */ +import type { PackageJson } from 'type-fest' + +/** + * Huan(202108): + * The below default values is only for unit testing + */ +export const packageJson: PackageJson = {} diff --git a/src/plugin.ts b/src/plugin.ts index 44ad8ca..21def7b 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -3,18 +3,19 @@ import { WechatyPlugin, log, Message, - Contact, - Room, } from 'wechaty' import { matchers, } from 'wechaty-plugin-contrib' -import { asker } from './asker' -import { normalizeConfig } from './normalize-config' -import { mentionMatcher } from './mention-matcher' +import { asker } from './asker.js' +import { normalizeConfig } from './normalize-config.js' +import { mentionMatcher } from './mention-matcher.js' -import { RepoConfig, ChatoperaOptions, ChatoperaResponse } from './chatopera' +import type { + RepoConfig, + ChatoperaOptions, +} from './chatopera.js' interface WechatyChatoperaConfigMatcher { contact? : matchers.ContactMatcherOptions, @@ -31,7 +32,7 @@ export type WechatyChatoperaConfig = WechatyChatoperaConfigMatcher & function WechatyChatopera (config: WechatyChatoperaConfig): WechatyPlugin { const roomIds: string[] = [] for (const fullName in config.repoConfig) { - const repoRoom: string | string[] = config.repoConfig[fullName] + const repoRoom: string | string[] = config.repoConfig[fullName] || [] if (Array.isArray(repoRoom)) { roomIds.push(...repoRoom) } else { @@ -80,8 +81,8 @@ function WechatyChatopera (config: WechatyChatoperaConfig): WechatyPlugin { } const isConfigMessage = async (message: Message): Promise => { - const from = message.talker() - const room = message.room() + const talker = message.talker() + const room = message.room() if (await matchSkipMessage(message)) { return false } @@ -96,7 +97,7 @@ function WechatyChatopera (config: WechatyChatoperaConfig): WechatyPlugin { const mentionSelf = await message.mentionSelf() if (mentionList.length > 0 && !mentionSelf) { return false } } else { - if (from && !await matchContact(from)) { return false } + if (!await matchContact(talker)) { return false } } const text = await message.mentionText() @@ -111,7 +112,7 @@ function WechatyChatopera (config: WechatyChatoperaConfig): WechatyPlugin { return function WechatyChatoperaPlugin (wechaty: Wechaty) { log.verbose('WechatyChatopera', 'WechatyChatoperaPlugin(%s)', wechaty) - wechaty.on('message', async message => { + wechaty.on('message', async (message: Message) => { log.verbose('WechatyChatopera', 'WechatyChatoperaPlugin() wechaty.on(message) %s', message) if (!await isPluginMessage(message)) { @@ -127,11 +128,14 @@ function WechatyChatopera (config: WechatyChatoperaConfig): WechatyPlugin { const text = await message.mentionText() if (!text) { return } - const from: Contact = message.talker() - const room: Room = message.room() + const talker = message.talker() + const room = message.room() - const response: ChatoperaResponse = await ask(text, from.name(), room) - if ((!response) || (!response.string)) { + const response = await ask(text, talker.name(), (room || undefined)) + if (!response) { + return + } + if (!response.string) { return } @@ -147,8 +151,8 @@ function WechatyChatopera (config: WechatyChatoperaConfig): WechatyPlugin { return } - if (from && room && await message.mentionSelf()) { - await room.say(answer, from) + if (room && await message.mentionSelf()) { + await room.say(answer, talker) } else { await message.say(answer) } diff --git a/src/version.spec.ts b/src/version.spec.ts deleted file mode 100755 index 40a5d4b..0000000 --- a/src/version.spec.ts +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env ts-node - -import test from 'tstest' - -import { VERSION } from './version' - -test('Make sure the VERSION is fresh in source code', async t => { - t.equal(VERSION, '0.0.0', 'version should be 0.0.0 in source code, only updated before publish to NPM') -}) diff --git a/src/version.ts b/src/version.ts deleted file mode 100644 index c36f2c5..0000000 --- a/src/version.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This file will be overwrite when we publish NPM module - * by scripts/generate_version.ts - */ - -export const VERSION = '0.0.0' diff --git a/src/vorpal.ts b/src/vorpal.ts index 97147c1..c23bec8 100644 --- a/src/vorpal.ts +++ b/src/vorpal.ts @@ -8,9 +8,9 @@ // matchers, // } from 'wechaty-plugin-contrib' -// import { ChatoperaOptions } from './chatopera' -// import { normalizeConfig } from './normalize-config' -// import { asker } from './asker' +// import { ChatoperaOptions } from './chatopera.js' +// import { normalizeConfig } from './normalize-config.js' +// import { asker } from './asker.js' // import { // QnASearchResult, // QueryDTO, @@ -134,3 +134,5 @@ // } // export { Faq } + +export {} diff --git a/tests/fixtures/smoke-testing.ts b/tests/fixtures/smoke-testing.ts index 35c1073..0ef8108 100644 --- a/tests/fixtures/smoke-testing.ts +++ b/tests/fixtures/smoke-testing.ts @@ -1,12 +1,18 @@ #!/usr/bin/env ts-node import { + WechatyChatopera, VERSION, -} from 'wechaty-qnamaker' +} from 'wechaty-chatopera' + +import assert from 'assert' async function main () { + assert(typeof WechatyChatopera === 'function', 'plugin should be function') + if (VERSION === '0.0.0') { throw new Error('version should be set before publishing') } + return 0 } diff --git a/tests/integration.spec.ts b/tests/integration.spec.ts index 713b334..0381b38 100755 --- a/tests/integration.spec.ts +++ b/tests/integration.spec.ts @@ -1,10 +1,10 @@ -#!/usr/bin/env ts-node +#!/usr/bin/env -S node --no-warnings --loader ts-node/esm import { test, } from 'tstest' -import * as plugins from '../src/mod' +import * as plugins from '../src/mod.js' // import { // Wechaty, @@ -25,7 +25,7 @@ test('integration testing', async (t) => { // room: 'id', // webhookProxyUrl: 'https://smee.io/fdasfadsfasdfs', // })) - t.skip('should get a bot') + await t.skip('should get a bot') }) test('plugin name', async t => { @@ -38,7 +38,7 @@ test('plugin name', async t => { continue // our helper functions } - t.skip('to be fixed') + await t.skip('to be fixed') // t.doesNotThrow(() => validatePlugin(plugin), 'plugin ' + plugin.name + ' should be valid') } }) diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000..8693cd0 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "dist/cjs", + }, +} diff --git a/tsconfig.json b/tsconfig.json index 728a055..cd74e88 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "@chatie/tsconfig", "compilerOptions": { - "outDir": "dist", + "outDir": "dist/esm", }, "exclude": [ "node_modules/", @@ -9,9 +9,7 @@ "tests/fixtures/", ], "include": [ - "app/**/*.ts", "bin/*.ts", - "bot/**/*.ts", "examples/**/*.ts", "scripts/**/*.ts", "src/**/*.ts",