This commit is contained in:
@@ -49,19 +49,22 @@ const THEME_TEMPLATE = `/* Helder theme — custom CSS applied OVER the built-in
|
||||
/** Recently-opened files, newest first. Local machine state — git-ignored. */
|
||||
const RECENT_FILE = 'recent.json'
|
||||
const MAX_RECENT = 100
|
||||
const GITIGNORE_BODY = `# Helder — local, machine-specific state (do not commit)\n${RECENT_FILE}\n`
|
||||
// The whole .helder folder is local, machine-specific state — ignore all of it.
|
||||
const GITIGNORE_BODY = `# Helder — local, machine-specific state (do not commit).\n*\n`
|
||||
|
||||
let current: HelderConfig = DEFAULTS
|
||||
let themeCss = ''
|
||||
|
||||
/** Create `.helder/.gitignore` (ignoring recent.json) only when it's missing. */
|
||||
/** Ensure `.helder/.gitignore` ignores the entire folder; (re)write it when the
|
||||
* file is missing or out of date (e.g. upgrading from the old recent-only one). */
|
||||
async function ensureGitignore(dir: string): Promise<void> {
|
||||
const path = join(dir, '.gitignore')
|
||||
try {
|
||||
await readFile(path, 'utf8')
|
||||
if ((await readFile(path, 'utf8')) === GITIGNORE_BODY) return
|
||||
} catch {
|
||||
await writeFile(path, GITIGNORE_BODY)
|
||||
/* missing — fall through to write */
|
||||
}
|
||||
await writeFile(path, GITIGNORE_BODY)
|
||||
}
|
||||
|
||||
export async function getRecent(root: string): Promise<string[]> {
|
||||
|
||||
Reference in New Issue
Block a user