-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(build)!: use tsup #54
Conversation
This looks super cool, I'll make sure to give tsup a proper read through and test this out before merging, but awesome work!
This is actually pretty important since the commands won't update and you can't try the bot otherwise (if the commands are being developed). How do you think we should solve this? 🤔 Hot reloading seems awesome, I just wish there was a way we could have the best of both worlds. I guess one very hacky thing I have in mind is to read what the current commands are and store that in a json file, then every hot reload it will read that object and see if anything needs to be changed, and if so deploy the new changes to the development guild. |
Keeping track of command data is super annoying, so I forwent hot reloading commands since it could lead to API absue (think- you change a typo on a command then started to work on logic for that command). We'd have to do something like sapphire/framework does and auto register based on what API responds. That's doable but requires custom code, not something I wish to do. |
alright technically I can copy/paste their code but would mean that we'd have 2 licensed since they use MIT |
I don't think that matters @c43721 From MIT:
As long as we keep the copyright & permission notice in the file, we are allowed to sublicense the code. |
shows how much I know about licenses |
this now registers commands on startup, but does not hot reload. There's a |
never make me merge changes again... |
package.json
Outdated
"deploy": "npm run undeploy && node ./scripts/deploy-commands.js --global" | ||
"build": "tsup", | ||
"start": "npm run build && node --enable-source-maps .", | ||
"dev": "npm run deploy:dev && tsup --watch --onSuccess \"node --enable-source-maps .", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string isn't terminated, resulting in the below error when executing npm run dev
.
> discord-needle@1.0.0 dev
> npm run deploy:dev && tsup --watch --onSuccess "node --enable-source-maps .
sh: 1: Syntax error: Unterminated quoted string
"dev": "npm run deploy:dev && tsup --watch --onSuccess \"node --enable-source-maps .", | |
"dev": "npm run deploy:dev && tsup --watch --onSuccess \"node --enable-source-maps .\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
oops 😄 I can fix the conflicts and review this week hopefully, I was unsure about the status of this PR which is why I haven't touched it |
Good for a review now, FYI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that config.json
is being built as config.js
, which causes imports to fail.
it should work :/ I didn't test this so I'll take another look eventually |
@MarcusOtter Has merge conflicts :( |
|
I did this already with #100 |
tsconfig cannot have baseUrl for this to work |
@c43721 Your fork's branch needs to be updated in order to fix command deploys. |
…into feat/use-esbuild
@@ -16,7 +16,7 @@ | |||
// ________________________________________________________________________________________________ | |||
|
|||
import { SlashCommandBuilder } from "@discordjs/builders"; | |||
import { ChannelType } from "discord-api-types"; | |||
import { ChannelType } from "discord-api-types/v9"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should be done everywhere else we import discord-api-types
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should. I would like to do this in a follow up though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done in #94.
I'm not sure what the state of this is, should we turn it into a draft for now? Does it need my review? Last thing I heard was something about fixing imports, otherwise builds break, does that still apply? |
Something something JSON.. I'll close since this is so far behind and I'll re-open/ |
Fixes #50
Build goes from 2 seconds to 20ms. Also cleans
dist
each time you run build.Breaking changes:
uses esbuild to build instead of tsc
dev command no longer registers commands. It will auto-recompile + restart the bot if changes are made.