From 3227854086017ec12f7ad57cb4e00e51f43426ce Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Thu, 2 May 2024 00:09:26 +0200 Subject: [PATCH] Addded: .env.example, fixed build --- api/.gitignore | 1 + api/package.json | 2 +- api/src/.env.example | 6 ++++++ api/src/utils/copy_assets.ts | 6 ++++++ api/tsconfig.json | 7 +++++-- 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 api/src/.env.example create mode 100644 api/src/utils/copy_assets.ts diff --git a/api/.gitignore b/api/.gitignore index 1945131..e44b27c 100644 --- a/api/.gitignore +++ b/api/.gitignore @@ -1,3 +1,4 @@ node_modules/ +dist/ package-lock.json .env diff --git a/api/package.json b/api/package.json index fb4276d..fcfc1d4 100644 --- a/api/package.json +++ b/api/package.json @@ -11,7 +11,7 @@ "start:prod": "node dist/server.js", "tsc": "tsc -p .", "clean": "rimraf dist", - "copy-assets": "ts-node src/utils/copyAssets", + "copy-assets": "ts-node src/utils/copy_assets", "build": "npm-run-all clean tsc copy-assets", "test": "npx jest . --runInBand", "format": "npx prettier --write ." diff --git a/api/src/.env.example b/api/src/.env.example new file mode 100644 index 0000000..fe4126a --- /dev/null +++ b/api/src/.env.example @@ -0,0 +1,6 @@ +APP_PORT=6060 +APP_HOST=127.0.0.1 + +JWT_SECRET=generate_random_secret + +DB_URI='mongodb://username:password@localhost:27017/database?authSource=admin' \ No newline at end of file diff --git a/api/src/utils/copy_assets.ts b/api/src/utils/copy_assets.ts new file mode 100644 index 0000000..6a9baf9 --- /dev/null +++ b/api/src/utils/copy_assets.ts @@ -0,0 +1,6 @@ +import * as shell from 'shelljs'; + +// Copy all the view templates +//shell.cp('-R', 'src/views', 'dist/') +//shell.cp('-R', 'src/public', 'dist/'); +shell.cp('-u', 'src/.env', 'dist/'); \ No newline at end of file diff --git a/api/tsconfig.json b/api/tsconfig.json index 3ec4ba1..bcf7ec4 100644 --- a/api/tsconfig.json +++ b/api/tsconfig.json @@ -7,9 +7,12 @@ "strict": true /* Enable all strict type-checking options. */, "baseUrl": "./" /* Base directory to resolve non-absolute module names. */, "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, + "resolveJsonModule": true, + "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */, "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - "declaration": true + //"declaration": true, /* Enables experimental support for emitting type metadata for decorators. */ }, - "exclude": ["_old", "node_modules", "src/make-files", "src/skeletons", "src/tests", "src/interfaces", "src/utils"] + "exclude": ["src/tests", "./tests"] }