Docker and tsconfig updates, fix config loading, downgrade typescript-rest for compilation

This commit is contained in:
Tony Stipanic 2021-08-30 23:52:19 +02:00
parent 406bdb773d
commit 5ffb65861a
No known key found for this signature in database
GPG Key ID: 3026BCCB6C9CC6BD
11 changed files with 596 additions and 1728 deletions

17
.browserslistrc Normal file
View File

@ -0,0 +1,17 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

View File

@ -1,4 +1,4 @@
FROM node:12.16.1-alpine AS builder FROM node:14.17.5-alpine AS builder
LABEL maintainer="Andreas Peters <support@aventer.biz>" LABEL maintainer="Andreas Peters <support@aventer.biz>"
#Upstream URL: https://git.aventer.biz/AVENTER/docker-matrix-dimension #Upstream URL: https://git.aventer.biz/AVENTER/docker-matrix-dimension
@ -17,7 +17,7 @@ RUN npm clean-install && \
node /home/node/matrix-dimension/scripts/convert-newlines.js /home/node/matrix-dimension/docker-entrypoint.sh && \ node /home/node/matrix-dimension/scripts/convert-newlines.js /home/node/matrix-dimension/docker-entrypoint.sh && \
NODE_ENV=production npm run-script build NODE_ENV=production npm run-script build
FROM node:12.16.1-alpine FROM node:14.17.5-alpine
WORKDIR /home/node/matrix-dimension WORKDIR /home/node/matrix-dimension

View File

@ -1,8 +1,10 @@
#!/bin/sh #!/bin/sh
echo "Starting matrix-dimension"
if [ -f "/data/config.yaml" ]; then if [ -f "/data/config.yaml" ]; then
cp /data/config.yaml /home/node/matrix-dimension/config/production.yaml cp /data/config.yaml /home/node/matrix-dimension/config/production.yaml
NODE_ENV=production node build/app/index.js NODE_ENV=production exec node build/app/index.js
else else
cp /home/node/matrix-dimension/config/default.yaml /data/config.yaml cp /home/node/matrix-dimension/config/default.yaml /data/config.yaml
echo "A default config file has been placed in the /data/ volume please review and make any required changes and start the container again" echo "A default config file has been placed in the /data/ volume please review and make any required changes and start the container again"

