json-crud-ui-components 1.5.2 → 1.5.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/bin/cli.js
CHANGED
|
@@ -2,19 +2,14 @@ import path from "path";
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
|
|
4
4
|
const validate = ({ toPath }) => {
|
|
5
|
-
|
|
6
|
-
const indexPath = path.join(toPath, "index");
|
|
5
|
+
if (fs.existsSync(toPath)) {
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
console.log("index.html not found");
|
|
7
|
+
const files = fs.readdirSync(toPath);
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
console.log("index folder found");
|
|
16
|
-
|
|
17
|
-
return true;
|
|
9
|
+
if (files.length > 0) {
|
|
10
|
+
console.log("index folder should be empty");
|
|
11
|
+
return true;
|
|
12
|
+
};
|
|
18
13
|
};
|
|
19
14
|
|
|
20
15
|
return false;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { locateSource } from "./initHtml/steps/locateSource.js";
|
|
2
|
-
import { locateDestination } from "./initHtml/steps/locateDestination.js";
|
|
3
2
|
|
|
4
3
|
import { createProject } from "./initHtml/steps/createProject.js";
|
|
5
4
|
import { announce } from "./initHtml/steps/announce.js";
|
|
@@ -17,7 +16,7 @@ export default ({ folderName = "", toPath = process.cwd(), inAnnounce = true })
|
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
const source = locateSource();
|
|
20
|
-
const destination =
|
|
19
|
+
const destination = resolvedFolderName;
|
|
21
20
|
|
|
22
21
|
createProject({ source, destination });
|
|
23
22
|
|