Compare commits

...

2 commits

Author SHA1 Message Date
bd354fb57d support solo repos with semantic release 2026-05-03 12:00:52 +02:00
2602b67938 add templates subcommand 2026-05-03 12:00:34 +02:00
6 changed files with 82 additions and 12 deletions

View file

@ -2,11 +2,12 @@
> Tooling and unified configuration for managing a bunch of repositories and packages.
## TODO
## Stack & Standards
- `check` action
- `check` bun script
- `test` bun script
- `release` action
- build with bun?
- run semantic release
- Bun
- TypeScript
- Oxlint & Oxfmt
- Commitlint
- Conventional Commit
- Semantic Release
- Forgejo Actions

View file

@ -1,5 +1,5 @@
name: Semantic Release
description: Run multi-semantic-release for per-package versioning
description: Run semantic-release (multi for monorepos, standard for solo packages)
inputs:
gitea-token:
@ -39,4 +39,9 @@ runs:
GITEA_TOKEN: ${{ inputs.gitea-token }}
GITEA_URL: ${{ inputs.gitea-url }}
NPM_TOKEN: ${{ inputs.npm-token }}
run: bunx multi-semantic-release
run: |
if node -e "const p=require('./package.json'); process.exit(p.workspaces ? 0 : 1)"; then
bunx multi-semantic-release
else
bunx semantic-release
fi

View file

@ -3,6 +3,7 @@ import { resolve } from "path"
import { check } from "../src/check"
import { sync } from "../src/sync"
import { promote } from "../src/promote"
import { templates } from "../src/templates"
const [command, ...rawArgs] = process.argv.slice(2)
const hasYes = rawArgs.includes("--yes")
@ -19,7 +20,10 @@ switch (command) {
case "promote":
await promote(targetDir, hasYes)
break
case "templates":
templates(rawArgs.includes("--full"))
break
default:
console.error("Usage: regime <check|sync|promote> [path] [--yes]")
console.error("Usage: regime <check|sync|promote|templates> [path] [--yes] [--full]")
process.exit(1)
}

View file

@ -14,7 +14,6 @@ import {
} from "./shared"
const green = Bun.color("green", "ansi")
const yellow = Bun.color("orange", "ansi")
const red = Bun.color("red", "ansi")
const purple = Bun.color("purple", "ansi")
const reset = "\x1b[0m"

61
src/templates.ts Normal file
View file

@ -0,0 +1,61 @@
import { readdirSync } from "node:fs"
import { join } from "node:path"
import { templatesDir, resolveTemplateConfig, readdirSyncRecursive } from "./shared"
const purple = Bun.color("green", "ansi")
const reset = "\x1b[0m"
interface TreeNode {
name: string
children: TreeNode[]
files: string[]
}
function buildTree(name: string, visited = new Set<string>()): TreeNode {
if (visited.has(name)) return { name, children: [], files: [] }
visited.add(name)
const config = resolveTemplateConfig(name)
const children = (config.inherits ?? []).map(p => buildTree(p, visited))
const dir = join(templatesDir, name)
const files = readdirSyncRecursive(dir).filter(f => f !== ".regime-template.json")
return { name, children, files }
}
function printTree(node: TreeNode, full: boolean, prefix = "", isLast = true, isRoot = true) {
const connector = isRoot ? "" : isLast ? "└── " : "├── "
const line = isRoot ? node.name : `${prefix}${connector}${node.name}`
console.log(line)
const childPrefix = isRoot ? "" : prefix + (isLast ? " " : "│ ")
if (full && node.files.length > 0) {
const hasChildren = node.children.length > 0
for (let i = 0; i < node.files.length; i++) {
const fileConnector = hasChildren || i < node.files.length - 1 ? "│ " : " "
const bullet = "·"
console.log(`${childPrefix}${fileConnector}${purple}${bullet} ${node.files[i]}${reset}`)
}
}
for (let i = 0; i < node.children.length; i++) {
const child = node.children[i]
const last = i === node.children.length - 1
printTree(child, full, childPrefix, last, false)
}
}
export function templates(full: boolean) {
const entries = readdirSync(templatesDir, { withFileTypes: true })
.filter(e => e.isDirectory())
.map(e => e.name)
.sort()
for (let i = 0; i < entries.length; i++) {
const tree = buildTree(entries[i])
printTree(tree, full)
if (i < entries.length - 1) console.log()
}
}

View file

@ -2,7 +2,7 @@ import { defineConfig } from "oxlint"
export default defineConfig({
plugins: ["typescript", "unicorn", "oxc"],
ignorePatterns: ["**/*.gen.ts"],
ignorePatterns: ["**/*.gen.ts", "node_modules/**/*"],
categories: {
correctness: "error",
suspicious: "warn",