2140
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,18 @@
}, },
"author": "Travis Ralston", "author": "Travis Ralston",
"dependencies": { "dependencies": {
"@angular-devkit/build-angular": "^12.2.1",
"@angular/animations": "^12.2.2",
"@angular/common": "^12.2.2",
"@angular/compiler": "^12.2.2",
"@angular/core": "^12.2.2",
"@angular/forms": "^12.2.2",
"@angular/localize": "^12.2.2", "@angular/localize": "^12.2.2",
"@angular/platform-browser": "^12.2.2",
"@angular/platform-browser-dynamic": "^12.2.2",
"@angular/router": "^12.2.2",
"@angularclass/hmr": "^3.0.0",
"@angularclass/hmr-loader": "^3.0.4",
"@fortawesome/angular-fontawesome": "^0.9.0", "@fortawesome/angular-fontawesome": "^0.9.0",
"@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.3", "@fortawesome/free-brands-svg-icons": "^5.15.3",
@ -35,6 +46,7 @@
"@ngx-translate/core": "^13.0.0", "@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0", "@ngx-translate/http-loader": "^6.0.0",
"@popperjs/core": "^2.9.3", "@popperjs/core": "^2.9.3",
"@webcomponents/custom-elements": "^1.5.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"config": "^3.3.6", "config": "^3.3.6",
"express": "^4.17.1", "express": "^4.17.1",
@ -51,9 +63,12 @@
"pg-hstore": "^2.3.4", "pg-hstore": "^2.3.4",
"postcss": "^8.3.6", "postcss": "^8.3.6",
"random-string": "^0.2.0", "random-string": "^0.2.0",
"reflect-metadata": "^0.1.13",
"request": "^2.88.2", "request": "^2.88.2",
"request-promise": "^4.2.6", "request-promise": "^4.2.6",
"require-dir-all": "^0.4.15", "require-dir-all": "^0.4.15",
"rxjs": "^6.6.7",
"rxjs-compat": "^6.6.7",
"semver": "^7.3.5", "semver": "^7.3.5",
"sequelize": "6.6.2", "sequelize": "6.6.2",
"sequelize-typescript": "^2.1.0", "sequelize-typescript": "^2.1.0",
@ -61,33 +76,21 @@
"spotify-uri": "^2.2.0", "spotify-uri": "^2.2.0",
"sqlite3": "^5.0.2", "sqlite3": "^5.0.2",
"telegraf": "^4.4.1", "telegraf": "^4.4.1",
"typescript": "^4.3.5", "typescript-rest": "^2.2.6",
"typescript-rest": "^3.0.4",
"umzug": "^3.0.0-beta.16", "umzug": "^3.0.0-beta.16",
"url": "^0.11.0", "url": "^0.11.0",
"xml2js": "^0.4.23", "xml2js": "^0.4.23",
"xng-breadcrumb": "^6.7.0" "xng-breadcrumb": "^6.7.0",
"zone.js": "^0.11.4"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^12.2.1",
"@angular-devkit/core": "^12.2.1",
"@angular-eslint/builder": "^12.3.1",
"@angular-eslint/eslint-plugin": "^12.3.1",
"@angular-eslint/eslint-plugin-template": "^12.3.1",
"@angular-eslint/schematics": "^12.3.1",
"@angular-eslint/template-parser": "^12.3.1",
"@angular/animations": "^12.2.2",
"@angular/cli": "^12.2.1", "@angular/cli": "^12.2.1",
"@angular/common": "^12.2.2",
"@angular/compiler": "^12.2.2",
"@angular/compiler-cli": "^12.2.2", "@angular/compiler-cli": "^12.2.2",
"@angular/core": "^12.2.2", "@angular-eslint/builder": "12.3.1",
"@angular/forms": "^12.2.2", "@angular-eslint/eslint-plugin": "12.3.1",
"@angular/platform-browser": "^12.2.2", "@angular-eslint/eslint-plugin-template": "12.3.1",
"@angular/platform-browser-dynamic": "^12.2.2", "@angular-eslint/schematics": "12.3.1",
"@angular/router": "^12.2.2", "@angular-eslint/template-parser": "12.3.1",
"@angularclass/hmr": "^3.0.0",
"@angularclass/hmr-loader": "^3.0.4",
"@babel/core": "^7.15.0", "@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0", "@babel/preset-env": "^7.15.0",
"@biesbjerg/ngx-translate-extract": "^7.0.4", "@biesbjerg/ngx-translate-extract": "^7.0.4",
@ -104,18 +107,16 @@
"@types/jquery": "^3.5.6", "@types/jquery": "^3.5.6",
"@types/node": "^14.17.4", "@types/node": "^14.17.4",
"@types/validator": "^13.6.3", "@types/validator": "^13.6.3",
"@typescript-eslint/eslint-plugin": "^4.29.2", "@typescript-eslint/eslint-plugin": "4.28.2",
"@typescript-eslint/parser": "^4.29.2", "@typescript-eslint/parser": "4.28.2",
"angular2-template-loader": "^0.6.2", "angular2-template-loader": "^0.6.2",
"angular2-toaster": "^11.0.1", "angular2-toaster": "^11.0.1",
"bootstrap": "^5.1.0", "bootstrap": "^5.1.0",
"copy-webpack-plugin": "^9.0.1",
"core-js": "^3.16.2",
"css-loader": "^6.2.0", "css-loader": "^6.2.0",
"cssnano": "^5.0.8", "cssnano": "^5.0.8",
"dom-to-image": "^2.6.0", "dom-to-image": "^2.6.0",
"embed-video": "^2.0.4", "embed-video": "^2.0.4",
"eslint": "^7.32.0", "eslint": "^7.26.0",
"eslint-webpack-plugin": "^3.0.1", "eslint-webpack-plugin": "^3.0.1",
"goby": "^1.1.2", "goby": "^1.1.2",
"html-loader": "^2.1.2", "html-loader": "^2.1.2",
@ -128,22 +129,17 @@
"postcss-import": "^14.0.2", "postcss-import": "^14.0.2",
"postcss-loader": "^6.1.1", "postcss-loader": "^6.1.1",
"postcss-scss": "^4.0.0", "postcss-scss": "^4.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"rxjs": "^6.6.7",
"rxjs-compat": "^6.6.7",
"sass-loader": "^12.1.0", "sass-loader": "^12.1.0",
"screenfull": "^5.1.0", "screenfull": "^5.1.0",
"shelljs": "^0.8.4",
"spinkit": "^2.0.1", "spinkit": "^2.0.1",
"style-loader": "^3.2.1", "style-loader": "^3.2.1",
"ts-helpers": "^1.1.2",
"ts-loader": "^9.2.5", "ts-loader": "^9.2.5",
"ts-node": "^10.2.1", "ts-node": "^10.2.1",
"ts-node-dev": "^1.1.8", "ts-node-dev": "^1.1.8",
"typescript": "^4.3.5",
"webpack": "^5.50.0", "webpack": "^5.50.0",
"webpack-cli": "^4.8.0", "webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.0.0", "webpack-dev-server": "^4.0.0"
"zone.js": "^0.11.4"
} }
} }

