Skip to content

Commit 7e9590d

Browse files
committed
chore(website): add translations (chinese, korean, japanese, german)
1 parent b5afab9 commit 7e9590d

File tree

505 files changed

+44292
-259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

505 files changed

+44292
-259
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
}
4242
]
4343
},
44-
"moduleNameMapper": {
44+
"moduleNameMapper ": {
4545
"(.+)\\.js": "$1"
4646
},
4747
"testMatch": [

packages/core/src/compiler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import { indent } from './indent.js';
1313
import { hasProperty } from './core.js';
1414

15-
declare var process: any;
15+
declare var process: {
16+
env: Record<string, string>;
17+
} | undefined;
1618

1719
const indentCode = ('undefined' !== typeof process && process.env?.DEBUG || '').includes('deepkit');
1820

packages/core/src/core.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ export function getInheritanceChain(classType: ClassType): ClassType[] {
464464
}
465465

466466
declare var v8debug: any;
467+
declare var process: {
468+
execArgv: string[];
469+
platform: string;
470+
} | undefined;
467471

468472
export function inDebugMode() {
469473
return typeof v8debug === 'object' ||
@@ -497,7 +501,7 @@ export function getCurrentFileName(offset: number = 0): string {
497501
if (path.indexOf('file') >= 0) {
498502
path = new URL(path).pathname;
499503
}
500-
if (path[0] === '/' && process.platform === 'win32') {
504+
if (path[0] === '/' && 'undefined' !== typeof process && process.platform === 'win32') {
501505
path = path.slice(1);
502506
}
503507
return path;

packages/core/tsconfig.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
"es2020",
2020
"es2022.error"
2121
],
22-
"types": [
23-
"dot-prop",
24-
"node"
25-
],
2622
"skipLibCheck": true
2723
},
2824
"reflection": true,
@@ -38,4 +34,4 @@
3834
"path": "../bench/tsconfig.json"
3935
}
4036
]
41-
}
37+
}

packages/http/src/router.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,7 @@
88
* You should have received a copy of the MIT License along with this program.
99
*/
1010
import { ClassType, CompilerContext, getClassName, isArray, isClass, urlJoin } from '@deepkit/core';
11-
import {
12-
entity,
13-
ReflectionClass,
14-
ReflectionFunction,
15-
ReflectionKind,
16-
ReflectionParameter,
17-
SerializationOptions,
18-
serializer,
19-
Serializer,
20-
Type,
21-
ValidationError,
22-
} from '@deepkit/type';
11+
import { entity, ReflectionClass, ReflectionFunction, ReflectionKind, ReflectionParameter, SerializationOptions, serializer, Serializer, Type, ValidationError } from '@deepkit/type';
2312
import { getActions, HttpAction, httpClass, HttpController, HttpDecorator } from './decorator.js';
2413
import { HttpRequest, HttpRequestPositionedParameters, HttpRequestQuery, HttpRequestResolvedParameters } from './model.js';
2514
import { InjectorContext, InjectorModule } from '@deepkit/injector';
@@ -30,7 +19,7 @@ import { HttpMiddlewareConfig, HttpMiddlewareFn } from './middleware.js';
3019

3120
//@ts-ignore
3221
import qs from 'qs';
33-
import { HtmlResponse, JSONResponse, Response } from './http.js';
22+
import { HtmlResponse, JSONResponse, Redirect, Response } from './http.js';
3423
import { getRequestParserCodeForParameters, ParameterForRequestParser, parseRoutePathToRegex } from './request-parser.js';
3524
import { HttpConfig } from './module.config.js';
3625

