Skip to content

Commit f871229

Browse files
committed
FIX error packages to build + add swc
1 parent fb31921 commit f871229

File tree

7 files changed

+533
-56
lines changed

7 files changed

+533
-56
lines changed

.swcrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"sourceMaps": true,
4+
"jsc": {
5+
"parser": {
6+
"syntax": "typescript",
7+
"decorators": true,
8+
"dynamicImport": true
9+
},
10+
"baseUrl": "./"
11+
},
12+
"minify": false
13+
}

nest-cli.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"exclude": "**/*.js"
1414
}
1515
],
16+
"builder": "swc",
17+
"typeCheck": true,
1618
"watchAssets": true
1719
}
1820
}

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
"@nestjs/cli": "^10.1.12",
7171
"@nestjs/schematics": "10.0.2",
7272
"@nestjs/swagger": "^7.1.8",
73+
"@swc/cli": "^0.1.62",
74+
"@swc/core": "^1.3.93",
7375
"@types/express": "^4.17.17",
7476
"@types/form-data": "^2.5.0",
7577
"@types/imapflow": "^1.0.13",
@@ -98,5 +100,9 @@
98100
},
99101
"peerDependencies": {
100102
"express": "^4"
103+
},
104+
"resolutions": {
105+
"wrap-ansi": "7.0.0",
106+
"string-width": "4.1.0"
101107
}
102108
}

src/accounts/accounts.setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { Logger } from '@nestjs/common'
22
import { instanceToInstance, plainToInstance, Type } from 'class-transformer'
33
import { IsBoolean, IsEnum, IsInt, IsObject, IsOptional, IsString, Max, Min, Validate, ValidateNested, validateOrReject } from 'class-validator'
4-
import { existsSync, readFileSync } from 'fs'
4+
import { existsSync, readFileSync } from 'node:fs'
55
import { readFile, writeFile } from 'fs/promises'
66
import { ImapFlowOptions } from 'imapflow'
77
import { LRUCache } from 'lru-cache'
8-
import { dirname, join } from 'path'
8+
import { resolve } from 'node:path'
99
import { parse, stringify } from 'yaml'
1010
import { UniqueFieldValidator } from '~/_common/validators/unique.field.validator'
1111
import { ApiProperty } from '@nestjs/swagger'
1212

13-
export const ACCOUNTS_FILE_PATH = join(dirname(dirname(dirname(__dirname))), '/config/accounts.yml') // TODO: change dirname
13+
export const ACCOUNTS_FILE_PATH = resolve('./config/accounts.yml')
1414

1515
export class AccountsFileV1 {
1616
@IsEnum(['1'])

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'multer'
1313

1414
declare const module: any
1515
;(async (): Promise<void> => {
16+
console.log('Starting mailrest...')
1617
const config = await configInstance()
1718
const app = await NestFactory.create<NestExpressApplication & INestApplication>(AppModule, {
1819
logger: config.application.logger,

src/tokens/tokens.setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { Logger } from '@nestjs/common'
22
import { instanceToInstance, plainToInstance, Type } from 'class-transformer'
33
import { IsArray, IsEnum, IsIP, IsNotEmpty, IsOptional, IsString, MinLength, Validate, ValidateNested, validateOrReject } from 'class-validator'
4-
import { existsSync, readFileSync } from 'fs'
4+
import { existsSync, readFileSync } from 'node:fs'
55
import { readFile, writeFile } from 'fs/promises'
66
import { LRUCache } from 'lru-cache'
7-
import { dirname, join } from 'path'
87
import { parse, stringify } from 'yaml'
98
import { UniqueFieldValidator } from '~/_common/validators/unique.field.validator'
109
import { IsType } from '~/_common/decorators/is-type.decorator'
1110
import { ApiProperty } from '@nestjs/swagger'
11+
import { resolve } from 'node:path'
1212

13-
export const TOKENS_FILE_PATH = join(dirname(dirname(dirname(__dirname))), '/config/tokens.yml') // TODO: change dirname
13+
export const TOKENS_FILE_PATH = resolve('./config/tokens.yml')
1414

1515
export class TokensFileV1 {
1616
@IsEnum(['1'])

0 commit comments

Comments
 (0)