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.
- package/dist/cli/commands/new.js +10 -1
- package/package.json +1 -1
- package/src/cli/commands/new.ts +10 -1
package/dist/cli/commands/new.js
CHANGED
|
@@ -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
|
|
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
package/src/cli/commands/new.ts
CHANGED
|
@@ -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
|
|
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
|
+
}
|