Skip to content

Commit

Permalink
feat-404: resolve PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Füting committed Dec 11, 2024
1 parent 9232b34 commit f01e275
Show file tree
Hide file tree
Showing 24 changed files with 138 additions and 312 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ Temporary Items
# LAPIS Access key
.env

web/.json-autotranslate-cache

# IDE files
*.iml
/.idea
1 change: 1 addition & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ dist/
/playwright/.cache/
.coverage
.playwright-report
.json-autotranslate-cache
2 changes: 1 addition & 1 deletion web/config/dotenv/index.js → web/config/dotenv/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'
import dotenv from 'dotenv'
import { findModuleRoot } from '../../lib/findModuleRoot.js'
import { findModuleRoot } from '../../lib/findModuleRoot'

const { moduleRoot } = findModuleRoot()

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions web/config/nodemon/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"config",
"next.config.ts",
"package.json",
"postcss.config.js",
"postcss.config.ts",
"tsconfig.json",
"webpack.config.js",
"yarn.lock"
],
"ext": "js,jsx,ts,tsx,json,flow,css,scss,sass,styl,html,ejs,d,txt,yml,sh",
"ignore": ["**/*.test.*s", "**/*.test.*sx", "**/__tests__", ".build", ".next", "node_modules", ".cache"],
"exec": "run-s -c dev:clean dev:start || cd ."
"exec": "run-s -c dev:start || cd ."
}
30 changes: 0 additions & 30 deletions web/config/nodemon/eslint.fix.json

This file was deleted.

30 changes: 0 additions & 30 deletions web/config/nodemon/eslint.json

This file was deleted.

30 changes: 0 additions & 30 deletions web/config/nodemon/lint.fix.json

This file was deleted.

30 changes: 0 additions & 30 deletions web/config/nodemon/lint.json

This file was deleted.

26 changes: 0 additions & 26 deletions web/config/nodemon/prod.json

This file was deleted.

26 changes: 0 additions & 26 deletions web/config/nodemon/profile.json

This file was deleted.

