Skip to content

API Reference / @gtkx/codegen / resolveStore

Function: resolveStore() ​

resolveStore(projectRoot): ResolvedStore

Defined in: packages/codegen/src/store/resolve-store.ts:264

Resolves generated GI and JSX store options from a project's installed dependencies. Pass the result to runCodegen alongside libraries and girPath, omitting jsx when null.

Parameters ​

projectRoot ​

string

Directory containing the project's package.json.

Returns ​

ResolvedStore

Store locations and versions, with jsx set to null when React is absent.

Remarks ​

Both stores share one node_modules directory selected from the project's ancestor chain: the one the installed renderer and runtime are installed in, which for pnpm's isolated layout is the workspace root holding .pnpm, not the directory their links sit in. Hoisted or workspace installs can therefore give several projects one shared store, generated with the union of their libraries. The store links the packages its bindings import to the copies the project resolves. Store versions follow @gtkx/runtime and @gtkx/react, so upgrades invalidate generated output. Explicit gi or jsx options override this selection.

Throws ​

If runtime cannot be resolved, a binding consumer is installed above the selected store and cannot import it, or another project sharing the store resolves a different copy of a package the bindings import.