Skip to content

Commit

Permalink
Make compile, format, lint and test work
Browse files Browse the repository at this point in the history
Add the locales files from transition legacy in the `locales` folder
and test configuration and other necessary files in the `tests` folder.

Add eslint, prettier and base tsconfig files from legacy.

Update paths for this new repo. Issues have been opened to TODOs added
where those paths should be different.
  • Loading branch information
tahini committed Nov 4, 2022
1 parent 48b1ee0 commit 4c10ae5
Show file tree
Hide file tree
Showing 81 changed files with 20,311 additions and 92 deletions.
57 changes: 57 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
PROJECT_CONFIG=${rootDir}/examples/transition/config.js
#OSRM_DIRECTORY_PREFIX=demo_osrm (default: empty)
HOST=http://localhost:8080
PG_DATABASE_DEVELOPMENT=tr_dev
PG_DATABASE_PRODUCTION=tr
#PG_DATABASE_SCHEMA=demo_survey (default: PROJECT_SHORTNAME)
PG_DATABASE_TEST=tr_test
PG_CONNECTION_STRING_PREFIX=postgres://postgres:@localhost:5432/
EXPRESS_SESSION_SECRET_KEY=MYSECRETKEY
# Path to the directory containing the trRouting executable
#TR_ROUTING_PATH=/path/to/dir/containing/trRouting
# Host and port for the trRouting server
#TR_ROUTING_HOST_URL=http://locahost
#TR_ROUTING_HOST_PORT=4000
# To support Google login
GOOGLE_API_KEY=MYGOOGLEAPIKEY
GOOGLE_API_KEY_DEV=MYGOOGLEAPIKEYFORDEVELOPMENT
GOOGLE_OAUTH_CLIENT_ID=GOOGLEOAUTHCLIENTID
GOOGLE_OAUTH_SECRET_KEY=GOOGLEOAUTHSECRETKEY
# To support Facebook login
FACEBOOK_APP_ID=FACEBOOKAPPID
FACEBOOK_APP_SECRET=FACEBOOKAPPSECRET
# Required for the mapbox map
MAPBOX_ACCESS_TOKEN=MYMAPBOXACCESSTOKEN
MAPBOX_USER_ID=mapbox
MAPBOX_STYLE_ID=dark-v10
#MAGIC_LINK_SECRET_KEY=MYVERYLONGSECRETKEYTOENCRYPTTOKENTOSENDTOUSERFORPASSWORDLESSLOGIN
#CUSTOM_RASTER_TILES_XYZ_URL=https://exampltest/{z}/{x}/{y}
#CUSTOM_RASTER_TILES_MIN_ZOOM=8
#CUSTOM_RASTER_TILES_MAX_ZOOM=22
PROJECT_SAMPLE=demo
#SSL_PRIVATE_KEY=/path/to/privkey.pem
#SSL_CERT=/path/to/sslcert.pem
STARTUP_RECREATE_CACHE=false

# Uncomment and update to change the URL of the API to get the OpenStreetMap data
#OSM_OVERPASS_API_URL=http://overpass-api.de/api/interpreter

##############################################################
# Mailing configuration, required for sending emails to users
# strategy can be 'smtp' or 'sendmail'
MAIL_TRANSPORT_STRATEGY=smtp

# Sendmail strategy requires a path to sendmail
# MAIL_TRANSPORT_SENDMAIL_PATH=/usr/sbin/sendmail

# smtp requires credentials to the smtp server and additional configurations
MAIL_TRANSPORT_SMTP_HOST=smtp.example.org
MAIL_TRANSPORT_SMTP_PORT=587
# Whether to use TLS
MAIL_TRANSPORT_SMTP_SECURE=false
# SMTP server credentials
MAIL_TRANSPORT_SMTP_AUTH_USER=myUser
MAIL_TRANSPORT_SMTP_AUTH_PWD=password

# From email
MAIL_FROM_ADDRESS=[email protected]
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ services/json2capnp/testData
.vscode/restore-terminals.json

# custom
public/dist/
public/index.html
packages/**/lib
packages/**/node_modules
packages/transition/backend/file/
tests/runtime
tests/test

#example apps
examples/**/runtime
38 changes: 38 additions & 0 deletions configs/base.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"extends": [
"./gts.eslintrc.json",
"plugin:@typescript-eslint/recommended" // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],
"rules": {
"prettier/prettier": "off", // We'll use prettier-eslint to format before running eslint, that's the way to go to have allman braces AND prettier formatting
"@typescript-eslint/no-var-requires": "warn",
"arrow-parens": ["error", "always"],
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
"constructor-super": "warn",
"node/no-missing-require": ["error", {
"tryExtensions": [".js", ".json", ".node", ".ts"]
}],
"indent": ["warn", 4, {"VariableDeclarator": 0}],
"linebreak-style": ["error", "unix"],
"no-dupe-keys": "warn",
"no-empty": "warn",
"no-empty-function": "error",
"no-unexpected-multiline": "warn",
"no-constant-condition": "warn",
"no-this-before-super": "warn",
"no-import-assign": "warn",
"no-irregular-whitespace": "warn",
"no-trailing-spaces": "error",
"no-const-assign": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-useless-escape": "warn",
"no-cond-assign": "warn",
"no-dupe-else-if": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "argsIgnorePattern": "^_", "ignoreRestSiblings": false }],
"object-curly-spacing": ["warn", "always"],
"semi": ["error", "always"],
"quotes": ["warn", "single"]
}
}

9 changes: 9 additions & 0 deletions configs/base.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
...require('./gts.prettierrc.json'),
"tabWidth": 4,
"arrowParens": "always",
"bracketSpacing": true,
"trailingComma": "none",
"printWidth": 120,
}

