@editframe/create 0.11.0-beta.1 → 0.11.0-beta.3
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/index.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readdir, cp } from "node:fs/promises";
|
|
2
|
+
import { readdir, cp, access } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import prompts from "prompts";
|
|
6
5
|
import chalk from "chalk";
|
|
6
|
+
import prompts from "prompts";
|
|
7
|
+
async function checkDirectoryExists(path2) {
|
|
8
|
+
try {
|
|
9
|
+
await access(path2);
|
|
10
|
+
return true;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
7
15
|
async function main() {
|
|
8
16
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
17
|
const templates = await readdir(path.join(__dirname, "templates"));
|
|
@@ -26,6 +34,23 @@ async function main() {
|
|
|
26
34
|
]);
|
|
27
35
|
const targetDir = path.join(process.cwd(), answers.directoryName);
|
|
28
36
|
const templateDir = path.join(__dirname, "templates", answers.templateName);
|
|
37
|
+
const exists = await checkDirectoryExists(targetDir);
|
|
38
|
+
if (exists) {
|
|
39
|
+
process.stderr.write(
|
|
40
|
+
chalk.yellow(`Directory ${targetDir} already exists.
|
|
41
|
+
`)
|
|
42
|
+
);
|
|
43
|
+
const { overwrite } = await prompts({
|
|
44
|
+
type: "confirm",
|
|
45
|
+
name: "overwrite",
|
|
46
|
+
message: "Directory already exists. Do you want to overwrite it?",
|
|
47
|
+
initial: false
|
|
48
|
+
});
|
|
49
|
+
if (!overwrite) {
|
|
50
|
+
process.stderr.write(chalk.red("Aborting...\n"));
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
29
54
|
process.stderr.write(`Creating project in directory: ${targetDir}
|
|
30
55
|
`);
|
|
31
56
|
process.stderr.write(`Using template: ${answers.templateName}`);
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@editframe/cli": "0.11.0-beta.
|
|
15
|
-
"@editframe/elements": "0.11.0-beta.
|
|
16
|
-
"@editframe/vite-plugin": "0.11.0-beta.
|
|
14
|
+
"@editframe/cli": "0.11.0-beta.3",
|
|
15
|
+
"@editframe/elements": "0.11.0-beta.3",
|
|
16
|
+
"@editframe/vite-plugin": "0.11.0-beta.3",
|
|
17
17
|
"tailwindcss": "^3.4.3",
|
|
18
18
|
"vite": "^5.2.11",
|
|
19
19
|
"vite-plugin-singlefile": "^2.0.1"
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@editframe/cli": "0.11.0-beta.
|
|
15
|
-
"@editframe/react": "0.11.0-beta.
|
|
16
|
-
"@editframe/vite-plugin": "0.11.0-beta.
|
|
14
|
+
"@editframe/cli": "0.11.0-beta.3",
|
|
15
|
+
"@editframe/react": "0.11.0-beta.3",
|
|
16
|
+
"@editframe/vite-plugin": "0.11.0-beta.3",
|
|
17
17
|
"@vitejs/plugin-react": "^4.3.1",
|
|
18
18
|
"tailwindcss": "^3.4.3",
|
|
19
19
|
"vite": "^5.2.11",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@editframe/cli": "0.11.0-beta.
|
|
15
|
-
"@editframe/elements": "0.11.0-beta.
|
|
16
|
-
"@editframe/vite-plugin": "0.11.0-beta.
|
|
14
|
+
"@editframe/cli": "0.11.0-beta.3",
|
|
15
|
+
"@editframe/elements": "0.11.0-beta.3",
|
|
16
|
+
"@editframe/vite-plugin": "0.11.0-beta.3",
|
|
17
17
|
"tailwindcss": "^3.4.3",
|
|
18
18
|
"vite": "^5.2.11",
|
|
19
19
|
"vite-plugin-singlefile": "^2.0.1"
|