View File

@ -46,4 +46,5 @@ export interface DimensionConfig {
logging: LogConfig; logging: LogConfig;
} }
export default <DimensionConfig>config; //TODO: We should better use the .get function from node config
export default config as unknown as DimensionConfig;

View File

@ -83,7 +83,7 @@ class _DimensionStore {
const migrator = new Umzug({ const migrator = new Umzug({
migrations: { migrations: {
glob: path.join(__dirname, "migrations/*"), glob: path.join(__dirname, "migrations/*.{js,ts}"),
resolve: ({name, path, context}) => { resolve: ({name, path, context}) => {
// Adjust the migration from the new signature to the v2 signature, making easier to upgrade to v3 // Adjust the migration from the new signature to the v2 signature, making easier to upgrade to v3
const migration = require(path) const migration = require(path)

View File

@ -22,6 +22,7 @@ LogService.info("index", "Starting dimension " + CURRENT_VERSION);
// Redirect the bot-sdk logger to our logger // Redirect the bot-sdk logger to our logger
BotSdk.LogService.setLogger({ BotSdk.LogService.setLogger({
trace: (module: string, ...args: any[]) => args.map(a => LogService.info("BotSdk-" + module, a)),
debug: (module: string, ...args: any[]) => args.map(a => LogService.info("BotSdk-" + module, a)), debug: (module: string, ...args: any[]) => args.map(a => LogService.info("BotSdk-" + module, a)),
info: (module: string, ...args: any[]) => args.map(a => LogService.info("BotSdk-" + module, a)), info: (module: string, ...args: any[]) => args.map(a => LogService.info("BotSdk-" + module, a)),
warn: (module: string, ...args: any[]) => args.map(a => LogService.warn("BotSdk-" + module, a)), warn: (module: string, ...args: any[]) => args.map(a => LogService.warn("BotSdk-" + module, a)),

View File

@ -3,16 +3,17 @@
"compilerOptions": { "compilerOptions": {
"baseUrl": "./src", "baseUrl": "./src",
"outDir": "./build/app", "outDir": "./build/app",
"module": "CommonJS",
"types": ["bluebird", "body-parser", "jquery", "validator"], "types": ["bluebird", "body-parser", "jquery", "validator"],
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": "node",
"sourceMap": false,
"target": "es2015",
}, },
"include": [ "include": [
"./src/**/*" "./src/**/*"
], ],
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
}
} }

View File

@ -31,5 +31,8 @@
"strictPropertyInitialization": false, "strictPropertyInitialization": false,
"strictTemplates": true, "strictTemplates": true,
"types" : ["node"] "types" : ["node"]
} },
"exclude":[
"./node_modules"
]
} }

View File

@ -1,18 +1,67 @@
import "reflect-metadata"; /**
import "ts-helpers"; * This file includes polyfills needed by Angular and is loaded before the app.
import { environment } from './environments/environment'; * You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
require("zone.js/dist/zone"); /***************************************************************************************************
* BROWSER POLYFILLS
*/
//noinspection TypeScriptUnresolvedVariable /**
if (environment.production) { * IE11 requires the following for NgClass support on SVG elements
// Production */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
} else { /**
// Development * Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
Error["stackTraceLimit"] = Infinity; /**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
//noinspection TypeScriptUnresolvedFunction /***************************************************************************************************
require("zone.js/dist/long-stack-trace-zone"); * Zone JS is required by default for Angular itself.
} */
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
// Custom Elements polyfill. Required for browsers that do not natively support Custom Elements.
import '@webcomponents/custom-elements';