@@ -352,7 +341,7 @@ export interface HttpRouterFunctionOptions {
352341
function convertOptions(methods: string[], pathOrOptions: string | HttpRouterFunctionOptions, defaultOptions: Partial<HttpRouterFunctionOptions>): HttpRouterFunctionOptions {
353342
const options = 'string' === typeof pathOrOptions ? { path: pathOrOptions } : pathOrOptions;
354343
if (options.methods) return options;
355-
return { ...options, methods };
344+
return { ...defaultOptions, ...options, methods };
356345
}
357346

358347
/**
@@ -444,6 +433,13 @@ export abstract class HttpRouterRegistryFunctionRegistrar {
444433
this.register(convertOptions(['HEAD'], pathOrOptions, this.defaultOptions), callback);
445434
}
446435

436+
public redirectCallback(pathOrOptions: string | HttpRouterFunctionOptions, callback: (request: HttpRequest) => string, redirectCode: number = 302) {
437+
const options = convertOptions(['GET'], pathOrOptions, this.defaultOptions);
438+
this.register(options, (request: HttpRequest) => {
439+
return Redirect.toUrl(callback(request), redirectCode);
440+
});
441+
}
442+
447443
private register(options: HttpRouterFunctionOptions, callback: (...args: any[]) => any, module?: InjectorModule<any>) {
448444
const fn = ReflectionFunction.from(callback);
449445

@@ -536,7 +532,7 @@ export class HttpRouterRegistry extends HttpRouterRegistryFunctionRegistrar {
536532
type: 'controller',
537533
controller,
538534
module,
539-
methodName: action.methodName
535+
methodName: action.methodName,
540536
};
541537
const routeConfig = createRouteConfigFromHttpAction(routeAction, action, module, controllerData);
542538

@@ -578,7 +574,7 @@ export class HttpRouter {
578574
controllers: (ClassType | { module: InjectorModule<any>, controller: ClassType })[],
579575
middlewareRegistry: MiddlewareRegistry = new MiddlewareRegistry(),
580576
module: InjectorModule<any> = new InjectorModule(),
581-
config: HttpConfig = new HttpConfig()
577+
config: HttpConfig = new HttpConfig(),
582578
): HttpRouter {
583579
return new this(new HttpControllers(controllers.map(v => {
584580
return isClass(v) ? { controller: v, module } : v;
@@ -636,7 +632,7 @@ export class HttpRouter {
636632
resolverForToken: routeConfig.resolverForToken,
637633
resolverForParameterName: routeConfig.resolverForParameterName,
638634
pathParameterNames: parsedRoute.pathParameterNames,
639-
routeConfig
635+
routeConfig,
640636
});
641637

642638
let methodCheck = '';

packages/type/src/reflection/processor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ export class Processor {
688688
case ReflectionOp.parameter: {
689689
const ref = this.eatParameter() as number;
690690
const t: Type = { kind: ReflectionKind.parameter, parent: undefined as any, name: program.stack[ref] as string, type: this.pop() as Type };
691-
t.type.parent = t;
691+
if (t.type) t.type.parent = t;
692692
this.pushType(t);
693693
break;
694694
}

sync-tsconfig-deps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ for (const name of packages) {
4545
}
4646

4747
function filter(name) {
48-
return !['api-console-gui', 'framework-debug-gui', 'orm-browser-gui'].includes(name);
48+
return !['api-console-gui', 'framework-debug-gui', 'orm-browser-gui', 'desktop-ui'].includes(name);
4949
}
5050

5151
for (const [name, config] of Object.entries(packageConfigs)) {

tsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
{
3838
"path": "./packages/create-app/tsconfig.json"
3939
},
40-
{
41-
"path": "./packages/desktop-ui/tsconfig.json"
42-
},
4340
{
4441
"path": "./packages/devtool/tsconfig.json"
4542
},
@@ -161,4 +158,4 @@
161158
"path": "./packages/workflow/tsconfig.json"
162159
}
163160
]
164-
}
161+
}

website/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ cd website/
1919
docker build -t website2 -f Dockerfile ../
2020
docker run --rm -p 8080:8080 -e app_databaseHost=host.docker.internal website2
2121
```
22+
23+
24+
## Translate
25+
26+
```sh
27+
export APP_OPENAI_API_KEY=your_openai_api_key
28+
npm run translate de
29+
```

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"build": "npm run api-docs && BUILD=angular NODE_OPTIONS=--preserve-symlinks ng build --configuration production",
1111
"test": "jest"
1212
},
13+
"type": "commonjs",
1314
"private": true,
1415
"devDependencies": {
1516
"@angular-devkit/build-angular": "^20.0.3",

0 commit comments

Comments
 (0)