Skip to content

Commit c58641a

Browse files
committed
chore: Fixed a lot of build related stuff and reintroduced swc
1 parent ea5dc08 commit c58641a

18 files changed

+766
-114
lines changed

.swcrc

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

apps/nest/nest-cli.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/nest-cli",
3+
"collection": "@nestjs/schematics",
4+
"sourceRoot": "src",
5+
"compilerOptions": {
6+
"builder": "swc",
7+
"deleteOutDir": true
8+
}
9+
}

apps/nest/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"build": "nest build",
7-
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
86
"dev": "nest start --watch",
97
"debug": "nest start --debug --watch",
8+
"build": "nest build",
109
"types": "tsc --noEmit"
1110
},
1211
"dependencies": {

apps/nest/src/app.controller.spec.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ import { AppController } from './app.controller';
33
import { AppService } from './app.service';
44

55
describe('AppController', () => {
6-
let appController: AppController;
6+
let controller: AppController;
77

88
beforeEach(async () => {
99
const app: TestingModule = await Test.createTestingModule({
1010
controllers: [AppController],
1111
providers: [AppService],
1212
}).compile();
1313

14-
appController = app.get<AppController>(AppController);
14+
controller = app.get<AppController>(AppController);
15+
const service = app.get<AppService>(AppService);
16+
console.log(service);
1517
});
1618

1719
describe('root', () => {
1820
it('should return "Hello World!"', () => {
19-
expect(appController.getHello()).toBe('Hello World!');
21+
expect(controller.getHello()).toBe('Hello World!');
2022
});
2123
});
2224
});

apps/nest/src/app.controller.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import { AppService } from './app.service';
33

44
@Controller()
55
export class AppController {
6-
constructor(private readonly appService: AppService) {}
6+
constructor(private readonly service: AppService) {}
77

88
@Get()
99
getHello(): string {
10-
return this.appService.getHello();
11-
// const foo: string = 1;
10+
return this.service.getHello();
1211
}
1312
}

apps/nest/src/main.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { Logger } from '@nestjs/common';
44

55
async function bootstrap() {
66
const app = await NestFactory.create(AppModule);
7-
Logger.log('yolo');
87
await app.listen(3000);
98
const url = await app.getUrl();
10-
Logger.log(`Application is running on: ${url}`);
9+
Logger.log(`Application is running on: ${url}`, 'Bootstrap');
1110
}
1211
bootstrap();

apps/nest/tsconfig.json

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.nest.json",
3+
"include": ["./src/**/*"],
34
"compilerOptions": {
4-
"module": "CommonJS",
5-
"declaration": true,
6-
"removeComments": true,
7-
"allowSyntheticDefaultImports": true,
8-
"target": "ES2021",
9-
"sourceMap": true,
10-
"outDir": "./dist",
11-
// "baseUrl": "./",
12-
"incremental": true,
13-
"strictNullChecks": false,
14-
"strictBindCallApply": false,
15-
"forceConsistentCasingInFileNames": false
16-
},
17-
"include": ["./src"]
5+
"outDir": "./dist"
6+
}
187
}

apps/nest/vite.config.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
/// <reference types="vitest" />
22
import baseConfig from '../../vite.config';
33
import { mergeConfig, defineConfig } from 'vite';
4-
import { VitePluginNode } from 'vite-plugin-node';
54

6-
export default mergeConfig(
7-
baseConfig,
8-
defineConfig({
9-
plugins: [
10-
...baseConfig.plugins!,
11-
VitePluginNode({
12-
adapter: 'nest',
13-
appPath: './src/main.ts',
14-
}),
15-
],
16-
}),
17-
);
5+
export default mergeConfig(baseConfig, defineConfig({}));

apps/react/tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.bundler.json",
3+
"include": ["./src"],
34
"compilerOptions": {
45
"jsx": "react-jsx"
5-
},
6-
"include": ["./src"]
6+
}
77
}

nest-cli.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@
44
"monorepo": true,
55
"sourceRoot": "apps/nest/src",
66
"compilerOptions": {
7+
"builder": "swc",
78
"typeCheck": true,
89
"deleteOutDir": true
910
},
1011
"projects": {
1112
"test-app": {
1213
"type": "application",
1314
"root": "apps/nest",
14-
"sourceRoot": "apps/nest/src"
15+
"sourceRoot": "apps/nest/src",
16+
"compilerOptions": {
17+
"tsConfigPath": "apps/nest/tsconfig.json"
18+
}
19+
},
20+
"nest-utils": {
21+
"type": "library",
22+
"root": "packages/nest-utils",
23+
"entryFile": "index",
24+
"sourceRoot": "packages/nest-utils/src",
25+
"compilerOptions": {
26+
"tsConfigPath": "packages/nest-utils/tsconfig.json"
27+
}
1528
}
1629
}
1730
}

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"scripts": {
2525
"dev": "concurrently \"cd apps/nest && pnpm dev\" \"cd apps/react && pnpm dev\"",
2626
"publish:test": "pnpm -r publish --dry-run --no-git-checks",
27-
"test": "pnpm run test:unit",
28-
"test:unit": "vitest run --coverage",
27+
"test": "pnpm test:vitest",
28+
"test:vitest": "vitest run --coverage",
2929
"check": "pnpm types && pnpm run lint && pnpm run prettier-check",
3030
"types": "pnpm -r types",
3131
"lint": "eslint . --ext ts,tsx",
@@ -36,22 +36,24 @@
3636
"@modyfi/vite-plugin-yaml": "1.1.0",
3737
"@nestjs/cli": "10.4.2",
3838
"@nestjs/testing": "10.3.10",
39+
"@swc/cli": "^0.4.0",
40+
"@swc/core": "^1.7.6",
3941
"@types/express": "^4.17.21",
40-
"concurrently": "^8.2.2",
4142
"@types/node": "22.1.0",
4243
"@typescript-eslint/eslint-plugin": "7.18.0",
4344
"@typescript-eslint/parser": "7.18.0",
4445
"@vitest/coverage-v8": "2.0.5",
46+
"concurrently": "^8.2.2",
4547
"eslint": "8.57.0",
4648
"eslint-config-prettier": "9.1.0",
4749
"eslint-plugin-prettier": "5.2.1",
4850
"prettier": "3.3.3",
4951
"release-please": "16.12.0",
5052
"typescript": "5.5.4",
53+
"unplugin-swc": "^1.5.1",
5154
"vite": "5.3.5",
5255
"vite-plugin-dts": "3.9.1",
5356
"vite-tsconfig-paths": "4.3.2",
5457
"vitest": "2.0.5"
55-
},
56-
"dependencies": {}
58+
}
5759
}

packages/browser-utils/tsconfig.json

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
{
2-
"extends": "../../tsconfig.json",
3-
"include": ["./src"],
4-
"compilerOptions": {
5-
/* Bundler mode */
6-
"moduleResolution": "bundler",
7-
"allowImportingTsExtensions": true,
8-
"resolveJsonModule": true,
9-
"isolatedModules": true,
10-
"noEmit": true
11-
}
2+
"extends": "../../tsconfig.bundler.json",
3+
"include": ["./src"]
124
}

packages/js-utils/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.bundler.json",
33
"include": ["./src"],
44
"compilerOptions": {
55
/* Bundler mode */

0 commit comments

Comments
 (0)