Skip to content

Commit

Permalink
Add blueprint check and updates (#944)
Browse files Browse the repository at this point in the history
* Test blueprint generation

* Add dependabot support with automerge for blueprint
  • Loading branch information
razor-x authored Jul 26, 2024
1 parent 0c90471 commit 9eed872
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
commit-message:
prefix: feat
include: scope
allow:
- dependency-name: '@seamapi/blueprint'
ignore:
- dependency-name: '*'
update-types:
- 'version-update:semver-major'
groups:
seam:
dependency-type: development
patterns:
- '@seamapi/blueprint'
update-types:
- patch
- minor
25 changes: 25 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Automerge

on:
pull_request:
branches:
- main

jobs:
merge:
name: Merge
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.actor == 'dependabot[bot]'
steps:
- name: Approve pull request
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Merge pull request
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,16 @@ jobs:
uses: ./.github/actions/setup
- name: Build docs
run: npm run docs:build
blueprint:
name: Blueprint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Generate blueprint
run: npm run blueprint
- name: Seam Connect Blueprint
run: cat ./tmp/connect-blueprint.json
19 changes: 19 additions & 0 deletions blueprint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { writeFile } from 'node:fs/promises'
import { join } from 'node:path'

import { createBlueprint, TypesModuleSchema } from '@seamapi/blueprint'

import * as types from '@seamapi/types/connect'

const typesModule = TypesModuleSchema.parse(types)

const blueprint = createBlueprint(typesModule)

const content = JSON.stringify(blueprint, null, 2)

const output = join('tmp', 'connect-blueprint.json')

await writeFile(output, Buffer.from(content))

// eslint-disable-next-line no-console
console.log(` Blueprint written to ${output}`)
43 changes: 40 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
"postbuild:ts": "tsc-alias --replacer ./tsc-alias-replacer.cjs --project tsconfig.build.json",
"typecheck": "tsc",
"docs:build": "typedoc",
"blueprint": "tsx ./blueprint.ts",
"preblueprint": "mkdirp tmp",
"lint": "eslint --ignore-path .gitignore .",
"prelint": "prettier --check --ignore-path .gitignore .",
"postversion": "git push --follow-tags",
Expand All @@ -90,6 +92,7 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@seamapi/blueprint": "^0.4.0",
"@types/node": "^20.8.10",
"concurrently": "^8.2.0",
"del-cli": "^5.0.0",
Expand All @@ -100,6 +103,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"mkdirp": "^3.0.1",
"patch-package": "^8.0.0",
"prettier": "^3.0.0",
"tsc-alias": "^1.8.2",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
},
"files": ["src/index.ts", "src/connect.ts", "src/devicedb.ts"],
"include": ["src/**/*"],
"exclude": ["tsup.config.ts"]
"exclude": ["tsup.config.ts", "blueprint.ts"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
}
},
"files": ["src/index.ts", "src/connect.ts"],
"include": ["src/**/*", "tsup.config.ts"]
"include": ["src/**/*", "tsup.config.ts", "blueprint.ts"]
}

0 comments on commit 9eed872

Please sign in to comment.