From 4d1470de5692e573614a5d20f22d868f693c0bc5 Mon Sep 17 00:00:00 2001 From: grngxd <36968271+grngxd@users.noreply.github.com> Date: Tue, 24 Jun 2025 16:10:50 +0100 Subject: [PATCH] uhhh --- cmd/init.ts | 9 ++++++--- index.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/init.ts b/cmd/init.ts index 1f410d7..71aad9d 100644 --- a/cmd/init.ts +++ b/cmd/init.ts @@ -1,5 +1,5 @@ import type { Command } from "commander"; -import { readdirSync, writeFileSync } from "fs"; +import { existsSync, mkdirSync, readdirSync, writeFileSync } from "fs"; import * as h from "hjson"; import { homedir } from "os"; import path from "path"; @@ -15,9 +15,12 @@ export const registerInitCommand = (p: Command) => { console.error("Error: Mix project already initialized. Please remove existing .mix.hjson or mix.lock files."); process.exit(1); } - - // userhomedir/.mix/mix.hjson + const mixDir = isDev ? "" : path.join(homedir(), ".mix"); + if (mixDir && !existsSync(mixDir)) { + mkdirSync(mixDir, { recursive: true }); + } + writeFileSync(path.join(mixDir, "mix.hjson"), h.stringify({ default: { packages: [] diff --git a/index.ts b/index.ts index 9ac76c6..f704ae7 100644 --- a/index.ts +++ b/index.ts @@ -6,7 +6,7 @@ const program = new Command(); program .name('mix') .description('a declerative file-based package manager for windows.') - .version('0.0.4', '-v, --version', 'output the current version'); + .version('0.0.5', '-v, --version', 'output the current version'); registerCommands(program); program.parse(); \ No newline at end of file