diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6ecf0f4 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig settings. Some editors will read these automatically; +# for those that don't, see here: http://editorconfig.org/ + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +max_line_length = 88 + +# Have a bit shorter line length for text docs +[*.{txt,md,qmd}] +max_line_length = 72 +indent_size = 4 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..0cf4ce7 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# All members on Developers team get added to review PRs +* @seedcase-project/developers diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..db513a1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + commit-message: + prefix: ci + include: scope + assignees: + - "lwjohnst86" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..736c08f --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +# Description + +These changes EXPLANATION + +Closes # + +This PR needs a quick/an in-depth review. + +## Checklist + +- [ ] Formatted Markdown +- [ ] Ran `just run-all` diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e5716ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Development files and folders +_ignore +bin/ +dev/ + +# Temporary files +*.tmp + +# Any IDE specific folders +.idea + +# MacOS +.DS_Store + +# Quarto +/.quarto/ +docs/.quarto/ + +# Website generation +_site +_book +public +site diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9b0f4a4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +ci: + autofix_commit_msg: "chore(pre-commit): :pencil2: automatic fixes" + autoupdate_commit_msg: "ci(pre-commit): :construction_worker: update pre-commit CI version" + +repos: + - repo: https://github.com/gitleaks/gitleaks + rev: v8.28.0 + hooks: + - id: gitleaks + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-merge-conflict + args: [--assume-in-merge] + + - repo: https://github.com/commitizen-tools/commitizen + rev: v4.8.3 + hooks: + - id: commitizen + + # Use the mirror since the main `typos` repo has tags for different + # sub-packages, which confuses pre-commit when it tries to find the latest + # version + - repo: https://github.com/adhtruong/mirrors-typos + rev: v1.34.0 + hooks: + - id: typos diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..36a99f8 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,7 @@ +[files] +extend-exclude = [ + "*.css", + ".quarto/*", + "_site/*", + "*.svg" +] diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..ccafcd0 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,17 @@ +{ + "recommendations": [ + "eamodio.gitlens", + "GitHub.vscode-github-actions", + "redhat.vscode-yaml", + "donjayamanne.githistory", + "felipecaputo.git-project-manager", + "GitHub.vscode-pull-request-github", + "quarto.quarto", + "vivaxy.vscode-conventional-commits", + "pshaddel.conventional-branch", + "tekumara.typos-vscode", + "EditorConfig.EditorConfig", + "samuelcolvin.jinjahtml" + ], + "unwantedRecommendations": [] +} diff --git a/.vscode/json.code-snippets b/.vscode/json.code-snippets new file mode 100644 index 0000000..0b8953a --- /dev/null +++ b/.vscode/json.code-snippets @@ -0,0 +1,50 @@ +{ + "Insert TODO formatting": { + "scope": "quarto,markdown", + "prefix": "TODO", + "body": [ + "" + ], + "description": "Insert TODO formatting" + }, + "Insert bash formatted text": { + "scope": "quarto,markdown", + "prefix": "bash", + "body": [ + "``` bash", + "${0:Write text here}", + "```" + ], + "description": "Insert bash formatted text" + }, + "Insert a hidden comment section": { + "scope": "quarto,markdown", + "prefix": "hidden", + "body": [ + "::: content-hidden", + "${0:Write comments here}", + ":::" + ], + "description": "Insert a hidden content section" + }, + "Insert a 2 col table": { + "scope": "quarto,markdown", + "prefix": "tbl2", + "body": [ + "|${1:title} |${0:title} |", + "| --- | --- |", + "| | |" + ], + "description": "Insert a 2 col table" + }, + "Insert a 3 col table": { + "scope": "quarto,markdown", + "prefix": "tbl3", + "body": [ + "|${1:title} |${2:title} |${0:title} |", + "| --- | --- | --- |", + "| | | |" + ], + "description": "Insert a 3 col table" + } +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..906df6d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,31 @@ +{ + "files.autoSave": "onFocusChange", + "editor.wordWrap": "off", + "editor.formatOnSave": true, + "git.autofetch": false, + "quarto.visualEditor.markdownWrap": "column", + "quarto.visualEditor.markdownWrapColumn": 72, + "editor.tabCompletion": "on", + "editor.snippetSuggestions": "inline", + "conventional-branch.type": [ + "build", + "ci", + "docs", + "feat", + "fix", + "refactor", + "style", + "test", + "chore" + ], + "conventional-branch.format": "{Type}/{Branch}", + "[quarto][qmd][jinja]": { + "editor.formatOnSave": false + }, + "files.associations": { + "*.yml.jinja": "jinja-yaml", + "*.cff.jinja": "jinja-yaml", + "*.toml.jinja": "jinja-toml" + }, + "files.insertFinalNewline": true +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..dc8d7a1 --- /dev/null +++ b/justfile @@ -0,0 +1,95 @@ +@_default: + just --list --unsorted + +@_checks: check-spelling check-commits +@_builds: build-contributors build-website build-readme + +# Run all build-related recipes in the justfile +run-all: update-quarto-theme _checks test _builds + +# Install the pre-commit hooks +install-precommit: + # Install pre-commit hooks + uvx pre-commit install + # Run pre-commit hooks on all files + uvx pre-commit run --all-files + # Update versions of pre-commit hooks + uvx pre-commit autoupdate + +# Update the Quarto seedcase-theme extension +update-quarto-theme: + quarto add seedcase-project/seedcase-theme --no-prompt + +# Check the commit messages on the current branch that are not on the main branch +check-commits: + #!/bin/zsh + branch_name=$(git rev-parse --abbrev-ref HEAD) + number_of_commits=$(git rev-list --count HEAD ^main) + if [[ ${branch_name} != "main" && ${number_of_commits} -gt 0 ]] + then + uvx --from commitizen cz check --rev-range main..HEAD + else + echo "On `main` or current branch doesn't have any commits." + fi + +# Check for spelling errors in files +check-spelling: + uvx typos + +# Test and check that a data package can be created from the template +test: + #!/bin/zsh + test_name="test-website" + test_dir="$(pwd)/_temp/$test_name" + template_dir="$(pwd)" + commit=$(git rev-parse HEAD) + rm -rf $test_dir + # vcs-ref means the current commit/head, not a tag. + uvx copier copy $template_dir $test_dir \ + --vcs-ref=$commit \ + --defaults \ + --trust + # Run checks in the generated test data package + cd $test_dir + git add . + git commit -m "test: initial copy" + just check-spelling + # TODO: Find some way to test the `update` command + # Check that recopy works + echo "Testing recopy command -----------" + rm .cz.toml + git add . + git commit -m "test: preparing to recopy from the template" + uvx copier recopy \ + --vcs-ref=$commit \ + --defaults \ + --overwrite \ + --trust + # Check that copying onto an existing data package works + echo "Using the template in an existing package command -----------" + rm .cz.toml .copier-answers.yml + git add . + git commit -m "test: preparing to copy onto an existing package" + uvx copier copy \ + $template_dir $test_dir \ + --vcs-ref=$commit \ + --defaults \ + --trust \ + --overwrite + +# Clean up any leftover and temporary build files +cleanup: + #!/bin/zsh + rm -rf _temp + +# Build the website using Quarto +build-website: + uvx --from quarto quarto render + +# Re-build the README file from the Quarto version +build-readme: + uvx --from quarto quarto render README.qmd --to gfm + +# Generate a Quarto include file with the contributors +build-contributors: + sh ./tools/get-contributors.sh seedcase-project/template-workshop diff --git a/tools/get-contributors.sh b/tools/get-contributors.sh new file mode 100644 index 0000000..9eab066 --- /dev/null +++ b/tools/get-contributors.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Get a list of contributors to this repository and save it to +# _contributors.qmd.tmp file. It also: +# +# - Formats users into Markdown links to their GitHub profiles. +# - Removes any usernames with the word "bot" in them. +# - Removes the trailing comma from the list. +repo_spec=${1} +gh api \ + /repos/$repo_spec/contributors \ + --template '{{range .}} [\@{{.login}}]({{.html_url}}){{"\n"}}{{end}}' | \ + grep -v "\[bot\]" | \ + tr '\n' ', ' | \ + sed -e 's/,$//' > _contributors.qmd.tmp