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

Modernize #52

Merged
merged 25 commits into from
Aug 21, 2024
Merged

Modernize #52

merged 25 commits into from
Aug 21, 2024

Conversation

PuruVJ
Copy link
Collaborator

@PuruVJ PuruVJ commented Jul 16, 2024

Changes

  • pnpm workspaces: All different playgrounds, quickstarts are now symlinked properly to the SDK on first pnpm install
  • SDK's code moved to packages/sdk
  • SDK is now zero-dependency when shipped. Means we build our dependencies into one index.js file, and ship it to user. Which means we control the entire code, and the user won't end up with a different patch of brotli, or buffer than ours which could cause issues. Also means the user's own download size is now severely reduced, no need to download all the deps and their README's licenses, package.json and a lot of unnecessary stuff.
  • Builds now happen with tsup. All the code is bundled up into one index.js file that is shipped, gone are the days of us shipping our entire filesystem structure with 2 pairs of files(.js + d.ts). tsup also generates a single d.ts file containing all the typings. UPDATE: We do conditional builds now, separate for browser. See modernize: Conditional browser build #79
  • ⚠️ Node 18+ only
  • ⚠️ ESM-only
  • ⚠️ Potentially breaking websockets in NodeJS. We're switching from isomorphic-ws to undici, which is the internal implementation of native NodeJS Websockets. This is to make our library work the same everywhere, whether it is browsers, Node, Bun, Deno, Cloudflare workers or any other environment that could potentially be a usable runtime.
  • Only one optional dependency: undici, which is for NodeJS 18(and 20, altho that might change) is required, and I'll add that in a separate documentation PR.
  • Using https://github.com/changesets/changesets for updating. Due to Prevenance(more on that in the next point), we won't be able to publish the SDK ourselves, meaning no one developer will have the right to publish to npm, it'll error. Rather we will go through the flow of Changesets, which require using pnpm run changeset command to add a Changelog-message for the PR, and then merging the PR will open a new PR "Version packages", by Changeset Bot. Only on approving and merging that PR will it publish to NPM
  • Provenance has been enabled. It allows Github and NPM to sign the authenticity of the specific release(Check modernize: Changesets;provenance #72). This is visible publically on the NPM page, and tools like Snyk and all become whistleblowers if this contract is breached. NPM also will warn if a future version doesn't have provenance. This means only the Changesets flow can publish a new version, no person may do so.
  • pkg.pr.new: Every PR and commit will be continuously released for usage on pkg.pr.new, hence we can provide a URL to any user to install in case of an urgent bug-fix before that PR makes it to npm
  • Bundle size reduction: 21.5%, from 93.3KB to 73.3KB (min+br)

PRs

PuruVJ and others added 8 commits July 16, 2024 16:02
* Push

* Push

* Run prettier

* Prettier stuff
* Push

* jest
* Monorepo

* Readme

* Move tsconfig

* Fix test
* Quickstart

* test app too

* Run pnpm

* Remove eslint files

* Format
@PuruVJ PuruVJ marked this pull request as draft July 16, 2024 18:12
PuruVJ and others added 7 commits August 7, 2024 15:23
* Push

* Undo min change
* Use undici, remove other unneeded dependencies

* pnpm install

* Bundle everything

* Move everything to devDependency

* headers object

* Bump version to 0.11.0

* Push

* Hmm not working still

* Add undici to peerDependencies

* Measure size

* Push

* Fix formatting

* Working on node!!

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
Co-authored-by: Zeke Foppa <[email protected]>
* Add pkg.pr.new

* Fix directory
Copy link

changeset-bot bot commented Aug 14, 2024

⚠️ No Changeset found

Latest commit: 325d3c8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

pkg-pr-new bot commented Aug 14, 2024

commit: 325d3c8

yarn add https://pkg.pr.new/@clockworklabs/spacetimedb-sdk@52

Open in Stackblitz

* Push

* Push

* pnpm install

* Any update
@PuruVJ PuruVJ marked this pull request as ready for review August 14, 2024 16:15
@PuruVJ PuruVJ requested review from gefjon and drogus August 14, 2024 16:16
@PuruVJ PuruVJ requested a review from cloutiertyler August 14, 2024 17:13
@PuruVJ PuruVJ marked this pull request as draft August 19, 2024 08:48
@PuruVJ
Copy link
Collaborator Author

PuruVJ commented Aug 19, 2024

Converting to draft as #80 needs to be done in this

@PuruVJ PuruVJ marked this pull request as ready for review August 19, 2024 15:49
Copy link
Collaborator

@drogus drogus left a comment

Choose a reason for hiding this comment

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

Great work!

@PuruVJ PuruVJ merged commit 87ab7c2 into main Aug 21, 2024
6 checks passed
@PuruVJ PuruVJ deleted the modernize-nexus branch August 21, 2024 08:49
@PuruVJ PuruVJ mentioned this pull request Aug 21, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants