diff --git a/README.md b/README.md index b913bd4..5798b73 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file