3 changes: 0 additions & 3 deletions web/lib/EnvVarError.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion web/lib/EnvVarError.js → web/lib/EnvVarError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class EnvVarError extends TypeError {
constructor(key, value) {
constructor(key: string, value: string | null | undefined) {
super(`
When reading an environement variable "${key}" (as \`process.env.${key}\`):
it was expected to find a valid string, but found \`${value}\`.
Expand Down
8 changes: 0 additions & 8 deletions web/lib/findModuleRoot.d.ts

This file was deleted.

8 changes: 7 additions & 1 deletion web/lib/findModuleRoot.js → web/lib/findModuleRoot.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import path from 'path'
import { fileURLToPath } from 'url'
import fs from 'fs-extra'
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package'

interface FindModuleRootResult {
moduleRoot: string
pkg: JSONSchemaForNPMPackageJsonFiles
}

/* eslint-disable no-loops/no-loops,no-param-reassign */
export function findModuleRoot(maxDepth = 10) {
export function findModuleRoot(maxDepth = 10): FindModuleRootResult {
let moduleRoot = fileURLToPath(new URL('.', import.meta.url))
while (--maxDepth) {
moduleRoot = path.resolve(moduleRoot, '..')
Expand Down
2 changes: 1 addition & 1 deletion web/lib/getDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getDomain() {
DOMAIN = detectedDomain
}

if (!DOMAIN.startsWith('http')) {
if (!DOMAIN?.startsWith('http')) {
DOMAIN = `https://${DOMAIN}`
}

Expand Down
3 changes: 0 additions & 3 deletions web/lib/getenv.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions web/lib/getenv.js → web/lib/getenv.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import EnvVarError from './EnvVarError'

function getenv(key, defaultValue) {
function getenv(key: string, defaultValue?: string | null) {
const value = process.env[key]
if (!value) {
if (defaultValue !== undefined) {
Expand All @@ -12,7 +12,7 @@ function getenv(key, defaultValue) {
return value
}

function getbool(key, defaultValue) {
function getbool(key: string, defaultValue?: string) {
const value = process.env[key]
if (!value) {
if (defaultValue !== undefined) {
Expand Down
24 changes: 7 additions & 17 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,31 @@
"scripts": {
"data": "cd .. && python3 scripts/convert_to_web_app_json.py",
"dev": "nodemon --config config/nodemon/dev.json",
"dev:start": "yarn install && yarn dev:nowatch || cd .",
"dev:nowatch": "cross-env NODE_ENV=development BABEL_ENV=development next dev --port 3000",
"dev:clean": "rimraf '.build/development/**/*' 'node_modules/.cache'",
"dev:start": "yarn install && yarn cross-env NODE_ENV=development BABEL_ENV=development next dev --port 3000 || cd .",
"prod:build": "yarn next:build && yarn next:export",
"prod:build:vercel": "cp .env.vercel .env && yarn install && yarn prod:build && cp .next/routes-manifest.json .build/production/web/",
"prod:build:profile": "yarn next:build:profile && yarn next:export",
"prod:build:profile": "PROFILE=1 yarn next:build --profile && yarn next:export",
"next:build": "cross-env NODE_ENV=production BABEL_ENV=production next build",
"next:export": "cp .next/robots.txt .build/production/web/robots.txt",
"next:build:profile": "PROFILE=1 yarn next:build --profile",
"prod:start": "yarn prod:build && yarn prod:serve || cd .",
"prod:start:watch": "nodemon --config config/nodemon/prod.json",
"prod:serve": "tsx ./tools/server/server.ts",
"prod:serve": "yarn serve .build/production/web --listen 8080",
"prod:start:profile": "yarn prod:build:profile && yarn prod:serve || cd .",
"prod:start:profile:watch": "nodemon --config config/nodemon/profile.json",
"prod:clean": "rimraf '.build/production/**/*' 'node_modules/.cache' '.next'",
"lint": "run-s -c eslint tsc:project",
"lint:fix": "run-s -c eslint:fix tsc:project",
"lint:watch": "nodemon --config config/nodemon/lint.json",
"lint:fix:watch": "nodemon --config config/nodemon/lint.fix.json",
"lint:ci": "run-s -c eslint --max-warnings=0 tsc:project",
"eslint": "eslint --format codeframe \"**/*.{js,jsx,ts,tsx}\"",
"eslint:fix": "yarn eslint --fix",
"eslint:watch": "nodemon --config config/nodemon/eslint.json",
"eslint:fix:watch": "nodemon --config config/nodemon/eslint.fix.json",
"tsc:project": "tsc --project tsconfig.json --noEmit",
"tsc:project:watch": "yarn tsc:project --watch",
"stylelint": "stylelint \"**/*.*(css|scss)\"",
"stylelint:fix": "yarn stylelint --fix",
"format": "prettier --check \"**/*.{js,jsx,ts,tsx,json,html,css,less,scss,yml,yaml}\"",
"format:fix": "yarn format --write",
"test:unit": "vitest src",
"test:unit:nowatch": "vitest run src",
"test:unit:ci": "vitest run src",
"test:unit:coverage": "vitest src --coverage",
"test:e2e": "playwright test",
"stills": "tsx tools/generateStillImages.ts",
"i18n:extract": "i18next -c config/i18next/i18next.config.js",
"i18n:extract": "i18next -c config/i18next/i18next.config.ts",
"i18n:addkeys": "tsx tools/addLocaleKeys.ts",
"i18n:fix": "tsx tools/fixLocales.ts",
"i18n:translate": "json-autotranslate --config=json-autotranslate.json --input=src/i18n/resources --service=amazon-translate --matcher=i18next --fix-inconsistencies --delete-unused-strings"
Expand Down Expand Up @@ -231,7 +220,7 @@
"npm-run-all": "^4.1.5",
"postcss": "^8.4",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^8.1.1",
"postcss-load-config": "^6.0.1",
"postcss-preset-env": "^10.1.1",
"prettier": "^3.3.3",
"raw-loader": "^4.0.2",
Expand All @@ -252,6 +241,7 @@
"stylelint-config-standard": "^36.0.1",
"svgo": "^3.3.2",
"ts-essentials": "^10.0.3",
"ts-node": "^10.9.2",
"ts-toolbelt": "^9.6.0",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
Expand Down
5 changes: 3 additions & 2 deletions web/postcss.config.js → web/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import loadEnvVars from './config/dotenv/index.js'
import type { Config } from 'postcss-load-config'
import loadEnvVars from './config/dotenv/index'
loadEnvVars()

export default {
Expand All @@ -16,4 +17,4 @@ export default {
},
},
},
}
} satisfies Config
5 changes: 3 additions & 2 deletions web/stylelint.config.js → web/stylelint.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @type {import('stylelint').Config} */
import type { Config } from 'stylelint'

export default {
extends: ['stylelint-config-standard', 'stylelint-config-sass-guidelines'],
rules: {
Expand All @@ -12,4 +13,4 @@ export default {
'selector-max-compound-selectors': 4,
'max-nesting-depth': 3,
},
}
} satisfies Config
Loading

0 comments on commit f01e275

Please sign in to comment.