Skip to content

Commit 9eed872

Browse files
authored
Add blueprint check and updates (#944)
* Test blueprint generation * Add dependabot support with automerge for blueprint
1 parent 0c90471 commit 9eed872

8 files changed

+127
-5
lines changed

.github/dependabot.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: npm
5+
directory: '/'
6+
schedule:
7+
interval: daily
8+
commit-message:
9+
prefix: feat
10+
include: scope
11+
allow:
12+
- dependency-name: '@seamapi/blueprint'
13+
ignore:
14+
- dependency-name: '*'
15+
update-types:
16+
- 'version-update:semver-major'
17+
groups:
18+
seam:
19+
dependency-type: development
20+
patterns:
21+
- '@seamapi/blueprint'
22+
update-types:
23+
- patch
24+
- minor

.github/workflows/automerge.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Automerge
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
merge:
11+
name: Merge
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
if: github.actor == 'dependabot[bot]'
15+
steps:
16+
- name: Approve pull request
17+
run: gh pr review --approve "$PR_URL"
18+
env:
19+
PR_URL: ${{ github.event.pull_request.html_url }}
20+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
21+
- name: Merge pull request
22+
run: gh pr merge --auto --merge "$PR_URL"
23+
env:
24+
PR_URL: ${{ github.event.pull_request.html_url }}
25+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/check.yml

+13
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,16 @@ jobs:
113113
uses: ./.github/actions/setup
114114
- name: Build docs
115115
run: npm run docs:build
116+
blueprint:
117+
name: Blueprint
118+
runs-on: ubuntu-latest
119+
timeout-minutes: 30
120+
steps:
121+
- name: Checkout
122+
uses: actions/checkout@v4
123+
- name: Setup
124+
uses: ./.github/actions/setup
125+
- name: Generate blueprint
126+
run: npm run blueprint
127+
- name: Seam Connect Blueprint
128+
run: cat ./tmp/connect-blueprint.json

blueprint.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { writeFile } from 'node:fs/promises'
2+
import { join } from 'node:path'
3+
4+
import { createBlueprint, TypesModuleSchema } from '@seamapi/blueprint'
5+
6+
import * as types from '@seamapi/types/connect'
7+
8+
const typesModule = TypesModuleSchema.parse(types)
9+
10+
const blueprint = createBlueprint(typesModule)
11+
12+
const content = JSON.stringify(blueprint, null, 2)
13+
14+
const output = join('tmp', 'connect-blueprint.json')
15+
16+
await writeFile(output, Buffer.from(content))
17+
18+
// eslint-disable-next-line no-console
19+
console.log(` Blueprint written to ${output}`)

package-lock.json

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

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
"postbuild:ts": "tsc-alias --replacer ./tsc-alias-replacer.cjs --project tsconfig.build.json",
7676
"typecheck": "tsc",
7777
"docs:build": "typedoc",
78+
"blueprint": "tsx ./blueprint.ts",
79+
"preblueprint": "mkdirp tmp",
7880
"lint": "eslint --ignore-path .gitignore .",
7981
"prelint": "prettier --check --ignore-path .gitignore .",
8082
"postversion": "git push --follow-tags",
@@ -90,6 +92,7 @@
9092
"zod": "^3.21.4"
9193
},
9294
"devDependencies": {
95+
"@seamapi/blueprint": "^0.4.0",
9396
"@types/node": "^20.8.10",
9497
"concurrently": "^8.2.0",
9598
"del-cli": "^5.0.0",
@@ -100,6 +103,7 @@
100103
"eslint-plugin-node": "^11.1.0",
101104
"eslint-plugin-simple-import-sort": "^12.0.0",
102105
"eslint-plugin-unused-imports": "^3.0.0",
106+
"mkdirp": "^3.0.1",
103107
"patch-package": "^8.0.0",
104108
"prettier": "^3.0.0",
105109
"tsc-alias": "^1.8.2",

tsconfig.build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
},
1212
"files": ["src/index.ts", "src/connect.ts", "src/devicedb.ts"],
1313
"include": ["src/**/*"],
14-
"exclude": ["tsup.config.ts"]
14+
"exclude": ["tsup.config.ts", "blueprint.ts"]
1515
}

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
}
3232
},
3333
"files": ["src/index.ts", "src/connect.ts"],
34-
"include": ["src/**/*", "tsup.config.ts"]
34+
"include": ["src/**/*", "tsup.config.ts", "blueprint.ts"]
3535
}

0 commit comments

Comments
 (0)