htmv 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ export default async (args) => {
6
6
  if (name === undefined)
7
7
  return console.error("No name supplied. Project creation cancelled");
8
8
  console.log("1. Starting project creation...");
9
- const folderAlreadyExists = await fs.exists(name);
9
+ const folderAlreadyExists = await exists(name);
10
10
  if (folderAlreadyExists)
11
11
  return console.error("There already exists a folder with that name.");
12
12
  const fullPath = path.resolve(name);
@@ -68,3 +68,12 @@ async function runCommand(command, options) {
68
68
  });
69
69
  });
70
70
  }
71
+ async function exists(path) {
72
+ try {
73
+ await fs.access(path);
74
+ return true;
75
+ }
76
+ catch {
77
+ return false;
78
+ }
79
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "htmv",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.8",
5
+ "version": "0.0.9",
6
6
  "devDependencies": {
7
7
  "@biomejs/biome": "2.3.3",
8
8
  "@types/bun": "latest"
@@ -7,7 +7,7 @@ export default async (args: string[]) => {
7
7
  if (name === undefined)
8
8
  return console.error("No name supplied. Project creation cancelled");
9
9
  console.log("1. Starting project creation...");
10
- const folderAlreadyExists = await fs.exists(name);
10
+ const folderAlreadyExists = await exists(name);
11
11
  if (folderAlreadyExists)
12
12
  return console.error("There already exists a folder with that name.");
13
13
  const fullPath = path.resolve(name);
@@ -73,3 +73,12 @@ async function runCommand(
73
73
  });
74
74
  });
75
75
  }
76
+
77
+ async function exists(path: string) {
78
+ try {
79
+ await fs.access(path);
80
+ return true;
81
+ } catch {
82
+ return false;
83
+ }
84
+ }