Skip to content

Commit

Permalink
docs: Add local development instructions to README (#39)
Browse files Browse the repository at this point in the history
* docs: add local development instructions to readme

* fix readme

* add a link to the core sqlc development guide
  • Loading branch information
shinshin86 authored Nov 26, 2024
1 parent 54496e9 commit 395a0ba
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,61 @@ sql:
runtime: node
driver: better-sqlite3 # npm package name
```

## Development

If you want to build and test sqlc-gen-typescript locally, follow these steps:

1. Clone the repository and install dependencies:
```
git clone https://github.com/sqlc-dev/sqlc-gen-typescript.git
cd sqlc-gen-typescript
npm install
```

2. Make your desired changes to the codebase. The main source files are located in the `src` directory.

3. If you've made changes that require updating dependencies, run:
```
npm install
```

4. Build the WASM plugin:
Check the `Makefile` for details.
```
make out.js

# Ensure you have Javy installed and available in your PATH
make examples/plugin.wasm
```
5. To test your local build, create a test project with a `sqlc.yaml` file containing:
```yaml
version: '2'
plugins:
- name: ts
wasm:
url: file://{path_to_your_local_wasm_file}
sha256: {sha256_of_your_wasm_file}
sql:
- schema: "schema.sql"
queries: "query.sql"
engine: {your_database_engine}
codegen:
- out: db
plugin: ts
options:
runtime: node
driver: {your_database_driver}
```

Replace the placeholders with appropriate values for your setup.

6. Run sqlc in your test project to generate TypeScript code using your local plugin build:
```
sqlc generate
```

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.
https://docs.sqlc.dev/en/latest/guides/development.html

0 comments on commit 395a0ba

Please sign in to comment.