Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aa31326
feat: create copier template with jinja2 templating
martgra Oct 27, 2025
fbc5d3c
create copier template
martgra Oct 28, 2025
76c2088
Add workflows permission to GitHub Action
martgra Oct 28, 2025
e466c77
Fix: Remove workflow files from build output to avoid permission issues
martgra Oct 28, 2025
0d029cd
Simplify template to Hello World example
martgra Oct 28, 2025
abaf2ac
Simplify Makefile test complexity
martgra Oct 28, 2025
a03d6e1
Update README to reflect simplified template
martgra Oct 28, 2025
e6de524
Simplify template README to showcase format
martgra Oct 28, 2025
805b3b4
Use uv action for faster Copier installation
martgra Oct 28, 2025
940abff
Fix: Remove duplicate build command lines
martgra Oct 28, 2025
aeb1d9f
Rename all .yml files to .yaml extension
martgra Oct 28, 2025
9f02566
Fix devcontainer.json to use .jinja extension
martgra Oct 28, 2025
a6ad24e
fix badge
martgra Oct 28, 2025
537e1ec
Update dev dependencies to latest versions
martgra Oct 28, 2025
a8eddf8
Migrate to ESLint 9 flat config format
martgra Oct 28, 2025
74d73b5
Fix: Remove .copier-answers.yml from build output
martgra Oct 28, 2025
d7c0f1c
Fix secretlint config for v11+ compatibility
martgra Oct 28, 2025
c2b0006
Fix husky pre-commit hook for Husky v9 and secretlint
martgra Oct 28, 2025
f600c2e
Add git hook testing and fix Husky v9 deprecations
martgra Oct 28, 2025
7f0bbe3
Simplify Makefile following Python template pattern
martgra Oct 28, 2025
5a4c39b
Fix Makefile test: remove duplicate prepare call
martgra Oct 28, 2025
3da4720
Fix Makefile test: add git user config for CI
martgra Oct 28, 2025
6ceadaf
Format template files and improve build process
martgra Oct 28, 2025
a44c1ba
move to biome
martgra Jun 15, 2026
df0399b
add deploy
martgra Jun 15, 2026
e1751d5
fix ci
martgra Jun 15, 2026
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
9 changes: 2 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Bun & TypeScript",
"dockerComposeFile": "docker-compose.yml",
"name": "TypeScript Template Dev",
"dockerComposeFile": "docker-compose.yaml",
"service": "app",
"workspaceFolder": "/workspace",
"shutdownAction": "stopCompose",
Expand All @@ -20,11 +20,6 @@
},
"containerUser": "vscode",
"remoteUser": "vscode",
"containerEnv": {
"HTTP_PROXY": "http://host.docker.internal:3128",
"HTTPS_PROXY": "http://host.docker.internal:3128",
"NO_PROXY": "localhost,127.0.0.1,::1,host.docker.internal,.local,.internal"
},
"remoteEnv": {
"PATH": "${containerEnv:PATH}:/home/vscode/.local/bin:/home/vscode/.bun/bin"
},
Expand Down
File renamed without changes.
27 changes: 0 additions & 27 deletions .eslintrc.json

This file was deleted.

139 changes: 139 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Build and Deploy Template

on:
push:
branches:
- template

# REQUIRED REPOSITORY SETTINGS:
# 1. Settings > Actions > General > Workflow permissions:
# Enable "Allow GitHub Actions to create and approve pull requests".
# 2. Add a repository secret named WORKFLOW_TOKEN (a PAT or GitHub App token)
# with the `workflow` scope (classic PAT: repo + workflow). The default
# GITHUB_TOKEN is NOT allowed to create or update files under
# .github/workflows/, and the generated example project ships a CI
# workflow, so the build PR to `main` must use this token.

jobs:
test-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout template branch
uses: actions/checkout@v4
with:
ref: template
fetch-depth: 0

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Check markdown links
uses: lycheeverse/lychee-action@v2
with:
args: --verbose --no-progress --exclude 'file://' --exclude 'host\.docker\.internal' '**/*.md' '**/*.md.jinja'
fail: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Run template tests
run: make test

- name: Build template output
run: make build

- name: Get template commit SHA
id: template_sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Prepare PR body
id: pr_body
run: |
cat << 'EOF' > /tmp/pr_body.md
## 🤖 Automated Template Build

This PR contains the rendered template from the latest changes on the `template` branch.

