Skip to content

Commit

Permalink
chore: configure tsup for building and watching typescript files (#83)
Browse files Browse the repository at this point in the history
This pull request includes several changes to the build and watch
scripts, as well as the addition of a new configuration file for `tsup`.
The most important changes are summarized below:

Build and watch script updates:

*
[`package.json`](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L37-R40):
Updated the `build` script to use `tsup` instead of `tsc -b src`.
*
[`package.json`](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L37-R40):
Updated the `watch` and `watch:start` scripts to use `tsup --watch`
instead of `tsc -b src -w` and `tsc-watch -b src`.

Dependency updates:

*
[`package.json`](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L115-R115):
Replaced the `tsc-watch` dependency with `tsup`.

New configuration file:

*
[`tsup.config.ts`](diffhunk://#diff-8fed899bdbc24789a7bb4973574e624ed6207c6ce572338bc3c3e117672b2a20R1-R17):
Added a new configuration file for `tsup` with various settings
including entry points, format, and target.
  • Loading branch information
RedStar071 authored Jan 9, 2025
2 parents 8025d19 + 2f46948 commit 9bc8407
Show file tree
Hide file tree
Showing 4 changed files with 809 additions and 11 deletions.
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
"#root/*": "./dist/*.js"
},
"scripts": {
"build": "tsc -b src",
"dev": "yarn build && yarn start",
"watch": "tsc -b src -w",
"watch:start": "tsc-watch -b src --onSuccess \"yarn start\"",
"build": "tsup",
"dev": "npm-run-all build start",
"watch": "tsup --watch",
"watch:start": "tsup --watch --onSuccess \"yarn start\"",
"prisma:generate": "yarn prisma generate",
"clean": "node scripts/build/clean.mjs",
"start": "node --enable-source-maps dist/index.js",
Expand Down Expand Up @@ -86,6 +86,7 @@
"discord-api-types": "0.37.98",
"discord.js": "~14.17.3",
"he": "^1.2.0",
"tsup": "^8.3.5",
"zlib-sync": "^0.1.9"
},
"devDependencies": {
Expand All @@ -109,6 +110,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"lint-staged": "^15.3.0",
"npm-run-all2": "^7.0.2",
"prettier": "^3.4.2",
"prisma": "^6.2.1",
"prisma-json-types-generator": "^3.2.2",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"allowJs": true,
"checkJs": true
},
"include": ["src", "tests", "scripts", "ormconfig.js", "vitest.config.ts"]
"include": ["src", "tests", "scripts", "ormconfig.js", "vitest.config.ts", "tsup.config.ts"]
}
17 changes: 17 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from 'tsup';

export default defineConfig({
clean: true,
bundle: false,
dts: false,
entry: ['src/**/*.ts', '!src/**/*.d.ts'],
format: 'esm',
minify: false,
tsconfig: 'src/tsconfig.json',
target: 'es2024',
splitting: false,
skipNodeModulesBundle: true,
sourcemap: true,
shims: false,
keepNames: true
});
Loading

0 comments on commit 9bc8407

Please sign in to comment.