From 4e5d5ae31171a9b60e684694e04b840a92abbe50 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Mon, 1 Mar 2021 17:18:18 +0100 Subject: [PATCH] Added basic files and depedencies --- .vscode/extensions.json | 11 ++++++ .vscode/settings.json | 27 ++++++++++++++ package.json | 83 +++++++++++++++++++++++++++++++++++++++++ sort_translations.js | 16 ++++++++ tsconfig.json | 19 ++++++++++ 5 files changed, 156 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 package.json create mode 100644 sort_translations.js create mode 100644 tsconfig.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..1c8e087 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "2gua.rainbow-brackets", + "christian-kohler.npm-intellisense", + "remimarsal.prettier-now", + "lokalise.i18n-ally", + ], + "unwantedRecommendations": [ + "antfu.i18n-ally" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..988ce3b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,27 @@ +{ + "editor.formatOnSave": true, + "typescript.format.enable": true, + "typescript.preferences.quoteStyle": "single", + "[json]": { + "editor.defaultFormatter": "vscode.json-language-features" + }, + "[typescript]": { + "editor.defaultFormatter": "vscode.typescript-language-features", + "editor.codeActionsOnSave": { + "source.organizeImports": true, + // "source.fixAll": true + } + }, + "javascript.preferences.quoteStyle": "single", + "javascript.preferences.importModuleSpecifierEnding": "minimal", + "typescript.preferences.importModuleSpecifierEnding": "minimal", + "typescript.preferences.includePackageJsonAutoImports": "on", + "i18n-ally.localesPaths": "src/locales", + "i18n-ally.keystyle": "nested", + "i18n-ally.extract.keygenStrategy":"slug", + "i18n-ally.enabledFrameworks": [ + "custom" + ], + "i18n-ally.sourceLanguage": "en" + +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..4d3bcbb --- /dev/null +++ b/package.json @@ -0,0 +1,83 @@ +{ + "name": "@odit/lfk-mailer", + "version": "0.0.1", + "description": "The document mailer for the LfK! runner system. This generates and sends mails (password reset, welcome, ...)", + "main": "src/app.ts", + "scripts": { + "dev": "nodemon src/app.ts", + "build": "rimraf ./dist && tsc && cp-cli ./src/templates ./dist/templates && cp-cli ./src/locales ./dist/locales", + "licenses:export": "license-exporter --markdown", + "release": "release-it --only-version", + "translations:sort": "node sort_translations.js"//, + // "test:speed": "start-server-and-test dev http://localhost:4010/docs/openapi.json test:speed:run", + // "test:speed:run": "ts-node src/tests/speedtest.ts" + }, + "repository": { + "type": "git", + "url": "git@git.odit.services:lfk/mailer.git" + }, + "keywords": [ + "odit", + "lfk", + "mail", + "node" + ], + "author": { + "name": "ODIT.Services", + "email": "info@odit.services", + "url": "https://odit.services" + }, + "contributors": [ + { + "name": "Philipp Dormann", + "email": "philipp@philippdormann.de", + "url": "https://philippdormann.de" + }, + { + "name": "Nicolai Ort", + "email": "info@nicolai-ort.com", + "url": "https://nicolai-ort.com" + } + ], + "license": "CC-BY-NC-SA-4.0", + "dependencies": { + "@odit/class-validator-jsonschema": "^2.1.1", + "class-transformer": "0.3.1", + "class-validator": "^0.13.1", + "consola": "^2.15.0", + "cors": "^2.8.5", + "dotenv": "^8.2.0", + "express": "^4.17.1", + "handlebars": "^4.7.6", + "i18next": "^19.8.7", + "i18next-fs-backend": "^1.0.8", + "reflect-metadata": "^0.1.13", + "routing-controllers": "0.9.0-alpha.6", + "routing-controllers-openapi": "2.2.0" + }, + "devDependencies": { + "@odit/license-exporter": "^0.0.10", + "@types/express": "^4.17.11", + "@types/node": "^14.14.22", + "cp-cli": "^2.0.0", + "nodemon": "^2.0.7", + "release-it": "^14.2.2", + "rimraf": "^3.0.2", + "start-server-and-test": "^1.12.0", + "ts-node": "^9.1.1", + "typescript": "^4.1.3" + }, + "release-it": { + "git": { + "commit": true, + "requireCleanWorkingDir": false, + "commitMessage": "🚀Bumped version to v${version}", + "requireBranch": "dev", + "push": false, + "tag": false + }, + "npm": { + "publish": false + } + } +} diff --git a/sort_translations.js b/sort_translations.js new file mode 100644 index 0000000..1120c86 --- /dev/null +++ b/sort_translations.js @@ -0,0 +1,16 @@ +const fs = require('fs'); +// get all language files +const files = fs.readdirSync('./src/locales/'); +files.forEach((f) => { + // read file as object + const unordered = JSON.parse(fs.readFileSync(`src/locales/${f}`)); + // order object by keys alpabetically A-Z + const ordered = Object.keys(unordered).sort().reduce((obj, key) => { + obj[key] = unordered[key]; + return obj; + }, {}); + // format output as json for commit diff compatibility + const out = JSON.stringify(ordered, 0, 4); + // write output file + fs.writeFileSync(`src/locales/${f}`, out); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d810d84 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "rootDir": "./src", + "outDir": "./dist", + "esModuleInterop": true, + "strict": false, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "sourceMap": false + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + ] +} \ No newline at end of file