**Source commit:** `${{ steps.template_sha.outputs.sha }}`
**Build timestamp:** ${{ github.event.head_commit.timestamp }}

### ✅ Validation
- Link checking passed
- Template tests passed
- Lint and format checks validated
EOF
echo "body_file=/tmp/pr_body.md" >> $GITHUB_OUTPUT

- name: Clone repository for main branch
run: |
cd ..
git clone https://x-access-token:${{ secrets.WORKFLOW_TOKEN }}@github.com/${{ github.repository }}.git main-repo
cd main-repo
# Try to checkout main, or create orphan if it doesn't exist
git checkout main 2>/dev/null || git checkout --orphan main

- name: Apply build output to main branch
run: |
cd ../main-repo
# Remove all files except .git
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
# Copy build output
cp -r ../${{ github.event.repository.name }}/build_output/. .
# Remove copier answers file (shouldn't be in generated project)
rm -f .copier-answers.yaml .copier-answers.yml
# Keep .github/workflows so the rendered example CI ships to main
# (requires WORKFLOW_TOKEN; the default GITHUB_TOKEN cannot write them)

- name: Check for changes
id: check_changes
run: |
cd ../main-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Ensure main branch exists
if ! git ls-remote --heads origin main | grep -q main; then
git checkout --orphan main
git add -A
git commit -m "Initial commit from template@${{ steps.template_sha.outputs.sha }}"
git push origin main
else
git checkout main 2>/dev/null || git checkout --orphan main
fi

git add -A
if git diff --staged --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi

- name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.FINE_GRAINED_ACTION_TOKEN }}
path: ../main-repo
branch: template-build
base: main
title: "Build from template@${{ steps.template_sha.outputs.sha }}"
body-path: ${{ steps.pr_body.outputs.body_file }}
commit-message: "Build from template@${{ steps.template_sha.outputs.sha }}"
committer: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
135 changes: 10 additions & 125 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,130 +1,15 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Template Branch Files
# These are ignored in the template branch since they're generated

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
# Dependencies
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
bun.lock

# TypeScript cache
# Build artifacts
dist/
build/
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# Copier generated files (when testing locally)
.copier-answers.yaml
build_output/
10 changes: 0 additions & 10 deletions .prettierrc

This file was deleted.

42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
SHELL := /bin/bash
.PHONY: test build clean

# Use uvx copier with cache directory to avoid warnings
COPIER := uvx --cache-dir /tmp/uvx-cache copier

# Test template generation with git hooks validation
test:
@set -euo pipefail; \
tmpdir=$$(mktemp -d); \
echo "�� Generating template into: $$tmpdir"; \
$(COPIER) copy --vcs-ref=HEAD . "$$tmpdir" --defaults --force --trust 2>&1 | grep -v "FutureWarning\|DirtyLocalWarning" || true; \
cd "$$tmpdir"; \
echo "🌀 Initializing git repo..."; \
git config user.email "test@example.com"; \
git config user.name "Test User"; \
git add -A >/dev/null; \
bun install --no-cache >/dev/null; \
echo "🚀 Running pre-commit hooks..."; \
git commit -m "test: validate hooks" 2>&1 | tee /tmp/hook_output.log | grep -E "🔍 Scanning for secrets" >/dev/null && echo " ✓ Hooks validated" || (echo " ✗ Hooks failed" && cat /tmp/hook_output.log && exit 1); \
cd - >/dev/null; \
rm -rf "$$tmpdir"; \
echo "✅ All checks passed and temp folder cleaned up."

# Build for inspection (no git initialization)
build:
@echo "🔧 Generating template into: build_output/"
@rm -rf build_output
@$(COPIER) copy --vcs-ref=HEAD . build_output --defaults --force --trust --data skip_git_init=true 2>&1 | grep -v "FutureWarning\|DirtyLocalWarning" || true
@echo "📦 Installing dependencies..."
@cd build_output && bun install --no-cache >/dev/null
@echo "🎨 Formatting generated files..."
@cd build_output && bun run format >/dev/null
@echo "🚀 Running linter and formatter checks..."
@cd build_output && bun run lint && bun run format:check
@echo "✅ Template generated and validated successfully!"
@echo "📁 Check the output in: build_output/"

clean:
@echo "🧹 Cleaning build output..."
@rm -rf build_output
@echo "✅ Cleaned!"
Loading
Loading