Skip to content

Commit 9979ebc

Browse files
committed
chore: move to tsdown
1 parent 1825b5d commit 9979ebc

File tree

390 files changed

+1880
-4209
lines changed

Some content is hidden

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

390 files changed

+1880
-4209
lines changed

.prettierrc.mjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
import { factory } from '@innei/prettier'
1+
import sortPlugin from '@ianvs/prettier-plugin-sort-imports'
2+
import jsonPlugin from 'prettier-package-json'
23

34
export default {
4-
...factory({
5-
tailwindcss: false,
6-
importSort: true,
7-
}),
5+
singleQuote: true,
6+
semi: false,
7+
trailingComma: 'all',
88
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
9+
tabWidth: 2,
10+
printWidth: 80,
11+
12+
arrowParens: 'always',
13+
endOfLine: 'lf',
14+
plugins: [jsonPlugin, sortPlugin],
915
}

apps/core/src/app.config.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import type { AxiosRequestConfig } from 'axios'
2-
31
import { argv } from '@mx-space/compiled'
2+
import type { AxiosRequestConfig } from 'axios'
43

54
export const PORT = process.env.PORT || 2333
65
export const API_VERSION = 2
76

8-
export const DEMO_MODE = false
9-
107
export const CROSS_DOMAIN = {
118
allowedOrigins: argv.allowed_origins
129
? argv.allowed_origins?.split?.(',')

apps/core/src/app.config.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import { readFileSync } from 'node:fs'
22
import path from 'node:path'
3+
import { seconds } from '@nestjs/throttler'
4+
import type { AxiosRequestConfig } from 'axios'
35
import { program } from 'commander'
46
import { load as yamlLoad } from 'js-yaml'
57
import { machineIdSync } from 'node-machine-id'
6-
import type { AxiosRequestConfig } from 'axios'
7-
8-
import { seconds } from '@nestjs/throttler'
9-
108
import { isDebugMode, isDev } from './global/env.global'
119
import { parseBooleanishValue } from './utils/tool.util'
1210

1311
const { PORT: ENV_PORT, ALLOWED_ORIGINS, MX_ENCRYPT_KEY } = process.env
1412

1513
const commander = program
1614
.option('-p, --port <number>', 'server port', ENV_PORT)
17-
.option('--demo', 'enable demo mode')
15+
1816
.option(
1917
'--allowed_origins <string>',
2018
'allowed origins, e.g. innei.ren,*.innei.ren',
@@ -126,7 +124,7 @@ export const CROSS_DOMAIN = {
126124
}
127125

128126
export const MONGO_DB = {
129-
dbName: argv.collection_name || (DEMO_MODE ? 'mx-space_demo' : 'mx-space'),
127+
dbName: argv.collection_name || 'mx-space',
130128
host: argv.db_host || '127.0.0.1',
131129
// host: argv.db_host || '10.0.0.33',
132130
port: argv.db_port || 27017,

apps/core/src/app.controller.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import dayjs from 'dayjs'
2-
31
import {
42
BadRequestException,
53
Get,
64
HttpCode,
75
Post,
86
UseInterceptors,
97
} from '@nestjs/common'
10-
118
import { ApiController } from '~/common/decorators/api-controller.decorator'
129
import { Auth } from '~/common/decorators/auth.decorator'
1310
import { InjectModel } from '~/transformers/model.transformer'
14-
11+
import dayjs from 'dayjs'
1512
import PKG from '../package.json'
1613
import { DEMO_MODE } from './app.config'
1714
import { HttpCache } from './common/decorators/cache.decorator'
@@ -48,7 +45,7 @@ export class AppController {
4845
return {
4946
name: PKG.name,
5047
author: PKG.author,
51-
version: isDev ? 'dev' : `${DEMO_MODE ? 'demo/' : ''}${PKG.version}`,
48+
version: isDev ? 'dev' : String(PKG.version),
5249
homepage: PKG.homepage,
5350
issues: PKG.issues,
5451
}

apps/core/src/app.module.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
import { LoggerModule } from '@innei/pretty-logger-nestjs'
12
import type {
23
DynamicModule,
34
MiddlewareConsumer,
45
NestModule,
56
Type,
67
} from '@nestjs/common'
7-
8-
import { LoggerModule } from '@innei/pretty-logger-nestjs'
98
import { Module } from '@nestjs/common'
109
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'
11-
12-
import { DEMO_MODE } from './app.config'
1310
import { AppController } from './app.controller'
1411
import { AllExceptionsFilter } from './common/filters/any-exception.filter'
1512
import { RolesGuard } from './common/guards/roles.guard'
@@ -33,7 +30,6 @@ import { CategoryModule } from './modules/category/category.module'
3330
import { CommentModule } from './modules/comment/comment.module'
3431
import { ConfigsModule } from './modules/configs/configs.module'
3532
import { DebugModule } from './modules/debug/debug.module'
36-
import { DemoModule } from './modules/demo/demo.module'
3733
import { DependencyModule } from './modules/dependency/dependency.module'
3834
import { FeedModule } from './modules/feed/feed.module'
3935
import { FileModule } from './modules/file/file.module'
@@ -88,7 +84,7 @@ import { RedisModule } from './processors/redis/redis.module'
8884
CategoryModule,
8985
CommentModule,
9086
ConfigsModule,
91-
DEMO_MODE && DemoModule,
87+
9288
DependencyModule,
9389
FeedModule,
9490
FileModule,

apps/core/src/bootstrap.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import cluster from 'node:cluster'
22
import { performance } from 'node:perf_hooks'
3-
import wcmatch from 'wildcard-match'
43
import type { FastifyCorsOptions } from '@fastify/cors'
5-
import type { LogLevel } from '@nestjs/common'
6-
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
7-
84
import { Logger } from '@innei/pretty-logger-nestjs'
95
import { chalk } from '@mx-space/compiled'
6+
import type { LogLevel } from '@nestjs/common'
107
import { NestFactory } from '@nestjs/core'
11-
8+
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
9+
import wcmatch from 'wildcard-match'
1210
import { CROSS_DOMAIN, DEBUG_MODE, PORT } from './app.config'
1311
import { AppModule } from './app.module'
1412
import { fastifyApp } from './common/adapters/fastify.adapter'

apps/core/src/cluster.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import cluster from 'node:cluster'
22
import os from 'node:os'
3-
43
import { logger } from './global/consola.global'
54

65
export const Cluster = {

apps/core/src/common/adapters/fastify.adapter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import type { FastifyRequest } from 'fastify'
2-
31
import fastifyCookie from '@fastify/cookie'
42
import FastifyMultipart from '@fastify/multipart'
53
import { Logger } from '@nestjs/common'
64
import { FastifyAdapter } from '@nestjs/platform-fastify'
7-
85
import { getIp } from '~/utils/ip.util'
6+
import type { FastifyRequest } from 'fastify'
97

108
const app: FastifyAdapter = new FastifyAdapter({
119
trustProxy: true,

apps/core/src/common/adapters/socket.adapter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import type { Server } from 'socket.io'
2-
31
import { IoAdapter } from '@nestjs/platform-socket.io'
42
import { createAdapter } from '@socket.io/redis-adapter'
5-
63
import { redisSubPub } from '~/utils/redis-subpub.util'
4+
import type { Server } from 'socket.io'
75

86
export const RedisIoAdapterKey = 'mx-core-socket'
97

apps/core/src/common/contexts/request.context.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/* eslint-disable dot-notation */
22
// @reference https://github.com/ever-co/ever-gauzy/blob/d36b4f40b1446f3c33d02e0ba00b53a83109d950/packages/core/src/core/context/request-context.ts
3-
import * as cls from 'cls-hooked'
4-
import type { UserModel } from '~/modules/user/user.model'
5-
import type { BizIncomingMessage } from '~/transformers/get-req.transformer'
63
import type { ServerResponse } from 'node:http'
7-
84
import { UnauthorizedException } from '@nestjs/common'
5+
import type { UserModel } from '~/modules/user/user.model'
6+
import type { BizIncomingMessage } from '~/transformers/get-req.transformer'
7+
import * as cls from 'cls-hooked'
98

109
type Nullable<T> = T | null
1110
export class RequestContext {

0 commit comments

Comments
 (0)