Skip to content

Commit

Permalink
feat: add gen command to generate markdown docs
Browse files Browse the repository at this point in the history
  • Loading branch information
twelvelabs committed Jul 28, 2023
1 parent 0bb3fde commit da995b9
Show file tree
Hide file tree
Showing 33 changed files with 2,671 additions and 160 deletions.
95 changes: 95 additions & 0 deletions .dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
dependencies:
default:
- name: actionlint
install: brew install actionlint
description: Static checker for GitHub Actions workflow files.
url: https://github.com/rhysd/actionlint

- name: gh
install: brew install gh
description: GitHub's official command line tool.
url: https://github.com/cli/cli

- name: git
install: brew install git
description: Distributed version control system.
url: https://git-scm.com

- name: gitleaks
install: brew install gitleaks
description: SAST tool for detecting hardcoded secrets in git repos.
url: https://github.com/gitleaks/gitleaks

- name: go
install: brew install go
description: The Go programming language.
url: https://github.com/golang/go

- name: gocovsh
install: brew install orlangure/tap/gocovsh
description: Tool for exploring Go Coverage reports from the command line.
url: https://github.com/orlangure/gocovsh

- name: golangci-lint
install: brew install golangci-lint
description: Fast linters runner for Go.
url: https://github.com/golangci/golangci-lint

- name: goreleaser
install: brew install goreleaser
description: Deliver Go binaries as fast and easily as possible.
url: https://github.com/goreleaser/goreleaser

- name: gum
install: brew install gum
description: A tool for glamorous shell scripts.
url: https://github.com/charmbracelet/gum

- name: jq
install: brew install jq
description: Command-line JSON processor.
url: https://github.com/jqlang/jq

- name: npm
install: brew install npm
description: The package manager for JavaScript.
url: https://github.com/npm/cli

- name: shellcheck
install: brew install shellcheck
description: A static analysis tool for shell scripts.
url: https://github.com/koalaman/shellcheck

- name: shfmt
install: brew install shfmt
description: A shell parser, formatter, and interpreter.
url: https://github.com/mvdan/sh

- name: stylist
install: brew install twelvelabs/tap/stylist
description: Manage all your code quality tools with a single executable.
url: https://github.com/twelvelabs/stylist

- name: cspell
install: npm install --global --no-audit --no-fund --quiet cspell
description: A Spell Checker for Code.
url: https://github.com/streetsidesoftware/cspell

- name: markdownlint
install: npm install --global --no-audit --no-fund --quiet markdownlint-cli
description: MarkdownLint command line interface.
url: https://github.com/igorshubovych/markdownlint-cli

- name: pin-github-action
install: npm install --global --no-audit --no-fund --quiet pin-github-action
description: Pin your GitHub actions to a specific hash.
url: https://github.com/mheap/pin-github-action

ci: []

local:
- name: gitlint
install: brew install gitlint
description: Linting for your git commit messages.
url: https://github.com/jorisroovers/gitlint
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
token: ${{ github.ref_name == 'main' && secrets.GH_PAT || secrets.GITHUB_TOKEN }}

- name: Set up Homebrew
uses: homebrew/actions/setup-homebrew@a1377360f443cba4201fe7a591d1c60ba7ddab7a # pin@master
uses: homebrew/actions/setup-homebrew@9e809e528c6aae1b87ed30f5d81fe75d0bfc6f38 # pin@master

- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # pin@v4.0.0
Expand All @@ -50,6 +50,7 @@ jobs:

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # pin@v5.2.0
if: github.ref_name == 'main'
with:
gpg_private_key: ${{ secrets.GH_COMMIT_SIGNING_KEY }}
passphrase: ${{ secrets.GH_COMMIT_SIGNING_PASS }}
Expand All @@ -61,7 +62,7 @@ jobs:
- name: Create release tag
# Change to support different release channels
# Versions from a non-main branch will look like: `v.0.0.0-branch-name`.
if: contains(fromJSON('["main", "beta"]'), github.ref_name)
if: github.ref_name == 'main'
run: make release-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fetch-depth: 0

- name: Set up Homebrew
uses: homebrew/actions/setup-homebrew@a1377360f443cba4201fe7a591d1c60ba7ddab7a # pin@master
uses: homebrew/actions/setup-homebrew@9e809e528c6aae1b87ed30f5d81fe75d0bfc6f38 # pin@master

- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # pin@v4.0.0
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
coverage.out
build/
dist/
out/

bin/setup-repos.sh
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ linters:
enable-all: true
disable:
- cyclop
- depguard
- dupl
- goerr113
- exhaustruct
Expand All @@ -15,8 +16,10 @@ linters:
- godox
- gofumpt
- gomnd
- ireturn
- nlreturn
- paralleltest
- tagalign
- tagliatelle
- testpackage
- varnamelen
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ brews:
install: |-
bin.install "schemadoc"
bash_completion.install "completions/schemadoc.bash" => "schemadoc"
zsh_completion.install "completions/schemadoc.zsh" => "_envctl"
zsh_completion.install "completions/schemadoc.zsh" => "_schemadoc"
fish_completion.install "completions/schemadoc.fish"
man1.install "manpages/schemadoc.1.gz"
test: |
Expand Down
14 changes: 14 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Example config w/ defaults:
# - https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml

# MD013/line-length - Line length
MD013:
line_length: 120
code_blocks: false
tables: false

# MD033/no-inline-html - Inline HTML
MD033:
allowed_elements:
- br
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
internal/jsonschema/templates/markdown.tpl.md
2 changes: 2 additions & 0 deletions .schemadoc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
debug: false
1 change: 1 addition & 0 deletions .stylist.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
excludes:
- build/**
- dist/**
- out/**
- .cspellcache
output:
show_context: true
Expand Down
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
},
{
"name": "Test Package",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/${relativeFileDirname}",
"showLog": true
}
]
}
4 changes: 0 additions & 4 deletions bin/setup-ci.sh

This file was deleted.

91 changes: 0 additions & 91 deletions bin/setup-local.sh

This file was deleted.

50 changes: 22 additions & 28 deletions bin/setup.sh
Original file line number Diff line number Diff line change
@@ -1,43 +1,37 @@
#!/usr/bin/env bash
set -o errexit -o errtrace -o nounset -o pipefail

export HOMEBREW_NO_INSTALL_CLEANUP="1"

ensure-dependency() {
local dependency="${1}"
local install_command="${2}"

if command -v "${dependency}" >/dev/null 2>&1; then
echo "Found dependency: ${dependency}."
else
echo "Installing dependency: ${dependency}..."
if ! command -v "${dependency}" >/dev/null 2>&1; then
$install_command
fi
}

export HOMEBREW_NO_INSTALL_CLEANUP="1"

ensure-dependency "brew" "echo 'Please follow the instructions at https://brew.sh' && exit 1"
ensure-dependency "depctl" "brew install --quiet twelvelabs/tap/depctl"

ensure-dependency "actionlint" "brew install --quiet actionlint"
ensure-dependency "gh" "brew install --quiet gh"
ensure-dependency "git" "brew install --quiet git"
ensure-dependency "gitleaks" "brew install --quiet gitleaks"
ensure-dependency "go" "brew install --quiet go"
ensure-dependency "gocovsh" "brew install --quiet orlangure/tap/gocovsh"
ensure-dependency "golangci-lint" "brew install --quiet golangci-lint"
ensure-dependency "goreleaser" "brew install --quiet goreleaser"
ensure-dependency "gum" "brew install --quiet gum"
ensure-dependency "jq" "brew install --quiet jq"
ensure-dependency "npm" "brew install --quiet node"
ensure-dependency "shellcheck" "brew install --quiet shellcheck"
ensure-dependency "shfmt" "brew install --quiet shfmt"
ensure-dependency "stylist" "brew install --quiet twelvelabs/tap/stylist"
ensure-dependency "cspell" "npm install --global --no-audit --no-fund --quiet cspell"
ensure-dependency "markdownlint" "npm install --global --no-audit --no-fund --quiet markdownlint-cli"
ensure-dependency "pin-github-action" "npm install --global --no-audit --no-fund --quiet pin-github-action"
depctl up default

SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
if [[ "${CI:-}" == "true" ]]; then
source "${SCRIPT_DIR}/setup-ci.sh"
depctl up ci
else
source "${SCRIPT_DIR}/setup-local.sh"
depctl up local

# Ensure git repos.
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
if [[ -f "${SCRIPT_DIR}/setup-repos.sh" ]]; then
source "${SCRIPT_DIR}/setup-repos.sh"
fi

# Ensure local repo hooks.
if [[ -d .git ]]; then
echo "Updating .git/hooks."
mkdir -p .git/hooks
rm -f .git/hooks/*.sample
cp -f bin/githooks/* .git/hooks/
chmod +x .git/hooks/*
fi
fi
Loading

0 comments on commit da995b9

Please sign in to comment.