diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..afb435e
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1 @@
+* @HarperFast/developers
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..b4cce99
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,55 @@
+name: Release
+
+on:
+ merge_group:
+ branches:
+ - main
+ push:
+ branches:
+ - main
+ workflow_dispatch:
+
+# Needed for semantic-release to create GitHub releases and publish to npm via OIDC
+permissions:
+ contents: write
+ issues: write
+ pull-requests: write
+ id-token: write
+
+concurrency:
+ group: Release
+ cancel-in-progress: false
+
+jobs:
+ release:
+ name: Release
+ environment: Release
+ # Ensure releases run only when code reaches main via GitHub Merge Queue, or when manually dispatched
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 0
+ - name: Setup Node.js
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+ registry-url: 'https://registry.npmjs.org'
+ - name: Install dependencies
+ run: npm ci
+ - name: Check lint
+ run: npm run lint:check
+ - name: Check format
+ run: npm run format:check
+ - name: Run unit tests
+ run: npm test
+ - name: Semantic Release
+ if: ${{ github.event_name == 'push' }}
+ uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ NPM_CONFIG_PROVENANCE: true
+ - name: Publish to NPM
+ run: npm publish --provenance
diff --git a/.github/workflows/verify-commits.yaml b/.github/workflows/verify-commits.yaml
new file mode 100644
index 0000000..6fe17db
--- /dev/null
+++ b/.github/workflows/verify-commits.yaml
@@ -0,0 +1,16 @@
+name: Verify Commits
+on:
+ pull_request:
+ types: [opened, synchronize, edited, reopened, ready_for_review]
+ push:
+ branches: [main]
+jobs:
+ commitlint:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ - name: Commitlint
+ uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
+ with:
+ configFile: commitlint.config.cjs
diff --git a/.github/workflows/verify-pr.yaml b/.github/workflows/verify-pr.yaml
new file mode 100644
index 0000000..1ef52c9
--- /dev/null
+++ b/.github/workflows/verify-pr.yaml
@@ -0,0 +1,60 @@
+name: Verify PR
+on:
+ workflow_dispatch:
+ pull_request:
+ branches: [main]
+jobs:
+ lint:
+ name: Lint
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ - name: Setup Node.js
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+ - name: Install dependencies
+ run: npm ci
+ - name: Check lint
+ run: npm run lint:check
+
+ format:
+ name: Format
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ - name: Setup Node.js
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+ - name: Install dependencies
+ run: npm ci
+ - name: Check format
+ run: npm run format:check
+
+ test:
+ name: Test (${{ matrix.os }}, Node ${{ matrix.node-version }})
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest]
+ node-version: [20, 22, 24]
+ defaults:
+ run:
+ shell: bash
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ - name: Set up Node.js
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
+ with:
+ node-version: ${{ matrix.node-version }}
+ cache: npm
+ - name: Install dependencies
+ run: npm ci
+ - name: Run unit tests
+ run: npm test
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 231d1cd..75d1cd2 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -3,4 +3,4 @@
-
\ No newline at end of file
+
diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
index d23208f..e648c01 100644
--- a/.idea/jsLibraryMappings.xml
+++ b/.idea/jsLibraryMappings.xml
@@ -3,4 +3,4 @@
-
\ No newline at end of file
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index cdd0705..dd6cb44 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,10 @@
-
+
-
\ No newline at end of file
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..5ace414 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -3,4 +3,4 @@
-
\ No newline at end of file
+
diff --git a/.oxfmtrc.json b/.oxfmtrc.json
new file mode 100644
index 0000000..e7ef0f2
--- /dev/null
+++ b/.oxfmtrc.json
@@ -0,0 +1,5 @@
+{
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
+ "singleQuote": true,
+ "useTabs": true
+}
diff --git a/.oxlintrc.json b/.oxlintrc.json
new file mode 100644
index 0000000..4db545b
--- /dev/null
+++ b/.oxlintrc.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "ignorePatterns": [],
+ "rules": {},
+ "overrides": []
+}
diff --git a/README.md b/README.md
index 2192cb9..ba9f7fd 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,13 @@
# @HarperFast/Schema-Codegen
-Schema Codegen will generate TypeScript types for your GraphQL schemas, making it easier to work with your data in TypeScript applications.
+Schema Codegen will generate TypeScript types for your GraphQL schemas, making it easier to work with your data in TypeScript and JavaScript applications.
## Installation
Install this with your favorite package manager!
-**Warning**: I haven't actually published this yet. :)
-
```bash
-npm install --save-dev @harperfast/schema-codegen
+npm install --save @harperfast/schema-codegen
```
Drop this in your Harper application's config.yaml:
@@ -21,11 +19,20 @@ Drop this in your Harper application's config.yaml:
schemaTypes: 'schemas/types.ts'
```
-When you `harper dev`, it will watch any file ending in .graphql.
+Alternatively, if you are using pure JavaScript, you can generate JSDoc instead:
+
+```yaml
+'@harperfast/schema-codegen':
+ package: '@harperfast/schema-codegen'
+ jsdoc: 'schemas/jsdocTypes.js'
+```
+
+When you `harper dev`, it will generate types based on the schema that's actually in your Harper database. If you change the schema, we will automatically regenerate the types for you.
## Example
For example, here's a tracks.graphql schema:
+
```graphql
type Tracks @table @sealed {
id: ID @primaryKey
@@ -34,7 +41,7 @@ type Tracks @table @sealed {
}
```
-Next to it, a management.graphql.ts file will get generated with this:
+Next to it, a schemas/types.ts file will get generated with this:
```typescript
/**
@@ -55,7 +62,8 @@ export type TrackRecords = Track[];
export type NewTrackRecord = Omit