Skip to content

Commit

Permalink
Add metalsmith build (#279)
Browse files Browse the repository at this point in the history
* Add TypeScript project structure

* Add metalsmith

* Add blueprint and types

* Add code-sample

* Add blueprint plugin

* Add codeSampleDefinitions

* Add pages from endpoints

* Only format src

* Add metalsmith layouts plugin

* Add empty layouts

* Add .nvmrc

* Generate files for sdk and api

* Move metalsmith items to dependencies

* Setup layouts

* Remove empty yaml

* Move output

* Add workflows

* ci: Format code

* Only lint src

* Add .prettierignore

* Set skipLibCheck

* Remove matrix in workflows

* Update blueprint

* Update blueprint

* Update output path

* Add README for development

* Update package.json

* Run format

* ci: Generate code

* Use list

* Do not link to Dependabot

* Add doc gen step to generate

* Format after build

* ci: Generate docs

* Update types

---------

Co-authored-by: Seam Bot <[email protected]>
  • Loading branch information
razor-x and seambot authored Jul 23, 2024
1 parent 76a616d commit a242ef4
Show file tree
Hide file tree
Showing 30 changed files with 5,343 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
63 changes: 63 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"root": true,
"plugins": ["simple-import-sort", "unused-imports"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": "latest"
},
"rules": {
"no-console": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"import/extensions": ["error", "ignorePackages"],
"import/no-duplicates": ["error", { "prefer-inline": true }],
"import/no-relative-parent-imports": "error",
"simple-import-sort/imports": [
"error",
{
"groups": [
["^\\u0000"],
["^node:"],
["^@?\\w"],
["@seamapi/makenew-tsmodule"],
["^lib/"],
["^"],
["^\\."]
]
}
],
"simple-import-sort/exports": "error"
},
"overrides": [
{
"files": ["*.js", "*.mjs", "*.cjs"],
"extends": ["standard", "prettier"]
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["standard-with-typescript", "prettier"],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{
"fixStyle": "inline-type-imports"
}
],
"@typescript-eslint/no-unused-vars": "off"
}
}
]
}
38 changes: 38 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Setup
description: Setup Node.js and install dependencies.

inputs:
node_version:
description: The Node.js version.
required: false
default: '20'
registry_url:
description: The Node.js package registry URL.
required: false
default: https://registry.npmjs.org
install_dependencies:
description: Install dependencies.
required: false
default: 'true'

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
if: inputs.install_dependencies == 'true'
with:
cache: npm
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Setup Node.js without cache
uses: actions/setup-node@v4
if: inputs.install_dependencies == 'false'
with:
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Install dependencies
if: inputs.install_dependencies == 'true'
shell: bash
run: npm ci
34 changes: 34 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Check

on:
push:
branches:
- main
pull_request:
branches:
- '**'

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Lint
run: npm run lint
typecheck:
name: Typecheck
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Typecheck
run: npm run typecheck
41 changes: 41 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Format

on:
push:
branches-ignore:
- main
workflow_dispatch: {}

jobs:
commit:
name: Format code
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: ${{ secrets.GIT_USER_NAME }}
git_committer_email: ${{ secrets.GIT_USER_EMAIL }}
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup
uses: ./.github/actions/setup
- name: Format
run: npm run format
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
if: always()
with:
commit_message: 'ci: Format code'
commit_user_name: ${{ secrets.GIT_USER_NAME }}
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>
44 changes: 44 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Generate

on:
push:
branches-ignore:
- main
workflow_dispatch: {}

jobs:
commit:
name: Generate code
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: ${{ secrets.GIT_USER_NAME }}
git_committer_email: ${{ secrets.GIT_USER_EMAIL }}
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup
uses: ./.github/actions/setup
with:
install_dependencies: 'false'
- name: Normalize package-lock.json
run: npm install
- name: Generate docs
run: npm run build
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'ci: Generate docs'
commit_user_name: ${{ secrets.GIT_USER_NAME }}
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>
Loading

0 comments on commit a242ef4

Please sign in to comment.