Skip to content
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

build: use tsup and do not bundle dependencies #660

Merged
merged 28 commits into from
Apr 24, 2023
Merged

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented Apr 21, 2023

  • we are currently bundling dependencies (except for peerDependencies), which leads to various issues in the CLI, and makes the life of consumers harder (since, unlike dependencies, peerDependencies have to be installed manually)
  • this PR changes the general approach to
    • avoid using peerDependencies unless actually necessary
    • avoid bundling dependencies into the libraries, since dependencies are automatically installed by consumer's package managers
  • this PR also switches to tsup (from vite), since tsup is 1. faster and 2. the more natural choice for libraries (vite is more focussed on end-user apps/websites and needs more configuration than tsup if the goal is to bundle a library)

@vercel
Copy link

vercel bot commented Apr 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mud ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 24, 2023 5:29pm

dk1a
dk1a previously approved these changes Apr 21, 2023
Copy link
Member

@dk1a dk1a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsup looks much more convenient for our use-case. The config is simplified, no plugins and noExternal hacks

Comment on lines 43 to 45
"ds-test": "https://github.com/dapphub/ds-test.git#c9ce3f25bde29fc5eb9901842bf02850dfd2d084",
"ethers": "^5.7.2",
"forge-std": "https://github.com/foundry-rs/forge-std.git#b4f121555729b3afb3c5ffccb62ff4b6e2818fd3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ds-test and forge can be devDeps as they're just for tests? (console is also imported in normal files, but that's just for debugging and should be eventually removed)

Comment on lines 43 to 45
"ds-test": "https://github.com/dapphub/ds-test.git#c9ce3f25bde29fc5eb9901842bf02850dfd2d084",
"ethers": "^5.7.2",
"forge-std": "https://github.com/foundry-rs/forge-std.git#b4f121555729b3afb3c5ffccb62ff4b6e2818fd3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same here with devDeps)

roninjin10
roninjin10 previously approved these changes Apr 22, 2023
},
plugins: [peerDepsExternal()] as any,
});
export default defineConfig({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just remove this file vitest doesn't need a config

Copy link
Member

@holic holic Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we even using vitest here? I see the dev dep but I don't see it being used

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in a276ffd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it's unused. Vitest was only for config, which is now in its own package

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
Copy link
Member

@holic holic Apr 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not blocking but I would prefer to not use whole-file disables

we should either 1) decide to disable this globally or 2) ignore individual lines/usages

(I tend to go with the latter)

entry: ["src/index.ts", "src/mud.ts", "src/mud2.ts"],
target: "esnext",
format: ["esm"],
dts: false,
Copy link
Member

@holic holic Apr 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is dts not needed when doing tsup in this way? or is it because cli doesn't have anything to export aside from bins?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from @dk1a

I don't think we do, since package.json now has "types": "src/index.ts", so the sources themselves replaces dts

holic
holic previously approved these changes Apr 23, 2023
Copy link
Member

@holic holic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for tackling this!

@holic holic merged commit 9fca0c9 into main Apr 24, 2023
@holic holic deleted the alvrs/refactorbuild branch April 24, 2023 17:47
@holic holic mentioned this pull request Apr 24, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants