Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# All members on Developers team get added to review PRs
* @seedcase-project/developers
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
commit-message:
prefix: ci
include: scope
assignees:
- "lwjohnst86"
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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`
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[files]
extend-exclude = [
"*.css",
".quarto/*",
"_site/*",
"*.svg"
]
17 changes: 17 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -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": []
}
50 changes: 50 additions & 0 deletions .vscode/json.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"Insert TODO formatting": {
"scope": "quarto,markdown",
"prefix": "TODO",
"body": [
"<!-- TODO: ${0:Write text here} -->"
],
"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"
}
}
31 changes: 31 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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
}
95 changes: 95 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions tools/get-contributors.sh
Original file line number Diff line number Diff line change
@@ -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