Skip to content

Commit

Permalink
feat: implement file system (mkdir, writeFile)
Browse files Browse the repository at this point in the history
  • Loading branch information
aster-mnch committed Nov 14, 2024
1 parent 97e4ed8 commit 4046725
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"homepage": "https://github.com/aster-mnch/octoget#readme",
"dependencies": {
"@octokit/core": "^6.1.2",
"citty": "^0.1.6"
"citty": "^0.1.6",
"pathe": "^1.1.2"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/fs.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import fs from 'node:fs';
import { resolve } from 'pathe';

export async function mkdir(
dir: string,
options?: {
force?: boolean;
relativePath?: string;
},
) {
// TODO
const path = resolve(options?.relativePath ?? '.', dir);
await fs.promises.mkdir(path, { recursive: true });
}

export async function writeFile(
Expand All @@ -16,5 +20,6 @@ export async function writeFile(
relativePath?: string;
},
) {
// TODO
const filepath = resolve(options?.relativePath ?? '.', path);
await fs.promises.writeFile(filepath, content);
}

0 comments on commit 4046725

Please sign in to comment.