babyclara 0.0.1

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.
Files changed (3) hide show
  1. package/data/index.js +4 -0
  2. package/index.js +52 -0
  3. package/package.json +15 -0
package/data/index.js ADDED
@@ -0,0 +1,4 @@
1
+ const apps = [];
2
+ const games = [];
3
+
4
+ module.exports = { apps, games };
package/index.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const { execSync } = require("child_process");
6
+
7
+ // Folders in your npm package to copy
8
+ // key = folder in CLI package
9
+ // value = destination folder name inside user's project
10
+ const foldersToCopy = [
11
+ { from: "template", to: "." }, // copy into root
12
+ { from: "data", to: "data" } // copy into ./data
13
+ ];
14
+
15
+ // Target folder (user directory)
16
+ const targetDir = process.cwd();
17
+
18
+ // Reusable recursive copy function
19
+ function copyFolder(src, dest) {
20
+ if (!fs.existsSync(dest)) {
21
+ fs.mkdirSync(dest, { recursive: true });
22
+ }
23
+
24
+ const items = fs.readdirSync(src);
25
+ if (items.length === 0) return;
26
+
27
+ items.forEach(item => {
28
+ const from = path.join(src, item);
29
+ const to = path.join(dest, item);
30
+
31
+ if (fs.lstatSync(from).isDirectory()) {
32
+ copyFolder(from, to);
33
+ } else {
34
+ fs.copyFileSync(from, to);
35
+ }
36
+ });
37
+ }
38
+
39
+ console.log("Generating Work Station...");
40
+
41
+ // Copy template and data folders
42
+ foldersToCopy.forEach(folder => {
43
+ const src = path.join(__dirname, folder.from);
44
+ const dest = path.join(targetDir, folder.to);
45
+ copyFolder(src, dest);
46
+ });
47
+
48
+ // Install gkrane inside the generated workspace
49
+ console.log("Installing Dependencies...");
50
+ execSync("npm install gkrane", { cwd: targetDir, stdio: "inherit" });
51
+
52
+ console.log("Done!");
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "babyclara",
3
+ "version": "0.0.1",
4
+ "description": "A Vue.Js Work Station",
5
+ "main": "index.js",
6
+ "author": "Augment Chinedu",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "bin": {
10
+ "babyclara": "index.js"
11
+ },
12
+ "dependencies": {
13
+ "gkrane": "^3.0.1"
14
+ }
15
+ }