Skip to content

Commit bc0e722

Browse files
committed
feat: add minimal example with SDK generation
1 parent d51e1e5 commit bc0e722

16 files changed

+642
-16
lines changed

.github/workflows/test-examples.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Validate Example generation
2+
3+
on: push
4+
5+
jobs:
6+
generate_sdk:
7+
runs-on: windows-latest
8+
steps:
9+
# Step 1: Checkout the repository
10+
- name: Checkout repository
11+
uses: actions/checkout@v3
12+
13+
# Step 2: Setup Node.js
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: "22" # Specify the version of Node.js you want to use
18+
19+
# Step 3: Run PowerShell commands
20+
- name: Run PowerShell Script
21+
shell: pwsh
22+
run: |
23+
Write-Host "Running a PowerShell script on Windows"
24+
node --version
25+
npm --version
26+
27+
# Step 4: Install dependencies
28+
- name: Install dependencies
29+
shell: pwsh
30+
run: npm ci
31+
32+
# Step 5: Install dependencies
33+
- name: Install dependencies
34+
shell: pwsh
35+
working-directory: examples/minimal-sdk
36+
run: npm ci
37+
38+
# Step 6: Generate types & sdk
39+
- name: Generate types & sdk
40+
shell: pwsh
41+
working-directory: examples/minimal-sdk
42+
run: npm run generate
43+
44+
# Step 7: Expect no changes in git
45+
- name: Expect no changes
46+
shell: bash
47+
run: |
48+
if git diff --exit-code --compact-summary; then
49+
echo "No changes detected"
50+
else
51+
echo "ERROR: Changes detected. The command executed by the pipeline resulted in changes that should have been made locally before creating a commit."
52+
exit 1
53+
fi

bin/run.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
import { spawn } from 'node:child_process'
33
import fs from 'node:fs'
44
import path from 'node:path'
5-
import { fileURLToPath } from 'node:url'
65

7-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
8-
9-
const project = path.join(__dirname, '../tsconfig.json')
6+
const project = path.join(import.meta.dirname, '../tsconfig.json')
107
const dev = fs.existsSync(project) && process.env.DEBUG !== 'false'
118

129
/**

examples/minimal-sdk/package-lock.json

+301
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/minimal-sdk/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "minimal",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"scripts": {
6+
"generate:types": "npx therefore -f src --clean",
7+
"generate:sdk": "npx therefore -f sdk --clean",
8+
"generate": "npm run generate:types && npm run generate:sdk"
9+
},
10+
"keywords": [],
11+
"author": "",
12+
"license": "ISC",
13+
"description": "",
14+
"dependencies": {
15+
"got": "^14.4.5"
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { $sdk } from '../../../../src/lib/sdk.js'
2+
3+
export default await $sdk({})

0 commit comments

Comments
 (0)