diff --git a/api/src/connection/datasource.ts b/api/src/connection/datasource.ts index 23dae5a0..fe72c8b9 100644 --- a/api/src/connection/datasource.ts +++ b/api/src/connection/datasource.ts @@ -10,30 +10,30 @@ const env = process.env; * @returns The connection options for TypeORM DataSource or TypeORMModule. */ export const dataSourceOptions = (): DataSourceOptions => { - // Safely cast the database type or default to 'mysql' - const dbType = (env.TR_DB_TYPE as any) || 'mysql'; - - // Parse the port safely with fallback to 3306 if parsing fails - const parsedPort = parseInt(env.TR_DB_PORT, 10); - const port = Number.isNaN(parsedPort) ? 3306 : parsedPort; - - // Base options object using the more generic DataSourceOptions - const options: DataSourceOptions = { - type: dbType, - host: env.TR_DB_HOST || 'localhost', - port, - username: env.TR_DB_USER || 'root', - password: env.TR_DB_PASSWORD || 'root', - database: env.TR_DB_DATABASE || 'tr_dev', - charset: 'utf8mb4', - synchronize: false, - logging: false, - entities: [__dirname + '/../entity/*.entity.{js,ts}'], - migrations: [__dirname + '/../migrations/*.{js,ts}'], - namingStrategy: dbType === 'postgres' ? new SnakeNamingStrategy() : new DefaultNamingStrategy(), - }; - - return options; + // Safely cast the database type or default to 'mysql' + const dbType = (env.TR_DB_TYPE as any) || 'mysql'; + + // Parse the port safely with fallback to 3306 if parsing fails + const parsedPort = parseInt(env.TR_DB_PORT, 10); + const port = Number.isNaN(parsedPort) ? 3306 : parsedPort; + + // Base options object using the more generic DataSourceOptions + const options: DataSourceOptions = { + type: dbType, + host: env.TR_DB_HOST || 'localhost', + port, + username: env.TR_DB_USER || 'root', + password: env.TR_DB_PASSWORD || 'root', + database: env.TR_DB_DATABASE || 'tr_dev', + charset: 'utf8mb4', + synchronize: false, + logging: false, + entities: [__dirname + '/../entity/*.entity.{js,ts}'], + migrations: [__dirname + '/../migrations/*.{js,ts}'], + namingStrategy: dbType === 'postgres' ? new SnakeNamingStrategy() : new DefaultNamingStrategy(), + }; + + return options; }; /** @@ -43,17 +43,17 @@ export const dataSourceOptions = (): DataSourceOptions => { */ let dataSource: DataSource; export const getDataSourceConnection = async (): Promise => { - if (!dataSource) { - dataSource = new DataSource(dataSourceOptions()); - } - - try { - if (!dataSource.isInitialized) { - await dataSource.initialize(); - } - } catch (error) { - console.error(`Error initializing database connection: ${error?.message}`); - } - - return dataSource; + if (!dataSource) { + dataSource = new DataSource(dataSourceOptions()); + } + + try { + if (!dataSource.isInitialized) { + await dataSource.initialize(); + } + } catch (error) { + console.error(`Error initializing database connection: ${error?.message}`); + } + + return dataSource; }; diff --git a/api/src/formatters/fixtures/function-name-nested.json b/api/src/formatters/fixtures/function-name-nested.json index 0a8777b8..ed4df8b9 100644 --- a/api/src/formatters/fixtures/function-name-nested.json +++ b/api/src/formatters/fixtures/function-name-nested.json @@ -1,21 +1,21 @@ { - "term": { - "one": "data.VWAnalyticssaleorder.docdate.day", - "two": { - "hour": "data.VWAnalyticssaleorder.docdate" - }, - "three": "UPDATE_SCHEDULER_SCREEN.EDIT_EVENT.HOURS" + "term": { + "one": "data.VWAnalyticssaleorder.docdate.day", + "two": { + "hour": "data.VWAnalyticssaleorder.docdate" }, - "data": { - "VWAnalyticssaleorder": { - "docdate": { - "day": "foo" - } - } - }, - "UPDATE_SCHEDULER_SCREEN": { - "EDIT_EVENT": { - "HOURS": "bar" - } + "three": "UPDATE_SCHEDULER_SCREEN.EDIT_EVENT.HOURS" + }, + "data": { + "VWAnalyticssaleorder": { + "docdate": { + "day": "foo" + } + } + }, + "UPDATE_SCHEDULER_SCREEN": { + "EDIT_EVENT": { + "HOURS": "bar" } -} \ No newline at end of file + } +} diff --git a/api/src/formatters/fixtures/simple-flat.json b/api/src/formatters/fixtures/simple-flat.json index b1d53c6b..09e29bf4 100644 --- a/api/src/formatters/fixtures/simple-flat.json +++ b/api/src/formatters/fixtures/simple-flat.json @@ -1,6 +1,6 @@ { - "term.one": "Current Plan: {{ project.plan.name }}", - "term two": "{VAR_PLURAL, plural, =0 {locales} =1 {locale} other {locales} }", - "TERM_THREE": "Export format...", - "term:four": "hello there you\\nthis should be in a newline" -} \ No newline at end of file + "term.one": "Current Plan: {{ project.plan.name }}", + "term two": "{VAR_PLURAL, plural, =0 {locales} =1 {locale} other {locales} }", + "TERM_THREE": "Export format...", + "term:four": "hello there you\\nthis should be in a newline" +} diff --git a/api/src/formatters/fixtures/simple-nested.json b/api/src/formatters/fixtures/simple-nested.json index a383d601..d953d860 100644 --- a/api/src/formatters/fixtures/simple-nested.json +++ b/api/src/formatters/fixtures/simple-nested.json @@ -1,8 +1,8 @@ { - "term": { - "one": "Current Plan: {{ project.plan.name }}" - }, - "term two": "{VAR_PLURAL, plural, =0 {locales} =1 {locale} other {locales} }", - "TERM_THREE": "Export format...", - "term:four": "hello there you\\nthis should be in a newline" -} \ No newline at end of file + "term": { + "one": "Current Plan: {{ project.plan.name }}" + }, + "term two": "{VAR_PLURAL, plural, =0 {locales} =1 {locale} other {locales} }", + "TERM_THREE": "Export format...", + "term:four": "hello there you\\nthis should be in a newline" +} diff --git a/api/test/jest-e2e.json b/api/test/jest-e2e.json index 3092a679..3536f4df 100644 --- a/api/test/jest-e2e.json +++ b/api/test/jest-e2e.json @@ -1,14 +1,10 @@ { - "moduleFileExtensions": [ - "js", - "json", - "ts" - ], - "rootDir": ".", - "testEnvironment": "node", - "testTimeout": 120000, - "testRegex": ".e2e-spec.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - } -} \ No newline at end of file + "moduleFileExtensions": ["js", "json", "ts"], + "rootDir": ".", + "testEnvironment": "node", + "testTimeout": 120000, + "testRegex": ".e2e-spec.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + } +} diff --git a/api/tslint.json b/api/tslint.json index 572abc4a..d910eaa2 100644 --- a/api/tslint.json +++ b/api/tslint.json @@ -29,10 +29,6 @@ }, "rulesDirectory": [], "linterOptions": { - "exclude": [ - "bin", - "src/migrations/*", - "**/*.json" - ] + "exclude": ["bin", "src/migrations/*", "**/*.json"] } } diff --git a/webapp/angular.json b/webapp/angular.json index 3150a9d7..e9dc5616 100644 --- a/webapp/angular.json +++ b/webapp/angular.json @@ -20,13 +20,9 @@ "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", "assets": ["src/favicon.ico", "src/assets"], - "styles": [ - "src/styles.scss" - ], + "styles": ["src/styles.scss"], "scripts": [], - "allowedCommonJsDependencies": [ - "lodash" - ] + "allowedCommonJsDependencies": ["lodash"] }, "configurations": { "production": { diff --git a/webapp/e2e/protractor.conf.js b/webapp/e2e/protractor.conf.js index 86776a39..6e8a77be 100644 --- a/webapp/e2e/protractor.conf.js +++ b/webapp/e2e/protractor.conf.js @@ -5,11 +5,9 @@ const { SpecReporter } = require('jasmine-spec-reporter'); exports.config = { allScriptsTimeout: 11000, - specs: [ - './src/**/*.e2e-spec.ts' - ], + specs: ['./src/**/*.e2e-spec.ts'], capabilities: { - 'browserName': 'chrome' + browserName: 'chrome', }, directConnect: true, baseUrl: 'http://localhost:4200/', @@ -17,12 +15,12 @@ exports.config = { jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, - print: function() {} + print: function () {}, }, onPrepare() { require('ts-node').register({ - project: require('path').join(__dirname, './tsconfig.e2e.json') + project: require('path').join(__dirname, './tsconfig.e2e.json'), }); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); - } -}; \ No newline at end of file + }, +}; diff --git a/webapp/e2e/tsconfig.e2e.json b/webapp/e2e/tsconfig.e2e.json index a6dd6220..22e04cb1 100644 --- a/webapp/e2e/tsconfig.e2e.json +++ b/webapp/e2e/tsconfig.e2e.json @@ -4,10 +4,6 @@ "outDir": "../out-tsc/app", "module": "commonjs", "target": "es5", - "types": [ - "jasmine", - "jasminewd2", - "node" - ] + "types": ["jasmine", "jasminewd2", "node"] } -} \ No newline at end of file +}