diff --git a/config/default.ts b/config/default.ts new file mode 100644 index 0000000..d9172d6 --- /dev/null +++ b/config/default.ts @@ -0,0 +1,36 @@ +export default { + log_level: "DEV", + db_log_level: "ERROR", + public_url: "http://localhost:4899", + public_websocket_url: "ws://localhost:4899", + port: 4899, + mysql: { + connectionLimit: 10, + host: "localhost", + user: "root", + password: "", + database: "wms2", + create_database_automatically: false + }, + redis: { + host: "127.0.0.1", + port: 6379 + }, + session: { + secret: "very_secret_not_known", + cookie: { + secure: false + } + }, + mail: { + host: "127.0.0.1", + port: "1025", + secure: false, + username: "", + password: "", + allow_invalid_tls: true + }, + view: { + cache: false + } +}; \ No newline at end of file diff --git a/config/production.ts b/config/production.ts new file mode 100644 index 0000000..fd0c69b --- /dev/null +++ b/config/production.ts @@ -0,0 +1,15 @@ +export default { + log_level: "DEBUG", + db_log_level: "ERROR", + public_url: "https://watch-my.stream", + public_websocket_url: "wss://watch-my.stream", + session: { + cookie: { + secure: true + } + }, + mail: { + secure: true, + allow_invalid_tls: false + } +}; \ No newline at end of file diff --git a/config/test.ts b/config/test.ts new file mode 100644 index 0000000..649dec2 --- /dev/null +++ b/config/test.ts @@ -0,0 +1,9 @@ +export default { + mysql: { + host: "localhost", + user: "root", + password: "", + database: "wms2_test", + create_database_automatically: true + } +}; \ No newline at end of file diff --git a/package.json b/package.json index d93e6ea..f7610b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wms-core", - "version": "0.1.5", + "version": "0.2.0", "description": "Node web framework", "repository": "git@gitlab.com:ArisuOngaku/wms-core.git", "author": "Alice Gaudon ", @@ -13,7 +13,7 @@ "types": "dist/index.d.ts", "scripts": { "test": "jest --verbose --runInBand", - "build": "rm -r dist && tsc && cp package.json dist/ && mkdir dist/types && cp src/types/* dist/types/", + "build": "(test ! -d dist || rm -r dist) && tsc && cp package.json dist/ && mkdir dist/types && cp src/types/* dist/types/ && mv dist/src/* dist/ && rm -r dist/src", "publish_to_local": "yarn test && yarn build && cd dist && yarn publish" }, "devDependencies": { @@ -47,6 +47,7 @@ "nodemailer": "^6.4.6", "nunjucks": "^3.2.1", "on-finished": "^2.3.0", + "ts-node": "^8.9.0", "uuid": "^7.0.3", "ws": "^7.2.3" } diff --git a/tsconfig.json b/tsconfig.json index 55ae5f1..2b8a001 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,16 +5,18 @@ "declaration": true, "stripInternal": true, - "strict": true, -// "noUnusedLocals": true, -// "noUnusedParameters": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, "allowSyntheticDefaultImports": true, "moduleResolution": "Node", "esModuleInterop": true, "baseUrl": "dist", - "rootDir": "src", + "rootDirs": [ + "src", + "config" + ], "sourceRoot": "src", "inlineSourceMap": true, "inlineSources": true, @@ -29,6 +31,7 @@ ] }, "include": [ - "src/**/*" + "src/**/*", + "config/*" ] } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 15ae5b0..77e9ad0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -801,6 +801,11 @@ anymatch@^3.0.3, anymatch@~3.1.1: normalize-path "^3.0.0" picomatch "^2.0.4" +arg@^4.1.0: + version "4.1.3" + resolved "http://127.0.0.1:4873/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "http://127.0.0.1:4873/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1538,6 +1543,11 @@ diff-sequences@^25.2.6: resolved "http://127.0.0.1:4873/diff-sequences/-/diff-sequences-25.2.6.tgz#5f467c00edd35352b7bca46d7927d60e687a76dd" integrity sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg== +diff@^4.0.1: + version "4.0.2" + resolved "http://127.0.0.1:4873/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + dom-serializer@0, dom-serializer@^0.2.1: version "0.2.2" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51" @@ -3116,7 +3126,7 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" -make-error@1.x: +make-error@1.x, make-error@^1.1.1: version "1.3.6" resolved "http://127.0.0.1:4873/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== @@ -4443,7 +4453,7 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6: +source-map-support@^0.5.17, source-map-support@^0.5.6: version "0.5.18" resolved "http://127.0.0.1:4873/source-map-support/-/source-map-support-0.5.18.tgz#f5f33489e270bd7f7d7e7b8debf283f3a4066960" integrity sha512-9luZr/BZ2QeU6tO2uG8N2aZpVSli4TSAOAqFOyTO51AJcD9P99c0K1h6dD6r6qo5dyT44BR5exweOaLLeldTkQ== @@ -4758,6 +4768,17 @@ ts-jest@^25.4.0: semver "6.x" yargs-parser "18.x" +ts-node@^8.9.0: + version "8.9.0" + resolved "http://127.0.0.1:4873/ts-node/-/ts-node-8.9.0.tgz#d7bf7272dcbecd3a2aa18bd0b96c7d2f270c15d4" + integrity sha512-rwkXfOs9zmoHrV8xE++dmNd6ZIS+nmHHCxcV53ekGJrxFLMbp+pizpPS07ARvhwneCIECPppOwbZHvw9sQtU4w== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.17" + yn "3.1.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -5132,3 +5153,8 @@ yargs@^15.3.1: which-module "^2.0.0" y18n "^4.0.0" yargs-parser "^18.1.1" + +yn@3.1.1: + version "3.1.1" + resolved "http://127.0.0.1:4873/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==