Skip to content

Commit

Permalink
feat: Add tsup for build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
aXenDeveloper committed Jun 28, 2024
1 parent e0bbe32 commit ef64f85
Show file tree
Hide file tree
Showing 12 changed files with 566 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Build Scripts
run: pnpm build:scripts

- name: Build
run: pnpm build
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"tanstack",
"testid",
"tiptap",
"tsup",
"uagent",
"vitnode"
],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"packages/*"
],
"scripts": {
"build:scripts": "turbo build:scripts && pnpm i",
"build": "cross-env TURBO_TELEMETRY_DISABLED=1 turbo build",
"dev": "turbo dev",
"dev": "pnpm build:scripts && turbo dev",
"email:dev": "cd apps/backend && pnpm email:dev",
"lint": "turbo lint",
"lint:fix": "turbo lint:fix",
Expand Down
10 changes: 6 additions & 4 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
},
"scripts": {
"build": "tsc",
"build:scripts": "tsup",
"dev": "tsc -w",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"devDependencies": {
"@apollo/server": "^4.10.4",
"@nestjs/apollo": "^12.1.0",
Expand All @@ -36,7 +37,6 @@
"@types/object-path": "^0.11.4",
"@types/pg": "^8.11.6",
"@types/react": "^18.3.3",
"vitnode-shared": "workspace:*",
"busboy": "^1.6.0",
"class-transformer": "^0.5.1",
"dotenv": "^16.4.5",
Expand All @@ -45,7 +45,9 @@
"object-path": "^0.11.8",
"react-email": "^2.1.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.2"
"tsup": "^8.1.0",
"typescript": "^5.5.2",
"vitnode-shared": "workspace:*"
},
"dependencies": {
"@react-email/components": "^0.0.19",
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"experimentalDecorators": true,
"strictNullChecks": false,
"emitDecoratorMetadata": true,
"rootDir": "./src",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*", "scripts/**/*"]
"include": ["src/**/*"],
"exclude": ["scripts/**/*"]
}
8 changes: 8 additions & 0 deletions packages/backend/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['scripts/setup.ts'],
outDir: 'dist/scripts',
clean: false,
minify: true,
});
4 changes: 3 additions & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vitnode-frontend",
"version": "0.0.3",
"bin": {
"vitnode-frontend": "./scripts/generate-config-file.ts"
"vitnode-frontend": "./dist/scripts/setup.js"
},
"exports": {
"./navigation": {
Expand Down Expand Up @@ -52,6 +52,7 @@
},
"scripts": {
"build": "tsc",
"build:scripts": "tsup",
"dev": "tsc -w",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
Expand All @@ -73,6 +74,7 @@
"graphql-tag": "^2.12.6",
"tailwind-merge": "^2.3.0",
"ts-node": "^10.9.2",
"tsup": "^8.1.0",
"typescript": "^5.5.2"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env ts-node --project tsconfig.json
#!/usr/bin/env node
import * as fs from 'fs';
import { join } from 'path';

Expand Down
7 changes: 0 additions & 7 deletions packages/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
"rootDir": "./src",
"jsx": "preserve"
},
"ts-node": {
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
}
},
"include": ["next-env.d.ts", "src/**/*"],
"exclude": ["codegen.ts", "scripts/**/*"]
}
8 changes: 8 additions & 0 deletions packages/frontend/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['scripts/setup.ts'],
outDir: 'dist/scripts',
clean: false,
minify: true,
});
Loading

0 comments on commit ef64f85

Please sign in to comment.