gbs-add-block 0.0.2 → 0.0.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/index.js +20 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -19,8 +19,19 @@ const COMPONENTS = [
|
|
|
19
19
|
"Toast",
|
|
20
20
|
];
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
|
|
22
|
+
// Function to find the package root directory
|
|
23
|
+
function findPackageRoot(startDir) {
|
|
24
|
+
let dir = startDir;
|
|
25
|
+
while (dir !== path.parse(dir).root) {
|
|
26
|
+
if (fs.existsSync(path.join(dir, "package.json"))) {
|
|
27
|
+
return dir;
|
|
28
|
+
}
|
|
29
|
+
dir = path.dirname(dir);
|
|
30
|
+
}
|
|
31
|
+
throw new Error("Unable to find package root");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const PACKAGE_ROOT = findPackageRoot(__dirname);
|
|
24
35
|
const SOURCE_PATH = path.join(PACKAGE_ROOT, "components");
|
|
25
36
|
const DEST_PATH = path.join(process.cwd(), "src", "component-lib");
|
|
26
37
|
|
|
@@ -120,6 +131,13 @@ function promptForComponent() {
|
|
|
120
131
|
);
|
|
121
132
|
}
|
|
122
133
|
|
|
134
|
+
// Print debug information
|
|
135
|
+
console.log("Debug Info:");
|
|
136
|
+
console.log(`__dirname: ${__dirname}`);
|
|
137
|
+
console.log(`PACKAGE_ROOT: ${PACKAGE_ROOT}`);
|
|
138
|
+
console.log(`SOURCE_PATH: ${SOURCE_PATH}`);
|
|
139
|
+
console.log(`DEST_PATH: ${DEST_PATH}`);
|
|
140
|
+
|
|
123
141
|
// Ensure the destination directory exists
|
|
124
142
|
fs.ensureDirSync(DEST_PATH);
|
|
125
143
|
|