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

bump ecmascript to es2021 #15

Merged
merged 4 commits into from
Jan 3, 2024
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
17,863 changes: 2,796 additions & 15,067 deletions bots/package-lock.json

Large diffs are not rendered by default.

99 changes: 73 additions & 26 deletions bots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,81 @@
},
"homepage": "https://github.com/initia-labs/batch-submitter#readme",
"devDependencies": {
"@testcontainers/postgresql": "^10.2.1",
"@initia/builder.js": "^0.0.9",
"@initia/initia.js": "^0.1.22",
"@koa/cors": "^4.0.0",
"@sentry/node": "^7.91.0",
"@testcontainers/postgresql": "^10.4.0",
"@types/bluebird": "^3.5.42",
"@types/chalk": "^2.2.0",
"@types/debug": "^4.1.12",
"@types/dockerode": "^3.3.23",
"@types/jest": "^27.5.2",
"@types/koa": "^2.13.12",
"@types/koa__cors": "^5.0.0",
"@types/koa-mount": "^4.0.5",
"@types/koa-router": "^7.4.8",
"@types/lodash": "^4.14.202",
"@types/node": "^15.14.9",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"concurrently": "^8.2.1",
"docker-compose": "^0.24.2",
"eslint": "^8",
"@types/pg": "^8.10.9",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"apidoc": "^1.2.0",
"apidoc-core": "^0.15.0",
"bignumber.js": "^9.1.2",
"bluebird": "^3.7.2",
"chalk": "^2.4.2",
"concurrently": "^8.2.2",
"docker-compose": "^0.24.3",
"dockerode": "^3.3.5",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
"execa": "^8.0.1",
"ffi-napi": "^4.0.3",
"husky": "^8.0.3",
"jest": "^27.5.1",
"lint-staged": "^10.5.1",
"prettier": "^2.1.2",
"koa": "^2.15.0",
"koa-body": "^5.0.0",
"koa-helmet": "^7.0.2",
"koa-joi-controllers": "^1.2.3",
"koa-morgan": "^1.0.1",
"koa-mount": "^4.0.0",
"koa-router": "^12.0.1",
"koa-static": "^5.0.0",
"lint-staged": "^10.5.4",
"pako": "^2.1.0",
"pg": "^8.11.3",
"prettier": "^2.8.8",
"reflect-metadata": "^0.1.14",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"sha3": "^2.1.4",
"testcontainers": "^10.4.0",
"ts-jest": "^27.1.5",
"ts-loader": "^8.0.11",
"ts-loader": "^8.4.0",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tsconfig-paths-jest": "^0.0.1",
"tsconfig-paths-webpack-plugin": "^3.3.0",
"typescript": "^4.2.4",
"webpack": "^4",
"webpack-bundle-analyzer": "^4.1.0"
"tsconfig-paths-webpack-plugin": "^3.5.2",
"typeorm": "^0.3.17",
"typescript": "^4.9.5",
"undici": "^5.28.2",
"webpack": "^4.47.0",
"webpack-bundle-analyzer": "^4.10.1",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1",
"zlib": "^1.0.5"
},
"dependencies": {
"@initia/builder.js": "^0.0.9",
"@initia/initia.js": "^0.1.22",
"@koa/cors": "^4.0.0",
"@sentry/node": "^7.60.0",
"@types/bluebird": "^3.5.38",
"@types/dockerode": "^3.3.19",
"@types/pg": "^8.10.2",
"@types/ws": "^8.5.5",
"apidoc": "^1.1.0",
"@sentry/node": "^7.91.0",
"@types/dockerode": "^3.3.23",
"@types/pg": "^8.10.9",
"@types/ws": "^8.5.10",
"apidoc": "^1.2.0",
"apidoc-core": "^0.15.0",
"bignumber.js": "^9.1.2",
"bluebird": "^3.7.2",
Expand All @@ -85,27 +127,32 @@
"dotenv": "^16.3.1",
"execa": "^8.0.1",
"ffi-napi": "^4.0.3",
"koa": "^2.14.2",
"koa": "^2.15.0",
"koa-body": "^5.0.0",
"koa-helmet": "^7.0.2",
"koa-joi-controllers": "^1.2.3",
"koa-morgan": "^1.0.1",
"koa-mount": "^4.0.0",
"koa-router": "^12.0.0",
"koa-router": "^12.0.1",
"koa-static": "^5.0.0",
"merkletreejs": "0.2.16",
"pako": "^2.1.0",
"pg": "^8.11.3",
"reflect-metadata": "^0.1.13",
"reflect-metadata": "^0.1.14",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"sha3": "^2.1.4",
"testcontainers": "^10.2.1",
"ts-node": "^10.9.1",
"testcontainers": "^10.4.0",
"ts-node": "^10.9.2",
"typeorm": "^0.3.17",
"undici": "^5.22.1",
"winston": "^3.10.0",
"undici": "^5.28.2",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1",
"zlib": "^1.0.5"
},
"overrides": {
"koa-joi-controllers": {
"is-gen-fn": "0.0.2"
}
}
}
2 changes: 1 addition & 1 deletion bots/src/lib/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as winston from 'winston';
import * as DailyRotateFile from 'winston-daily-rotate-file';
import DailyRotateFile from 'winston-daily-rotate-file';
import { config } from 'config';

