apiforge-cli 1.0.3 → 1.0.4
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/bin/apiforge.js +3 -1
- package/lib/create.js +18 -7
- package/package.json +1 -1
package/bin/apiforge.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { createProject } from "../lib/create.js";
|
|
4
4
|
|
|
5
|
+
const VERSION = "1.0.3";
|
|
6
|
+
|
|
5
7
|
const args = process.argv.slice(2);
|
|
6
8
|
|
|
7
9
|
if (args[0] === "--version" || args[0] === "-v") {
|
|
8
|
-
console.log(
|
|
10
|
+
console.log(VERSION);
|
|
9
11
|
process.exit(0);
|
|
10
12
|
}
|
|
11
13
|
|
package/lib/create.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs from "fs
|
|
1
|
+
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
4
|
export function createProject(type, name) {
|
|
@@ -8,17 +8,28 @@ export function createProject(type, name) {
|
|
|
8
8
|
type
|
|
9
9
|
);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
if (!fs.existsSync(template)) {
|
|
12
|
+
console.log("Plantilla no encontrada");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const project = path.join(
|
|
12
17
|
process.cwd(),
|
|
13
18
|
name
|
|
14
19
|
);
|
|
15
20
|
|
|
16
|
-
if (
|
|
17
|
-
console.log("
|
|
18
|
-
|
|
21
|
+
if (fs.existsSync(project)) {
|
|
22
|
+
console.log("El proyecto ya existe");
|
|
23
|
+
process.exit(1);
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
fs.
|
|
26
|
+
fs.mkdirSync(project);
|
|
27
|
+
|
|
28
|
+
fs.cpSync(
|
|
29
|
+
template,
|
|
30
|
+
project,
|
|
31
|
+
{ recursive: true }
|
|
32
|
+
);
|
|
22
33
|
|
|
23
34
|
console.log(`Proyecto creado: ${name}`);
|
|
24
|
-
}
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"apiforge-cli","version":"1.0.
|
|
1
|
+
{"name":"apiforge-cli","version":"1.0.4","description":"CLI for automatically creating APIs","type":"module","bin":{"apiforge":"./bin/apiforge.js"},"dependencies":{"chalk":"^5.0.0","commander":"^12.0.0","fs-extra":"^11.0.0"}}
|