Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM support 2 #151

Merged
merged 5 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
},
"engines": {
"node": "10"
"node": "16"
},
"buildpacks": [
{
Expand Down
13 changes: 7 additions & 6 deletions bin/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm
import type {
Probot,
ApplicationFunctionOptions,
Expand All @@ -8,14 +9,14 @@ import type {
import {
log,
// VERSION,
} from '../src/config'
import { getBot } from '../src/get-bot'
import { setupBot } from '../src/setup-bot'
import { setupFinis } from '../src/setup-finis'
} from '../src/config.js'
import { getBot } from '../src/get-bot.js'
import { setupBot } from '../src/setup-bot.js'
import { setupFinis } from '../src/setup-finis.js'

import { configureProbot } from '../src/probot-handlers/mod'
import { configureProbot } from '../src/probot-handlers/mod.js'

import { configureRoutes } from '../src/routers'
import { configureRoutes } from '../src/routers.js'

async function probotApp (
app: Probot,
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "osschat",
"version": "0.10.9",
"version": "0.10.10",
"description": "Apache OSSChat",
"main": "index.js",
"type": "module",
"engines": {
"node": ">=14"
"node": ">=16",
"npm": ">=7"
},
"scripts": {
"heroku:env": "heroku config -s -a oss-chat | sed 's/\\\\\\\\/\\\\/g' | tee .env",
Expand Down Expand Up @@ -37,10 +38,10 @@
"brolog": "^1.12.4",
"commander": "^8",
"dotenv": "^10.0.0",
"ducks": "^0.11.7",
"ducks": "^0.11.10",
"express": "^4.17.1",
"finis": "^0.4.4",
"ha-wechaty": "^0.9.6",
"ha-wechaty": "^0.9.8",
"micromatch": "^4.0.4",
"moment": "^2.29.1",
"node-cache": "^5.1.2",
Expand All @@ -54,10 +55,10 @@
"rx-queue": "^0.12.6",
"smee-client": "^1.2.2",
"wechaty": "^0.69.54",
"wechaty-ducks-contrib": "^0.2.2",
"wechaty-ducks-contrib": "^0.3.4",
"wechaty-plugin-contrib": "^0.14.23",
"wechaty-puppet-padlocal": "^0.4.2",
"wechaty-redux": "^0.3.4"
"wechaty-redux": "^0.5.6"
},
"devDependencies": {
"@chatie/eslint-config": "^0.14.1",
Expand Down
2 changes: 1 addition & 1 deletion src/chatops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
CHATOPS_ROOM_ID,
DEVELOPER_ROOM_ID,
HEARTBEAT_ROOM_ID,
} from './config'
} from './config.js'

export class Chatops {

Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/apache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'apache/dolphinscheduler' : [
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/baidu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

const ROOM_ID = '20755579878@chatroom' // bot测试

Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/kaiyuanshe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'kaiyuanshe/osschat' : [
Expand Down
22 changes: 11 additions & 11 deletions src/config-projects/mod.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import wechaty from './wechaty'
import zixia from './zixia'
import tensorflowBook from './tensorflow-book'
import baidu from './baidu'
import preangel from './preangel'
import apache from './apache'
import webank from './webank'
import qihoo360 from './qihoo360'
import tencent from './tencent'
import kaiyuanshe from './kaiyuanshe'
import others from './others'
import wechaty from './wechaty.js'
import zixia from './zixia.js'
import tensorflowBook from './tensorflow-book.js'
import baidu from './baidu.js'
import preangel from './preangel.js'
import apache from './apache.js'
import webank from './webank.js'
import qihoo360 from './qihoo360.js'
import tencent from './tencent.js'
import kaiyuanshe from './kaiyuanshe.js'
import others from './others.js'

/**
* Huan(202003)
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/others.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'BUPT/clubber.ml': '18968477245@chatroom',
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/preangel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Maintainer: Huan LI (李卓桓) https://github.com/huan
*
*/
import type { RepoConfig } from './config'
import type { RepoConfig } from './config.js'

const PREANGEL = '17237607145@chatroom' // ChatOps - PreAngel

Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/qihoo360.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'qihoo360/quicksql' : [
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/streamnative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'streamnative/kop' : '18300408994@chatroom',
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/tencent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'Tencent/wepy': '21886945130@chatroom',
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/tensorflow-book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

const ROOM_ID = '4510565418@chatroom'
const JAVASCRIPT_ML = '4383052528@chatroom' // Machine Learning in JavaScript
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/webank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'WeBankFinTech/DataSphereStudio' : [
Expand Down
18 changes: 9 additions & 9 deletions src/config-projects/wechaty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/
/* eslint-disable sort-keys */
import type { RepoConfig } from './config'
import type { RepoConfig } from './config.js'

const roomConfig = {
'17275396976@chatroom': [ // Wechaty Developers' Headquarters
Expand Down Expand Up @@ -51,28 +51,28 @@ const roomConfig = {
* Polyglot Wechaty User Groups
*/
'18005545363@chatroom': [ // .NET Wechaty User Group
'wechaty/dotnet-wechaty*',
'wechaty/dotnet-*',
],
'19236545415@chatroom': [ // PHP Wechaty User Group
'wechaty/php-wechaty*',
'wechaty/php-*',
],
'19459143119@chatroom': [ // OpenAPI Wechaty User Group
'wechaty/openapi*',
'wechaty/openapi-*',
],
'20062821521@chatroom': [ // Java Wechaty User Group
'wechaty/java-wechaty*',
'wechaty/java-*',
],
'20771403027@chatroom': [ // Python Wechaty User Group
'wechaty/python-wechaty*',
'wechaty/python-*',
],
'21063503320@chatroom': [ // Rust Wechaty User Group
'wechaty/rust-wechaty*',
'wechaty/rust-*',
],
'21153390249@chatroom': [ // Go Wechaty User Group
'wechaty/go-wechaty*',
'wechaty/go-*',
],
'21366491788@chatroom': [ // Scala Wechaty User Group
'wechaty/scala-wechaty*',
'wechaty/scala-*',
],
'21148500489@chatroom': [ // TypeScript Wechaty User Group
'wechaty/wechaty',
Expand Down
2 changes: 1 addition & 1 deletion src/config-projects/zixia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {
RepoConfig,
} from './config'
} from './config.js'

export const config: RepoConfig = {
'zixia/aka.org.cn' : '3408538832@chatroom',
Expand Down
9 changes: 7 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
/**
* VERSION
*/
import readPkgUp from 'read-pkg-up'
import { readPackageUpSync } from 'read-pkg-up'

import {
log,
} from 'wechaty'

import { dirname } from 'path'
import { fileURLToPath } from 'url'

import dotenv from 'dotenv'
dotenv.config()

const pkg = readPkgUp.readPackageUpSync({ cwd: __dirname })!.packageJson
const __dirname = dirname(fileURLToPath(import.meta.url))

const pkg = readPackageUpSync({ cwd: __dirname })!.packageJson
const VERSION = pkg.version

/**
Expand Down
8 changes: 4 additions & 4 deletions src/deliver-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import request from 'request'

import {
projectsRepoConfig,
} from './config-projects/mod'
} from './config-projects/mod.js'

import {
matchOwner,
matchRepo,
// exactMatch,
} from './pure-functions/match-org-repo'
} from './pure-functions/match-org-repo.js'

import { getBot } from './get-bot'
import { Chatops } from './chatops'
import { getBot } from './get-bot.js'
import { Chatops } from './chatops.js'

async function deliverCard (
owner : string,
Expand Down
6 changes: 3 additions & 3 deletions src/get-bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import {

import {
log,
} from './config'
} from './config.js'
import {
getMemory,
} from './get-memory'
} from './get-memory.js'

import { Chatops } from './chatops'
import { Chatops } from './chatops.js'

const duckery = {
counter : CounterDuck,
Expand Down
2 changes: 1 addition & 1 deletion src/get-memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {

import {
log,
} from './config'
} from './config.js'

export let memory: MemoryCard

Expand Down
2 changes: 1 addition & 1 deletion src/probot-handlers/issue-comment.created.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
log,
} from 'wechaty'

import { deliverCard } from '../deliver-card'
import { deliverCard } from '../deliver-card.js'

const issueCommentCreatedPlugin = (app: Probot) => app.on('issue_comment.created', async (context) => {
const fullName = context.payload.repository.full_name
Expand Down
2 changes: 1 addition & 1 deletion src/probot-handlers/issues.opened.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
log,
} from 'wechaty'

import { deliverCard } from '../deliver-card'
import { deliverCard } from '../deliver-card.js'

const issuesOpenedPlugin = (app: Probot) => app.on('issues.opened', async (context) => {
const fullName = context.payload.repository.full_name
Expand Down
10 changes: 5 additions & 5 deletions src/probot-handlers/mod.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Probot } from 'probot'

import { issueCommentCreatedPlugin } from './issue-comment.created'
import { issuesOpenedPlugin } from './issues.opened'
import { pullRequestReviewCommentCreatedPlugin } from './pull-request-review-comment.created'
import { pullRequestReviewSubmittedPlugin } from './pull-request-review.submitted'
import { pullRequestOpenedPlugin } from './pull-request.opened'
import { issueCommentCreatedPlugin } from './issue-comment.created.js'
import { issuesOpenedPlugin } from './issues.opened.js'
import { pullRequestReviewCommentCreatedPlugin } from './pull-request-review-comment.created.js'
import { pullRequestReviewSubmittedPlugin } from './pull-request-review.submitted.js'
import { pullRequestOpenedPlugin } from './pull-request.opened.js'

const pluginList = [
issueCommentCreatedPlugin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
log,
} from 'wechaty'

import { deliverCard } from '../deliver-card'
import { deliverCard } from '../deliver-card.js'

const pullRequestReviewCommentCreatedPlugin = (app: Probot) => app.on('pull_request_review_comment.created', async (context) => {
const fullName = context.payload.repository.full_name
Expand Down
2 changes: 1 addition & 1 deletion src/probot-handlers/pull-request-review.submitted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
log,
} from 'wechaty'

import { deliverCard } from '../deliver-card'
import { deliverCard } from '../deliver-card.js'

const pullRequestReviewSubmittedPlugin = (app: Probot) => app.on('pull_request_review.submitted', async (context) => {
const fullName = context.payload.repository.full_name
Expand Down
2 changes: 1 addition & 1 deletion src/probot-handlers/pull-request.opened.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
log,
} from 'wechaty'

import { deliverCard } from '../deliver-card'
import { deliverCard } from '../deliver-card.js'

const pullRequestOpenedPlugin = (app: Probot) => app.on('pull_request.opened', async (context) => {
const fullName = context.payload.repository.full_name
Expand Down
Loading