Version 9
Learn how to upgrade from v8 to v9.
pnpm i basehub@latest
v9 doesn’t introduce too many new features nor breaking changes, but it does fundamentally change how types are generated. Critically, the basehub
SDK can now work without a “generation step”, and the generation step now only augments the SDK with type information.
This seems subtle, but fixes many bugs related to basehub
not being able to resolve. For context, before v9, running basehub dev
or basehub build
was required for the runtime to get its graphql client. The generation step created the SDK, plus the types. Now, the client is “static” in the sense that’s ready to use once installed, and the generation step is just there for optional typesafety. Additionally, this typesafety works with TypeScript’s declaration merging, which means no more “Restart TS server” to make types work again.
New Features and Bug Fixes
basehub
now works without a “generation step”, albeit without types.Running
basehub dev
orbasehub build
is now not required by the runtime.
“Restart TS Server” in your IDE should be much less needed.
SDK Breaking Changes
The SDK now exposes an ESM-only bundle and uses
package.json
’s"exports"
field for subpath exports. As a result, yourtsconfig.json
must set"moduleResolution"
to"nodenext"
or"bundler"
undercompilerOptions
for TypeScript to resolve modules correctly.Deprecation of the
.basehub
directory. Now, the generation creates abasehub.d.ts
file and abasehub.config.ts
. Both files are optional (the runtime doesn’t depend on them at all).createClient
is no longer exported from”basehub”
. This function was an alias toimport { basehub } from 'basehub'
and we don’t see a point in having that, so we removed it.
API Breaking Changes
None
That should be all!