diff options
author | Chris Chrome <christophercookman@gmail.com> | 2021-12-26 13:38:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-26 13:38:25 -0500 |
commit | 565f3b9e5f067745dfb4339b621973c9c39bb690 (patch) | |
tree | b601211fedf84401165b0e8626cf3fec1fc88db1 /bundle | |
parent | Fix the casing (diff) | |
parent | Add env name in sentry, set default sentry endpoint (diff) | |
download | server-565f3b9e5f067745dfb4339b621973c9c39bb690.tar.xz |
Merge pull request #553 from TheArcaneBrony/master
Remove fs-extras, add Sentry support, fix compile errors, fix some typos
Diffstat (limited to 'bundle')
-rw-r--r-- | bundle/package-lock.json | 566 | ||||
-rw-r--r-- | bundle/package.json | 11 | ||||
-rw-r--r-- | bundle/scripts/build.js | 43 | ||||
-rw-r--r-- | bundle/src/Server.ts | 29 | ||||
-rw-r--r-- | bundle/src/start.ts | 4 | ||||
-rw-r--r-- | bundle/src/stats.ts | 2 | ||||
-rw-r--r-- | bundle/tsconfig.json | 6 |
7 files changed, 638 insertions, 23 deletions
diff --git a/bundle/package-lock.json b/bundle/package-lock.json index 6775470d..e8b99037 100644 --- a/bundle/package-lock.json +++ b/bundle/package-lock.json @@ -13,6 +13,11 @@ "@aws-sdk/node-http-handler": "^3.36.0", "@babel/preset-env": "^7.15.8", "@babel/preset-typescript": "^7.15.0", + "@fosscord/api": "file:../api", + "@fosscord/cdn": "file:../cdn", + "@fosscord/gateway": "file:../gateway", + "@sentry/node": "^6.16.1", + "@sentry/tracing": "^6.16.1", "ajv": "8.6.2", "ajv-formats": "^2.1.1", "amqplib": "^0.8.0", @@ -45,10 +50,12 @@ "node-os-utils": "^1.3.5", "patch-package": "^6.4.7", "pg": "^8.7.1", + "picocolors": "^1.0.0", "proxy-agent": "^5.0.0", "reflect-metadata": "^0.1.13", "sqlite3": "^5.0.2", "supertest": "^6.1.6", + "tslib": "^2.3.1", "typeorm": "^0.2.37", "typescript": "^4.1.2", "typescript-json-schema": "^0.50.1", @@ -87,6 +94,142 @@ "typescript-json-schema": "0.50.1" } }, + "../api": { + "version": "1.0.0", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "@babel/preset-env": "^7.15.8", + "@babel/preset-typescript": "^7.15.0", + "@fosscord/util": "file:../util", + "@sentry/node": "^6.16.1", + "@sentry/tracing": "^6.16.1", + "ajv": "8.6.2", + "ajv-formats": "^2.1.1", + "amqplib": "^0.8.0", + "assert": "^1.5.0", + "bcrypt": "^5.0.1", + "body-parser": "^1.19.0", + "cheerio": "^1.0.0-rc.10", + "dotenv": "^8.2.0", + "express": "^4.17.1", + "form-data": "^3.0.0", + "i18next": "^19.9.2", + "i18next-http-middleware": "^3.1.3", + "i18next-node-fs-backend": "^2.1.3", + "image-size": "^1.0.0", + "jsonwebtoken": "^8.5.1", + "lambert-server": "^1.2.12", + "missing-native-js-functions": "^1.2.18", + "morgan": "^1.10.0", + "multer": "^1.4.2", + "node-fetch": "^2.6.1", + "patch-package": "^6.4.7", + "picocolors": "^1.0.0", + "proxy-agent": "^5.0.0", + "supertest": "^6.1.6", + "typeorm": "^0.2.37" + }, + "devDependencies": { + "@babel/core": "^7.15.5", + "@babel/preset-env": "^7.15.8", + "@babel/preset-typescript": "^7.15.0", + "@types/amqplib": "^0.8.1", + "@types/bcrypt": "^5.0.0", + "@types/express": "^4.17.9", + "@types/i18next-node-fs-backend": "^2.1.0", + "@types/jest": "^27.0.1", + "@types/jest-expect-message": "^1.0.3", + "@types/jsonwebtoken": "^8.5.0", + "@types/morgan": "^1.9.3", + "@types/multer": "^1.4.5", + "@types/node": "^14.17.9", + "@types/node-fetch": "^2.5.7", + "@types/supertest": "^2.0.11", + "@zerollup/ts-transform-paths": "^1.7.18", + "jest": "^27.2.5", + "jest-expect-message": "^1.0.2", + "jest-runtime": "^27.2.1", + "ts-node": "^9.1.1", + "ts-node-dev": "^1.1.6", + "ts-patch": "^1.4.4", + "typescript": "^4.4.2", + "typescript-json-schema": "0.50.1" + } + }, + "../cdn": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@aws-sdk/client-s3": "^3.36.1", + "@aws-sdk/node-http-handler": "^3.36.0", + "@fosscord/util": "file:../util", + "body-parser": "^1.19.0", + "btoa": "^1.2.1", + "dotenv": "^10.0.0", + "exif-be-gone": "^1.2.0", + "express": "^4.17.1", + "express-async-errors": "^3.1.1", + "file-type": "^16.5.0", + "form-data": "^4.0.0", + "fs-extra": "^10.0.0", + "image-size": "^1.0.0", + "jest": "^27.0.6", + "lambert-db": "^1.2.3", + "lambert-server": "^1.2.12", + "missing-native-js-functions": "^1.2.17", + "multer": "^1.4.2", + "nanocolors": "^0.2.12", + "node-fetch": "^2.6.1", + "supertest": "^6.1.6", + "typescript": "^4.1.2" + }, + "devDependencies": { + "@types/amqplib": "^0.8.1", + "@types/body-parser": "^1.19.0", + "@types/btoa": "^1.2.3", + "@types/dotenv": "^8.2.0", + "@types/express": "^4.17.12", + "@types/fs-extra": "^9.0.12", + "@types/jsonwebtoken": "^8.5.0", + "@types/multer": "^1.4.7", + "@types/node": "^14.17.0", + "@types/node-fetch": "^2.5.7", + "@zerollup/ts-transform-paths": "^1.7.18", + "ts-patch": "^1.4.4" + } + }, + "../gateway": { + "version": "1.0.0", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "@fosscord/util": "file:../util", + "amqplib": "^0.8.0", + "dotenv": "^8.2.0", + "jsonwebtoken": "^8.5.1", + "lambert-server": "^1.2.11", + "missing-native-js-functions": "^1.2.18", + "node-fetch": "^2.6.1", + "proxy-agent": "^5.0.0", + "typeorm": "^0.2.37", + "ws": "^7.4.2" + }, + "devDependencies": { + "@types/amqplib": "^0.8.1", + "@types/jsonwebtoken": "^8.5.0", + "@types/node": "^14.17.9", + "@types/node-fetch": "^2.5.12", + "@types/ws": "^7.4.0", + "@zerollup/ts-transform-paths": "^1.7.18", + "ts-node-dev": "^1.1.6", + "ts-patch": "^1.4.4", + "typescript": "^4.2.3" + }, + "optionalDependencies": { + "@yukikaze-bot/erlpack": "^1.0.1" + } + }, "node_modules/@aws-crypto/crc32": { "version": "1.2.2", "integrity": "sha512-8K0b1672qbv05chSoKpwGZ3fhvVp28Fg3AVHVkEHFl2lTLChO7wD/hTyyo8ING7uc31uZRt7bNra/hA74Td7Tw==", @@ -2699,6 +2842,18 @@ "node": ">=12" } }, + "node_modules/@fosscord/api": { + "resolved": "../api", + "link": true + }, + "node_modules/@fosscord/cdn": { + "resolved": "../cdn", + "link": true + }, + "node_modules/@fosscord/gateway": { + "resolved": "../gateway", + "link": true + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", @@ -3065,6 +3220,139 @@ "node": ">=10" } }, + "node_modules/@sentry/core": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.16.1.tgz", + "integrity": "sha512-UFI0264CPUc5cR1zJH+S2UPOANpm6dLJOnsvnIGTjsrwzR0h8Hdl6rC2R/GPq+WNbnipo9hkiIwDlqbqvIU5vw==", + "dependencies": { + "@sentry/hub": "6.16.1", + "@sentry/minimal": "6.16.1", + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/core/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@sentry/hub": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.16.1.tgz", + "integrity": "sha512-4PGtg6AfpqMkreTpL7ymDeQ/U1uXv03bKUuFdtsSTn/FRf9TLS4JB0KuTZCxfp1IRgAA+iFg6B784dDkT8R9eg==", + "dependencies": { + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/hub/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@sentry/minimal": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.16.1.tgz", + "integrity": "sha512-dq+mI1EQIvUM+zJtGCVgH3/B3Sbx4hKlGf2Usovm9KoqWYA+QpfVBholYDe/H2RXgO7LFEefDLvOdHDkqeJoyA==", + "dependencies": { + "@sentry/hub": "6.16.1", + "@sentry/types": "6.16.1", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/minimal/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@sentry/node": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.16.1.tgz", + "integrity": "sha512-SeDDoug2kUxeF1D7JGPa3h5EXxKtmA01mITBPYx5xbJ0sMksnv5I5bC1SJ8arRRzq6+W1C4IEeDBQtrVCk6ixA==", + "dependencies": { + "@sentry/core": "6.16.1", + "@sentry/hub": "6.16.1", + "@sentry/tracing": "6.16.1", + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/node/node_modules/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@sentry/node/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@sentry/tracing": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.16.1.tgz", + "integrity": "sha512-MPSbqXX59P+OEeST+U2V/8Hu/8QjpTUxTNeNyTHWIbbchdcMMjDbXTS3etCgajZR6Ro+DHElOz5cdSxH6IBGlA==", + "dependencies": { + "@sentry/hub": "6.16.1", + "@sentry/minimal": "6.16.1", + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/tracing/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@sentry/types": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.16.1.tgz", + "integrity": "sha512-Wh354g30UsJ5kYJbercektGX4ZMc9MHU++1NjeN2bTMnbofEcpUDWIiKeulZEY65IC1iU+1zRQQgtYO+/hgCUQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/utils": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.16.1.tgz", + "integrity": "sha512-7ngq/i4R8JZitJo9Sl8PDnjSbDehOxgr1vsoMmerIsyRZ651C/8B+jVkMhaAPgSdyJ0AlE3O7DKKTP1FXFw9qw==", + "dependencies": { + "@sentry/types": "6.16.1", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/utils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, "node_modules/@sinonjs/commons": { "version": "1.8.3", "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", @@ -4141,6 +4429,12 @@ "url": "https://opencollective.com/browserslist" } }, + "node_modules/browserslist/node_modules/picocolors": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "dev": true + }, "node_modules/bser": { "version": "2.1.1", "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", @@ -7119,6 +7413,11 @@ "version": "4.1.1", "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" }, + "node_modules/lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=" + }, "node_modules/lru-cache": { "version": "6.0.0", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", @@ -8635,9 +8934,9 @@ } }, "node_modules/picocolors": { - "version": "0.2.1", - "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, "node_modules/picomatch": { "version": "2.3.0", @@ -12954,6 +13253,127 @@ "@cspotcode/source-map-consumer": "0.8.0" } }, + "@fosscord/api": { + "version": "file:../api", + "requires": { + "@babel/core": "^7.15.5", + "@babel/preset-env": "^7.15.8", + "@babel/preset-typescript": "^7.15.0", + "@fosscord/util": "file:../util", + "@sentry/node": "^6.16.1", + "@sentry/tracing": "^6.16.1", + "@types/amqplib": "^0.8.1", + "@types/bcrypt": "^5.0.0", + "@types/express": "^4.17.9", + "@types/i18next-node-fs-backend": "^2.1.0", + "@types/jest": "^27.0.1", + "@types/jest-expect-message": "^1.0.3", + "@types/jsonwebtoken": "^8.5.0", + "@types/morgan": "^1.9.3", + "@types/multer": "^1.4.5", + "@types/node": "^14.17.9", + "@types/node-fetch": "^2.5.7", + "@types/supertest": "^2.0.11", + "@zerollup/ts-transform-paths": "^1.7.18", + "ajv": "8.6.2", + "ajv-formats": "^2.1.1", + "amqplib": "^0.8.0", + "assert": "^1.5.0", + "bcrypt": "^5.0.1", + "body-parser": "^1.19.0", + "cheerio": "^1.0.0-rc.10", + "dotenv": "^8.2.0", + "express": "^4.17.1", + "form-data": "^3.0.0", + "i18next": "^19.9.2", + "i18next-http-middleware": "^3.1.3", + "i18next-node-fs-backend": "^2.1.3", + "image-size": "^1.0.0", + "jest": "^27.2.5", + "jest-expect-message": "^1.0.2", + "jest-runtime": "^27.2.1", + "jsonwebtoken": "^8.5.1", + "lambert-server": "^1.2.12", + "missing-native-js-functions": "^1.2.18", + "morgan": "^1.10.0", + "multer": "^1.4.2", + "node-fetch": "^2.6.1", + "patch-package": "^6.4.7", + "picocolors": "^1.0.0", + "proxy-agent": "^5.0.0", + "supertest": "^6.1.6", + "ts-node": "^9.1.1", + "ts-node-dev": "^1.1.6", + "ts-patch": "^1.4.4", + "typeorm": "^0.2.37", + "typescript": "^4.4.2", + "typescript-json-schema": "0.50.1" + } + }, + "@fosscord/cdn": { + "version": "file:../cdn", + "requires": { + "@aws-sdk/client-s3": "^3.36.1", + "@aws-sdk/node-http-handler": "^3.36.0", + "@fosscord/util": "file:../util", + "@types/amqplib": "^0.8.1", + "@types/body-parser": "^1.19.0", + "@types/btoa": "^1.2.3", + "@types/dotenv": "^8.2.0", + "@types/express": "^4.17.12", + "@types/fs-extra": "^9.0.12", + "@types/jsonwebtoken": "^8.5.0", + "@types/multer": "^1.4.7", + "@types/node": "^14.17.0", + "@types/node-fetch": "^2.5.7", + "@zerollup/ts-transform-paths": "^1.7.18", + "body-parser": "^1.19.0", + "btoa": "^1.2.1", + "dotenv": "^10.0.0", + "exif-be-gone": "^1.2.0", + "express": "^4.17.1", + "express-async-errors": "^3.1.1", + "file-type": "^16.5.0", + "form-data": "^4.0.0", + "fs-extra": "^10.0.0", + "image-size": "^1.0.0", + "jest": "^27.0.6", + "lambert-db": "^1.2.3", + "lambert-server": "^1.2.12", + "missing-native-js-functions": "^1.2.17", + "multer": "^1.4.2", + "nanocolors": "^0.2.12", + "node-fetch": "^2.6.1", + "supertest": "^6.1.6", + "ts-patch": "^1.4.4", + "typescript": "^4.1.2" + } + }, + "@fosscord/gateway": { + "version": "file:../gateway", + "requires": { + "@fosscord/util": "file:../util", + "@types/amqplib": "^0.8.1", + "@types/jsonwebtoken": "^8.5.0", + "@types/node": "^14.17.9", + "@types/node-fetch": "^2.5.12", + "@types/ws": "^7.4.0", + "@yukikaze-bot/erlpack": "^1.0.1", + "@zerollup/ts-transform-paths": "^1.7.18", + "amqplib": "^0.8.0", + "dotenv": "^8.2.0", + "jsonwebtoken": "^8.5.1", + "lambert-server": "^1.2.11", + "missing-native-js-functions": "^1.2.18", + "node-fetch": "^2.6.1", + "proxy-agent": "^5.0.0", + "ts-node-dev": "^1.1.6", + "ts-patch": "^1.4.4", + "typeorm": "^0.2.37", + "typescript": "^4.2.3", + "ws": "^7.4.2" + } + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", @@ -13239,6 +13659,127 @@ } } }, + "@sentry/core": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.16.1.tgz", + "integrity": "sha512-UFI0264CPUc5cR1zJH+S2UPOANpm6dLJOnsvnIGTjsrwzR0h8Hdl6rC2R/GPq+WNbnipo9hkiIwDlqbqvIU5vw==", + "requires": { + "@sentry/hub": "6.16.1", + "@sentry/minimal": "6.16.1", + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "tslib": "^1.9.3" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@sentry/hub": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.16.1.tgz", + "integrity": "sha512-4PGtg6AfpqMkreTpL7ymDeQ/U1uXv03bKUuFdtsSTn/FRf9TLS4JB0KuTZCxfp1IRgAA+iFg6B784dDkT8R9eg==", + "requires": { + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "tslib": "^1.9.3" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@sentry/minimal": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.16.1.tgz", + "integrity": "sha512-dq+mI1EQIvUM+zJtGCVgH3/B3Sbx4hKlGf2Usovm9KoqWYA+QpfVBholYDe/H2RXgO7LFEefDLvOdHDkqeJoyA==", + "requires": { + "@sentry/hub": "6.16.1", + "@sentry/types": "6.16.1", + "tslib": "^1.9.3" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@sentry/node": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.16.1.tgz", + "integrity": "sha512-SeDDoug2kUxeF1D7JGPa3h5EXxKtmA01mITBPYx5xbJ0sMksnv5I5bC1SJ8arRRzq6+W1C4IEeDBQtrVCk6ixA==", + "requires": { + "@sentry/core": "6.16.1", + "@sentry/hub": "6.16.1", + "@sentry/tracing": "6.16.1", + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + }, + "dependencies": { + "cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@sentry/tracing": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.16.1.tgz", + "integrity": "sha512-MPSbqXX59P+OEeST+U2V/8Hu/8QjpTUxTNeNyTHWIbbchdcMMjDbXTS3etCgajZR6Ro+DHElOz5cdSxH6IBGlA==", + "requires": { + "@sentry/hub": "6.16.1", + "@sentry/minimal": "6.16.1", + "@sentry/types": "6.16.1", + "@sentry/utils": "6.16.1", + "tslib": "^1.9.3" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@sentry/types": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.16.1.tgz", + "integrity": "sha512-Wh354g30UsJ5kYJbercektGX4ZMc9MHU++1NjeN2bTMnbofEcpUDWIiKeulZEY65IC1iU+1zRQQgtYO+/hgCUQ==" + }, + "@sentry/utils": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.16.1.tgz", + "integrity": "sha512-7ngq/i4R8JZitJo9Sl8PDnjSbDehOxgr1vsoMmerIsyRZ651C/8B+jVkMhaAPgSdyJ0AlE3O7DKKTP1FXFw9qw==", + "requires": { + "@sentry/types": "6.16.1", + "tslib": "^1.9.3" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, "@sinonjs/commons": { "version": "1.8.3", "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", @@ -14146,6 +14687,14 @@ "escalade": "^3.1.1", "node-releases": "^1.1.77", "picocolors": "^0.2.1" + }, + "dependencies": { + "picocolors": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "dev": true + } } }, "bser": { @@ -16373,6 +16922,11 @@ "version": "4.1.1", "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" }, + "lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=" + }, "lru-cache": { "version": "6.0.0", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", @@ -17472,9 +18026,9 @@ } }, "picocolors": { - "version": "0.2.1", - "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, "picomatch": { "version": "2.3.0", diff --git a/bundle/package.json b/bundle/package.json index 8a49a7ac..e0ae6156 100644 --- a/bundle/package.json +++ b/bundle/package.json @@ -59,6 +59,11 @@ "@aws-sdk/node-http-handler": "^3.36.0", "@babel/preset-env": "^7.15.8", "@babel/preset-typescript": "^7.15.0", + "@fosscord/api": "file:../api", + "@fosscord/cdn": "file:../cdn", + "@fosscord/gateway": "file:../gateway", + "@sentry/node": "^6.16.1", + "@sentry/tracing": "^6.16.1", "ajv": "8.6.2", "ajv-formats": "^2.1.1", "amqplib": "^0.8.0", @@ -86,18 +91,20 @@ "missing-native-js-functions": "^1.2.18", "morgan": "^1.10.0", "multer": "^1.4.2", - "nanocolors": "^0.2.12", "node-fetch": "^2.6.1", "node-os-utils": "^1.3.5", "patch-package": "^6.4.7", "pg": "^8.7.1", + "picocolors": "^1.0.0", "proxy-agent": "^5.0.0", "reflect-metadata": "^0.1.13", "sqlite3": "^5.0.2", "supertest": "^6.1.6", + "tslib": "^2.3.1", "typeorm": "^0.2.37", "typescript": "^4.1.2", "typescript-json-schema": "^0.50.1", - "ws": "^7.4.2" + "ws": "^7.4.2", + "nanocolors": "^0.2.12" } } \ No newline at end of file diff --git a/bundle/scripts/build.js b/bundle/scripts/build.js index 88d76d34..f73fb11a 100644 --- a/bundle/scripts/build.js +++ b/bundle/scripts/build.js @@ -1,34 +1,58 @@ const { execSync } = require("child_process"); const path = require("path"); -const fse = require("fs-extra"); +const fs = require("fs"); const { getSystemErrorMap } = require("util"); const { argv } = require("process"); +var steps = 2, i = 0; +if (argv.includes("clean")) steps++; +if (argv.includes("copyonly")) steps--; const dirs = ["api", "util", "cdn", "gateway", "bundle"]; const verbose = argv.includes("verbose") || argv.includes("v"); +var copyRecursiveSync = function(src, dest) { + if(verbose) console.log(`cpsync: ${src} -> ${dest}`); + var exists = fs.existsSync(src); + if(!exists){ + console.log(src + " doesn't exist, not copying!"); + return; + } + var stats = exists && fs.statSync(src); + var isDirectory = exists && stats.isDirectory(); + if (isDirectory) { + fs.mkdirSync(dest, {recursive: true}); + fs.readdirSync(src).forEach(function(childItemName) { + copyRecursiveSync(path.join(src, childItemName), + path.join(dest, childItemName)); + }); + } else { + fs.copyFileSync(src, dest); + } + }; + if (argv.includes("clean")) { + console.log(`[${++i}/${steps}] Cleaning...`); dirs.forEach((a) => { var d = "../" + a + "/dist"; - if (fse.existsSync(d)) { - fse.rmSync(d, { recursive: true }); + if (fs.existsSync(d)) { + fs.rmSync(d, { recursive: true }); if (verbose) console.log(`Deleted ${d}!`); } }); } -fse.copySync(path.join(__dirname, "..", "..", "api", "assets"), path.join(__dirname, "..", "dist", "api", "assets")); -fse.copySync(path.join(__dirname, "..", "..", "api", "client_test"), path.join(__dirname, "..", "dist", "api", "client_test")); -fse.copySync(path.join(__dirname, "..", "..", "api", "locales"), path.join(__dirname, "..", "dist", "api", "locales")); +console.log(`[${++i}/${steps}] Copying src files...`); +copyRecursiveSync(path.join(__dirname, "..", "..", "api", "assets"), path.join(__dirname, "..", "dist", "api", "assets")); +copyRecursiveSync(path.join(__dirname, "..", "..", "api", "client_test"), path.join(__dirname, "..", "dist", "api", "client_test")); +copyRecursiveSync(path.join(__dirname, "..", "..", "api", "locales"), path.join(__dirname, "..", "dist", "api", "locales")); dirs.forEach((a) => { - fse.copySync("../" + a + "/src", "dist/" + a + "/src"); + copyRecursiveSync("../" + a + "/src", "dist/" + a + "/src"); if (verbose) console.log(`Copied ${"../" + a + "/dist"} -> ${"dist/" + a + "/src"}!`); }); -console.log("[1/2] Copying src files done"); if (!argv.includes("copyonly")) { - console.log("[2/2] Compiling src files ..."); + console.log(`[${++i}/${steps}] Compiling src files ...`); console.log( execSync( @@ -46,3 +70,4 @@ if (!argv.includes("copyonly")) { ) ); } + diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts index c5da5fc9..71a60d49 100644 --- a/bundle/src/Server.ts +++ b/bundle/src/Server.ts @@ -6,8 +6,10 @@ import * as Api from "@fosscord/api"; import * as Gateway from "@fosscord/gateway"; import { CDNServer } from "@fosscord/cdn"; import express from "express"; -import { green, bold } from "nanocolors"; +import { green, bold, yellow } from "picocolors"; import { Config, initDatabase } from "@fosscord/util"; +import * as Sentry from "@sentry/node"; +import * as Tracing from "@sentry/tracing"; const app = express(); const server = http.createServer(); @@ -64,7 +66,32 @@ async function main() { // }, } as any); + //Sentry + if (Config.get().sentry.enabled) { + console.log( + `[Bundle] ${yellow("You are using Sentry! This may slightly impact performance on large loads!")}` + ); + Sentry.init({ + dsn: Config.get().sentry.endpoint, + integrations: [ + new Sentry.Integrations.Http({ tracing: true }), + new Tracing.Integrations.Express({ app }), + ], + tracesSampleRate: Config.get().sentry.traceSampleRate, + environment: Config.get().sentry.environment + }); + + app.use(Sentry.Handlers.requestHandler()); + app.use(Sentry.Handlers.tracingHandler()); + } await Promise.all([api.start(), cdn.start(), gateway.start()]); + if (Config.get().sentry.enabled) { + app.use(Sentry.Handlers.errorHandler()); + app.use(function onError(err: any, req: any, res: any, next: any) { + res.statusCode = 500; + res.end(res.sentry + "\n"); + }); + } console.log(`[Server] ${green(`listening on port ${bold(port)}`)}`); } diff --git a/bundle/src/start.ts b/bundle/src/start.ts index 1b21659e..7660b296 100644 --- a/bundle/src/start.ts +++ b/bundle/src/start.ts @@ -2,7 +2,7 @@ import "reflect-metadata"; import cluster, { Worker } from "cluster"; import os from "os"; -import { red, bold, yellow, cyan } from "nanocolors"; +import { red, bold, yellow, cyan } from "picocolors"; import { initStats } from "./stats"; import { config } from "dotenv"; config(); @@ -43,7 +43,7 @@ Commit Hash: ${ ? `${cyan(commit)} (${yellow(commit.slice(0, 7))})` : "Unknown (Git cannot be found)" } -Cores: ${cyan(cores)} +Cores: ${cyan(os.cpus().length)} (Using ${cores} thread(s).) `) ); diff --git a/bundle/src/stats.ts b/bundle/src/stats.ts index 8d87f9d9..3c5163c3 100644 --- a/bundle/src/stats.ts +++ b/bundle/src/stats.ts @@ -1,6 +1,6 @@ import os from "os"; import osu from "node-os-utils"; -import { red } from "nanocolors"; +import { red } from "picocolors"; export function initStats() { console.log(`[Path] running in ${__dirname}`); diff --git a/bundle/tsconfig.json b/bundle/tsconfig.json index 58c61132..2257b4ab 100644 --- a/bundle/tsconfig.json +++ b/bundle/tsconfig.json @@ -45,7 +45,7 @@ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ "types": [ @@ -79,6 +79,8 @@ "@fosscord/cdn": ["cdn/src/index"], "@fosscord/util": ["util/src/index"] }, - "plugins": [{ "transform": "@zerollup/ts-transform-paths" }] + "plugins": [{ "transform": "@zerollup/ts-transform-paths" }], + "noEmitHelpers": true, + "importHelpers": true } } |