* starting on new checklist implementation Change default shouldShow behavior for stages. add new messages and stages. Change some existing stage logic. Add placeholder var for the rules. Co-Authored-By: @coolbot100s * misc fixes + corrections * Add clickable link previews to links stage * Correct mislabeled title message and add new title messages * Change message formatting, use rules variable, correct wip desc and title 1.8 messages, add tags buttons * More applications of rules placeholder * Add new status alerts stage * change order of statusAlerts * Update title related messages, add navigation based vars * Overhaul Links stage and add new messages. * Set message weights, add some disables * message.mds now obey lint >:( * fixed links text message formatting and changed an icon * Combine title and slug stages * Add more info to some stages and properly case stage ids * tweak summary text formatting * Improved tags stage info and more navigation placeholders * redo reupload stage, more navigation placeholders, licensing stage improvements, versions stage improvements, status alerts stage improvements * Allow modpack permissions stage to appear again by adding a dummy button. * Update modpack permissions guidance * fix: blog path issues * fix: lint issues * fix license stage text formatting * Improve license stage * feat: move links into one md file to be cleaner * Update packages/moderation/data/stages/links.ts Signed-off-by: IMB11 <hendersoncal117@gmail.com> --------- Signed-off-by: IMB11 <hendersoncal117@gmail.com> Co-authored-by: IMB11 <hendersoncal117@gmail.com> Co-authored-by: IMB11 <calum@modrinth.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { execSync } from 'child_process'
|
|
import * as path from 'path'
|
|
|
|
let REPO_ROOT_CACHE: string | null = null
|
|
export function getRepoRoot(): string {
|
|
if (REPO_ROOT_CACHE) return REPO_ROOT_CACHE
|
|
return (REPO_ROOT_CACHE = execSync('git rev-parse --show-toplevel').toString().trim())
|
|
}
|
|
|
|
export function repoPath(...segments: string[]): string {
|
|
return path.posix.join(getRepoRoot(), ...segments)
|
|
}
|
|
|
|
export async function copyDir(
|
|
src: string,
|
|
dest: string,
|
|
logFn: (src: string, dest: string) => void = () => {},
|
|
): Promise<void> {
|
|
const { promises: fs } = await import('fs')
|
|
await fs.mkdir(dest, { recursive: true })
|
|
const entries = await fs.readdir(src, { withFileTypes: true })
|
|
for (const entry of entries) {
|
|
const srcPath = path.posix.join(src, entry.name)
|
|
const destPath = path.posix.join(dest, entry.name)
|
|
if (entry.isDirectory()) {
|
|
await copyDir(srcPath, destPath, logFn)
|
|
} else if (entry.isFile()) {
|
|
await fs.copyFile(srcPath, destPath)
|
|
logFn(srcPath, destPath)
|
|
}
|
|
}
|
|
}
|
|
|
|
export function toVarName(file: string): string {
|
|
return file
|
|
.replace(/\.md$/, '')
|
|
.replace(/[^a-zA-Z0-9]/g, '_')
|
|
.replace(/^_+/, '')
|
|
.replace(/_+$/, '')
|
|
}
|