function createLogger(name: string) {
Expand Down
2 changes: 1 addition & 1 deletion bots/src/lib/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as winston from 'winston';
import axios, { AxiosRequestConfig } from 'axios';
import * as Websocket from 'ws';
import Websocket from 'ws';

export class RPCSocket {
public ws: Websocket;
Expand Down
4 changes: 2 additions & 2 deletions bots/src/loader/apidoc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Koa from 'koa';
import * as serve from 'koa-static';
import Koa from 'koa';
import serve from 'koa-static';
import * as path from 'path';

const notFoundMiddleware: Koa.Middleware = (ctx) => {
Expand Down
10 changes: 5 additions & 5 deletions bots/src/loader/app.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// import { controllers } from 'controller'
import * as Koa from 'koa';
import * as bodyParser from 'koa-body';
import * as Router from 'koa-router';
import * as cors from '@koa/cors';
import Koa from 'koa';
import bodyParser from 'koa-body';
import Router from 'koa-router';
import cors from '@koa/cors';
import { errorHandler, APIError, ErrorTypes } from 'lib/error';
import { error } from 'lib/response';
import { KoaController, configureRoutes } from 'koa-joi-controllers';
import { createApiDocApp } from './apidoc';
import * as mount from 'koa-mount';
import mount from 'koa-mount';

const notFoundMiddleware: Koa.Middleware = (ctx) => {
ctx.status = 404;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable no-undef */
const { DefaultNamingStrategy } = require('typeorm');
const { snakeCase } = require('lodash');
import { DefaultNamingStrategy, NamingStrategyInterface } from 'typeorm';
import { snakeCase } from 'lodash';

class CamelToSnakeNamingStrategy extends DefaultNamingStrategy {
class CamelToSnakeNamingStrategy extends DefaultNamingStrategy implements NamingStrategyInterface {
tableName(targetName, userSpecifiedName) {
return userSpecifiedName ? userSpecifiedName : snakeCase(targetName);
}
Expand All @@ -17,4 +16,4 @@ class CamelToSnakeNamingStrategy extends DefaultNamingStrategy {
}
}

module.exports = CamelToSnakeNamingStrategy;
export default CamelToSnakeNamingStrategy;
6 changes: 3 additions & 3 deletions bots/src/worker/batchSubmitter/db.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'reflect-metadata';
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import {
ConnectionOptionsReader,
DataSource,
DataSourceOptions
} from 'typeorm';
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
import * as CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';
import CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';

const debug = require('debug')('orm');

Expand All @@ -31,7 +31,7 @@ function initConnection(options: DataSourceOptions): Promise<DataSource> {
return new DataSource({
...options,
...staticOptions,
namingStrategy: new CamelToSnakeNamingStrategy() as any
namingStrategy: new CamelToSnakeNamingStrategy()
}).initialize();
}

Expand Down
2 changes: 1 addition & 1 deletion bots/src/worker/bridgeExecutor/Monitor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import { RPCClient, RPCSocket } from 'lib/rpc';
import { StateEntity } from 'orm';
import { DataSource, EntityManager } from 'typeorm';
Expand Down
2 changes: 1 addition & 1 deletion bots/src/worker/bridgeExecutor/Resurrector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FailedTxEntity from 'orm/executor/FailedTxEntity';
import { Coin, MsgFinalizeTokenDeposit } from '@initia/initia.js';
import { INTERVAL_MONITOR, config } from 'config';
import { DataSource } from 'typeorm';
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import winston from 'winston';
import { TxWallet, WalletType, getWallet, initWallet } from 'lib/wallet';
import { buildFailedTxNotification, notifySlack } from 'lib/slack';
Expand Down
6 changes: 3 additions & 3 deletions bots/src/worker/bridgeExecutor/db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'reflect-metadata';
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import {
ConnectionOptionsReader,
DataSource,
Expand All @@ -10,7 +10,7 @@ import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConne
import debugModule from 'debug';
const debug = debugModule('orm');

import * as CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';
import CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';

import {
ExecutorOutputEntity,
Expand Down Expand Up @@ -45,7 +45,7 @@ function initConnection(options: DataSourceOptions): Promise<DataSource> {
return new DataSource({
...options,
...staticOptions,
namingStrategy: new CamelToSnakeNamingStrategy() as any
namingStrategy: new CamelToSnakeNamingStrategy()
}).initialize();
}

Expand Down
4 changes: 2 additions & 2 deletions bots/src/worker/challenger/db.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'reflect-metadata';
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import {
ConnectionOptionsReader,
DataSource,
DataSourceOptions
} from 'typeorm';
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
import * as CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';
import CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';

const debug = require('debug')('orm');

Expand Down
6 changes: 3 additions & 3 deletions bots/src/worker/outputSubmitter/db.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'reflect-metadata';
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import {
ConnectionOptionsReader,
DataSource,
DataSourceOptions
} from 'typeorm';
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
import * as CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';
import CamelToSnakeNamingStrategy from 'orm/CamelToSnakeNamingStrategy';

const debug = require('debug')('orm');

Expand All @@ -31,7 +31,7 @@ function initConnection(options: DataSourceOptions): Promise<DataSource> {
return new DataSource({
...options,
...staticOptions,
namingStrategy: new CamelToSnakeNamingStrategy() as any
namingStrategy: new CamelToSnakeNamingStrategy()
}).initialize();
}

Expand Down
13 changes: 7 additions & 6 deletions bots/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"compilerOptions": {
"target": "es2019",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "es2021",
"module": "node16",
"allowJs": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"moduleResolution": "node16",
"skipLibCheck": true,
"strictNullChecks": true,
"sourceMap": true,
Expand All @@ -17,9 +18,9 @@
"paths": {
"graphql": ["node_modules/graphql"],
"orm/*": ["orm/*"],
"*": ["*"],
"*": ["*"]
}
},
"include": ["src/**/*.ts", "test", "lib", "test/**/*.ts", "src/worker/bridgeExecutor/db.ts"],
"exclude": ["node_modules", "apidoc", "dist"]
"exclude": ["node_modules", "apidoc", "dist", "./src/**/*.spec.ts"]
}