22 changes: 22 additions & 0 deletions configs/base.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends:": "./gts.tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"isolatedModules": true,
"lib": ["esnext"],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es6"
},
"exclude": [
"node_modules"
]
}

62 changes: 62 additions & 0 deletions configs/gts.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"plugins": [
"node"
],
"rules": {
"block-scoped-var": "error",
"eqeqeq": "error",
"no-var": "error",
"prefer-const": "error",
"eol-last": "error",
"prefer-arrow-callback": "error",
"no-trailing-spaces": "error",
"quotes": ["warn", "single", { "avoidEscape": true }],
"no-restricted-properties": [
"error",
{
"object": "describe",
"property": "only"
},
{
"object": "it",
"property": "only"
}
]
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-warning-comments": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/camelcase": "off",
"node/no-missing-import": "off",
"node/no-empty-function": "off",
"node/no-unsupported-features/es-syntax": "off",
"node/no-missing-require": "off",
"node/shebang": "off",
"no-dupe-class-members": "off",
"require-atomic-updates": "off"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
}
}
]
}

6 changes: 6 additions & 0 deletions configs/gts.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"bracketSpacing": false,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid"
}
20 changes: 20 additions & 0 deletions configs/gts.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es2018"],
"module": "commonjs",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"pretty": true,
"sourceMap": true,
"strict": true,
"target": "es2018"
},
"exclude": [
"node_modules"
]
}
38 changes: 38 additions & 0 deletions configs/react.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"extends": [
"./base.eslintrc.json",
"plugin:react/recommended" // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],
"env": {
"browser": true,
"es2020": true,
"node": true
},
"rules": {
"react/prop-types": "warn",
"react/no-string-refs": "warn",
"react/no-unescaped-entities": "warn",
"react/display-name": "warn"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": [
"react"
],
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "detect" // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// default to latest and warns if missing
// It will default to "detect" in the future
}
}
}
31 changes: 31 additions & 0 deletions configs/react.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"extends:": "./base.tsconfig.json",
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react",
"lib": [
"dom",
"dom.iterable",
"esnext",
"es5"
],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es5",
"types": ["node", "jest"]
},
"exclude": [
"node_modules"
]
}

53 changes: 53 additions & 0 deletions locales/en/auth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"login":"login",
"Login": "Login",
"logout":"logout",
"Logout":"Logout",
"Register": "Register",
"Start": "Start",
"Cancel": "Cancel",
"Email": "Email",
"EmailSubLabel": "",
"Confirm": "Confirm",
"UsernameOrEmail": "Username or email",
"Username": "Username",
"invalidEmail": "Email is invalid",
"Password": "Password",
"pleaseChooseANewPassword": "Please choose a new password",
"invalidUsernameOrEmail": "Username or email is invalid.",
"PasswordConfirmation": "Password confirmation",
"registerIfYouHaveNoAccount": "If you don't already have an account, please register here",
"iAlreadyHaveAnAccount": "If you already registered an account, login here",
"missingUsernameOrEmail": "Please provide your username or your email address",
"missingUsername": "Please provide your username",
"missingEmail": "Please provide your email address",
"missingPasswordRegister": "Please provide your chosen password",
"missingPassword": "Password is missing",
"missingPasswordConfirmation": "Please confirm your chosen password",
"passwordMustHaveAtLeastNCharacters": "Password must have at least {{n}} characters",
"passwordsDoNotMatch": "The password and its confirmation do not match. Please verify that you entered the same chosen password in both fields.",
"pleaseEnterLoginCredentials": "Please enter the following connection information:",
"authenticationFailed": "Your username, email address or password was not found or is invalid",
"usernameOrEmailAlreadyExists": "This username or email address is already registered in our database. Please use your existing account.",
"pleaseChooseAUsernameOrEnterYourEmail": "Please choose a username or enter your email address to register",
"pleaseChooseAUsernameOrEnterYourEmailAndAPassword": "To register, please choose a username or enter your email address, then choose a password and confirm it.",
"pleaseEnterYourAccountEmail": "Please enter the email address associated with your account",
"emailDoesNotExist": "This email is not registered in our database",
"forgotPasswordEmailConfirmation": "In the next few minutes, you will receive an email containing a link to reset your password.",
"forgotPassword": "I forgot my password",
"EnterCaptchaText": "Enter security code",
"captchaMismatch": "The CAPTCHA security code answer is wrong (the code is case sensitive).",
"ConfirmationTokenConfirming": "New account confirmation in progress...",
"ConfirmationTokenConfirmed": "The new account is now active!",
"ConfirmationTokenNotFound": "The confirmation code was not found in the database. Is the account already active?",
"ConfirmationTokenError": "An error occurred while confirming a new user account. If login is impossible and the error persists, contact the site's administrator for more information.",
"BackToHomePage": "Go back to home page",
"BackToLoginPage": "Go back to login page",
"UnconfirmedUser": "You user account has not been confirmed. You or an administrator should receive an email with a link to confirm your account. Check your emails or contact the site's administrator.",
"ResetTokenExpired": "The reset password token is expired. To reset your password, click on 'I forgot my password' again.",
"ResetTokenNotFound": "The reset password token was not found in the database.",
"ResetTokenError": "An error occurred while resetting the password. Please try again or contact your administrator if the situation is not solved.",
"PasswordChangedSuccessfully": "Your password was changed successfully!",
"Unauthorized": "You are not authorized to view this page",
"Maintenance": "Temporary maintenance, the server is offline. Please retry in a few minutes."
}
8 changes: 8 additions & 0 deletions locales/en/form.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"basicFields": "Basic fields",
"advancedFields": "Advanced fields",
"statistics": "Statistics",
"importExport": "Import / Export",
"Import": "Import",
"Export": "Export"
}
Loading

0 comments on commit 4c10ae5

Please sign in to comment.