Skip to content

Commit 395a0ba

Browse files
authored
docs: Add local development instructions to README (#39)
* docs: add local development instructions to readme * fix readme * add a link to the core sqlc development guide
1 parent 54496e9 commit 395a0ba

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Diff for: README.md

+58
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,61 @@ sql:
333333
runtime: node
334334
driver: better-sqlite3 # npm package name
335335
```
336+
337+
## Development
338+
339+
If you want to build and test sqlc-gen-typescript locally, follow these steps:
340+
341+
1. Clone the repository and install dependencies:
342+
```
343+
git clone https://github.com/sqlc-dev/sqlc-gen-typescript.git
344+
cd sqlc-gen-typescript
345+
npm install
346+
```
347+
348+
2. Make your desired changes to the codebase. The main source files are located in the `src` directory.
349+
350+
3. If you've made changes that require updating dependencies, run:
351+
```
352+
npm install
353+
```
354+
355+
4. Build the WASM plugin:
356+
Check the `Makefile` for details.
357+
```
358+
make out.js
359+
360+
# Ensure you have Javy installed and available in your PATH
361+
make examples/plugin.wasm
362+
```
363+
364+
5. To test your local build, create a test project with a `sqlc.yaml` file containing:
365+
366+
```yaml
367+
version: '2'
368+
plugins:
369+
- name: ts
370+
wasm:
371+
url: file://{path_to_your_local_wasm_file}
372+
sha256: {sha256_of_your_wasm_file}
373+
sql:
374+
- schema: "schema.sql"
375+
queries: "query.sql"
376+
engine: {your_database_engine}
377+
codegen:
378+
- out: db
379+
plugin: ts
380+
options:
381+
runtime: node
382+
driver: {your_database_driver}
383+
```
384+
385+
Replace the placeholders with appropriate values for your setup.
386+
387+
6. Run sqlc in your test project to generate TypeScript code using your local plugin build:
388+
```
389+
sqlc generate
390+
```
391+
392+
For more details on sqlc development, refer to the sqlc core development guide. This guide provides additional information on setting up and working with sqlc in general, which may be useful for contributors to this project.
393+
https://docs.sqlc.dev/en/latest/guides/development.html

0 commit comments

Comments
 (0)