Skip to content

Commit

Permalink
Merge pull request #132 from BinaryStudioAcademy/development
Browse files Browse the repository at this point in the history
development to production
  • Loading branch information
v0ldemar01 authored Jun 11, 2024
2 parents 89d22c8 + efbf613 commit 89f1f5e
Show file tree
Hide file tree
Showing 617 changed files with 14,048 additions and 25,378 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8

[*.md]
indent_size = unset
indent_style = space
149 changes: 0 additions & 149 deletions .eslintrc.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .lintstagedrc.yml

This file was deleted.

14 changes: 6 additions & 8 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ ls:
ignore:
- .git
- node_modules
- build
- shared/build
- shared/node_modules
- client/build
- client/node_modules
- server/build
- server/node_modules
- .idea
- packages/shared/build
- packages/shared/node_modules
- apps/frontend/build
- apps/frontend/node_modules
- apps/backend/build
- apps/backend/node_modules
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18
20.11
13 changes: 0 additions & 13 deletions .prettierrc.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .stylelintrc.yml

This file was deleted.

11 changes: 0 additions & 11 deletions server/.env.example → apps/backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,3 @@ DB_CLIENT=pg
DB_POOL_MIN=1
DB_POOL_MAX=10

#
# AUTHENTICATION
#
# SECRET_KEY has to be changed to own random secret key
SECRET_KEY=secretkeysecretkeysecretkey

# Image Storage
#
# GYAZO_ACCESS_TOKEN - has to be changed to a real key from Gyazo
GYAZO_UPLOAD_API_URL=https://upload.gyazo.com/api/upload
GYAZO_ACCESS_TOKEN=gyazoaccesstoken
54 changes: 54 additions & 0 deletions apps/backend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import baseConfig from '../../eslint.config.js';

/** @typedef {import("eslint").Linter.FlatConfig} */
let FlatConfig;

/** @type {FlatConfig} */
const ignoresConfig = {
ignores: ['build']
};

/** @type {FlatConfig[]} */
const overridesConfigs = [
{
files: ['knexfile.ts'],
rules: {
'import/no-default-export': ['off']
}
},
{
files: ['jest.config.js'],
rules: {
'@typescript-eslint/explicit-function-return-type': ['off'],
'@typescript-eslint/no-magic-numbers': ['off'],
'@typescript-eslint/no-unsafe-argument': ['off'],
'@typescript-eslint/no-unsafe-assignment': ['off'],
'@typescript-eslint/no-unsafe-call': ['off'],
'@typescript-eslint/no-unsafe-member-access': ['off'],
'@typescript-eslint/no-unsafe-return': ['off'],
'import/no-default-export': ['off']
}
},
{
files: ['src/db/migrations/**/*.ts'],
rules: {
'unicorn/filename-case': [
'error',
{
case: 'snakeCase'
}
]
}
},
{
files: ['src/libs/modules/controller/controller.module.ts'],
rules: {
'@typescript-eslint/no-magic-numbers': ['off']
}
}
];

/** @type {FlatConfig[]} */
const config = [...baseConfig, ignoresConfig, ...overridesConfigs];

export default config;
13 changes: 6 additions & 7 deletions server/jest.config.js → apps/backend/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';

import { pathsToModuleNameMapper } from 'ts-jest';

import tsconfigJson from './tsconfig.json' assert { type: 'json' };

const sourcePath = join(fileURLToPath(import.meta.url), '../');

const manageKey = key => {
return key.includes('(.*)') ? key.slice(0, -1) + '\\.js$' : key;
return key.includes('(.*)') ? key.slice(0, -1) + String.raw`\.js$` : key;
};

const manageMapper = mapper => ({
Expand All @@ -19,19 +18,19 @@ const manageMapper = mapper => ({
});

export default {
testEnvironment: 'jest-environment-node',
preset: 'ts-jest/presets/default-esm',
extensionsToTreatAsEsm: ['.ts'],
transformIgnorePatterns: ['node_modules/'],
testPathIgnorePatterns: ['node_modules/', 'dist/', 'build/'],
moduleNameMapper: manageMapper(
pathsToModuleNameMapper(tsconfigJson.compilerOptions.paths, {
prefix: sourcePath
})
),
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'jest-environment-node',
testPathIgnorePatterns: ['node_modules/', 'dist/', 'build/'],
testTimeout: 10_000,
transform: {
'^.+\\.tsx?$': ['ts-jest', { useESM: true }]
},
testTimeout: 10_000,
transformIgnorePatterns: ['node_modules/'],
workerIdleMemoryLimit: '1GB'
};
3 changes: 3 additions & 0 deletions apps/backend/knexfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { database } from '~/libs/modules/database/database.js';

export default database.environmentsConfig;
12 changes: 12 additions & 0 deletions apps/backend/lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { default as baseConfig } from '../../lint-staged.config.js';

/** @type {import('lint-staged').Config} */
const config = {
...baseConfig,
'**/*.ts': [
() => 'npm run lint:js -w apps/backend',
() => 'npm run lint:type -w apps/backend'
]
};

export default config;
53 changes: 53 additions & 0 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "@thread-js/backend",
"private": true,
"engines": {
"node": "20.11.x",
"npm": "10.2.x"
},
"type": "module",
"scripts": {
"knex": "cross-env NODE_OPTIONS=\"--loader ts-paths-esm-loader\" knex",
"migrate:dev": "npm run knex migrate:latest",
"migrate:dev:make": "npm run knex migrate:make -- -x ts",
"migrate:dev:down": "npm run knex migrate:down",
"migrate:dev:rollback": "npm run knex migrate:rollback -- --all",
"migrate:dev:unlock": "npm run knex migrate:unlock",
"migrate:dev:reset": "npm run migrate:dev:rollback && npm run migrate:dev",
"seed:run": "npm run knex seed:run",
"start:dev": "tsx watch ./src/index.ts",
"lint:type": "npx tsc --noEmit",
"lint:js": "npx eslint . --max-warnings=0",
"lint": "concurrently \"npm:lint:*\"",
"build": "tsc && tsc-alias",
"pretest": "cross-env NODE_ENV=test npm run migrate:dev",
"test": "cross-env NODE_ENV=test node --experimental-vm-modules --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --config jest.config.js --runInBand --forceExit --detectOpenHandles",
"test:auth": "npm run test -- --verbose --rootDir=tests/modules/auth/"
},
"dependencies": {
"@fastify/static": "7.0.4",
"@thread-js/shared": "*",
"convict": "6.2.4",
"dotenv": "16.4.5",
"fastify": "4.27.0",
"knex": "3.1.0",
"objection": "3.1.4",
"pg": "8.12.0",
"pino": "9.1.0",
"qs": "6.12.1"
},
"devDependencies": {
"@faker-js/faker": "8.4.1",
"@jest/globals": "29.7.0",
"@types/convict": "6.1.6",
"@types/jest": "29.5.12",
"@types/pg": "8.11.6",
"@types/qs": "6.9.15",
"cross-env": "7.0.3",
"jest": "29.7.0",
"pino-pretty": "11.2.0",
"ts-jest": "29.1.4",
"ts-paths-esm-loader": "1.4.3",
"tsx": "4.15.1"
}
}
Loading

0 comments on commit 89f1f5e

Please sign in to comment.