babyclara 0.0.7 → 0.0.8
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/index.js +24 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -34,28 +34,43 @@ function copyFolder(src, dest) {
|
|
|
34
34
|
|
|
35
35
|
console.log("Generating Work Station...");
|
|
36
36
|
|
|
37
|
+
// Copy folders
|
|
37
38
|
foldersToCopy.forEach(folder => {
|
|
38
39
|
const src = path.join(__dirname, folder.from);
|
|
39
40
|
const dest = path.join(targetDir, folder.to);
|
|
40
41
|
copyFolder(src, dest);
|
|
41
42
|
});
|
|
42
43
|
|
|
43
|
-
// Install
|
|
44
|
+
// Install dependencies
|
|
44
45
|
console.log("Installing Dependencies...");
|
|
45
|
-
execSync("npm install gkrane cross-env --save", {
|
|
46
|
+
execSync("npm install gkrane cross-env --save", {
|
|
47
|
+
cwd: targetDir,
|
|
48
|
+
stdio: "inherit"
|
|
49
|
+
});
|
|
46
50
|
|
|
47
|
-
// Move local ./core into node_modules/core
|
|
51
|
+
// Move local ./core into node_modules/babyclara/core
|
|
48
52
|
const localCore = path.join(targetDir, "core");
|
|
49
|
-
const
|
|
53
|
+
const babyclaraCore = path.join(
|
|
54
|
+
targetDir,
|
|
55
|
+
"node_modules",
|
|
56
|
+
"babyclara",
|
|
57
|
+
"core"
|
|
58
|
+
);
|
|
50
59
|
|
|
51
60
|
if (fs.existsSync(localCore)) {
|
|
52
|
-
console.log("Moving ./core into node_modules/core...");
|
|
53
|
-
copyFolder(localCore,
|
|
61
|
+
console.log("Moving ./core into node_modules/babyclara/core...");
|
|
62
|
+
copyFolder(localCore, babyclaraCore);
|
|
54
63
|
fs.rmSync(localCore, { recursive: true, force: true });
|
|
55
64
|
} else {
|
|
56
65
|
console.log("No local ./core folder found, skipping move.");
|
|
57
66
|
}
|
|
58
67
|
|
|
68
|
+
// Delete template folder after setup
|
|
69
|
+
const templatePath = path.join(targetDir, "template");
|
|
70
|
+
if (fs.existsSync(templatePath)) {
|
|
71
|
+
console.log("Removing template folder...");
|
|
72
|
+
fs.rmSync(templatePath, { recursive: true, force: true });
|
|
73
|
+
}
|
|
59
74
|
|
|
60
75
|
// Modify package.json
|
|
61
76
|
const pkgPath = path.join(targetDir, "package.json");
|
|
@@ -65,15 +80,13 @@ if (fs.existsSync(pkgPath)) {
|
|
|
65
80
|
|
|
66
81
|
pkg.scripts = pkg.scripts || {};
|
|
67
82
|
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
pkg.scripts.start =
|
|
84
|
+
"node ./node_modules/babyclara/core/index.js";
|
|
70
85
|
|
|
71
|
-
// Build script (with ENV: BUILD=true)
|
|
72
86
|
pkg.scripts.build =
|
|
73
|
-
"cross-env BUILD=true node ./node_modules/core/index.js";
|
|
87
|
+
"cross-env BUILD=true node ./node_modules/babyclara/core/index.js";
|
|
74
88
|
|
|
75
89
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
76
|
-
|
|
77
90
|
console.log("Updated package.json scripts successfully.");
|
|
78
91
|
} else {
|
|
79
92
|
console.warn("⚠️ No package.json found — cannot add scripts.");
|