gbs-add-block 0.0.65 → 0.0.66
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 +6 -57
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -33,20 +33,11 @@ const CONFIG = {
|
|
|
33
33
|
dependencies: {
|
|
34
34
|
FormRenderer: ["Select", "MultiSelect", "Input", "DatePicker"],
|
|
35
35
|
},
|
|
36
|
-
frameworks: {
|
|
37
|
-
next: {
|
|
38
|
-
name: "Next.js",
|
|
39
|
-
path: ["app", "component-lib"],
|
|
40
|
-
},
|
|
41
|
-
vite: {
|
|
42
|
-
name: "Vite",
|
|
43
|
-
path: ["src", "component-lib"],
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
36
|
docs: "https://blackmax-designs.gitbook.io/building-block-v2.0",
|
|
47
37
|
};
|
|
48
38
|
|
|
49
39
|
const SOURCE_PATH = path.join(__dirname, "source", "components");
|
|
40
|
+
const DEFAULT_DEST_PATH = path.join(process.cwd(), "component-lib");
|
|
50
41
|
|
|
51
42
|
const copyCommonFiles = async (destPath) => {
|
|
52
43
|
const commonFiles = [
|
|
@@ -80,8 +71,9 @@ const copyComponent = async (component, destPath) => {
|
|
|
80
71
|
await fs.copy(componentSrc, componentDest, { overwrite: true });
|
|
81
72
|
console.log(
|
|
82
73
|
`✓ Component ${component} installed successfully ${
|
|
83
|
-
component === "Grid"
|
|
84
|
-
|
|
74
|
+
component === "Grid"
|
|
75
|
+
? "This Version of Grid will be deprecated soon. Please Install The New Data Grid Component"
|
|
76
|
+
: ""
|
|
85
77
|
}`
|
|
86
78
|
);
|
|
87
79
|
} catch (error) {
|
|
@@ -122,24 +114,6 @@ const installComponentWithDependencies = async (component, destPath) => {
|
|
|
122
114
|
console.log(`\nFor documentation visit: ${CONFIG.docs}`);
|
|
123
115
|
};
|
|
124
116
|
|
|
125
|
-
const detectFramework = () => {
|
|
126
|
-
// Check for Next.js
|
|
127
|
-
if (
|
|
128
|
-
fs.existsSync(path.join(process.cwd(), "next.config.ts")) ||
|
|
129
|
-
fs.existsSync(path.join(process.cwd(), "next.config.js"))
|
|
130
|
-
) {
|
|
131
|
-
return "next";
|
|
132
|
-
}
|
|
133
|
-
// Check for Vite
|
|
134
|
-
if (
|
|
135
|
-
fs.existsSync(path.join(process.cwd(), "vite.config.js")) ||
|
|
136
|
-
fs.existsSync(path.join(process.cwd(), "vite.config.ts"))
|
|
137
|
-
) {
|
|
138
|
-
return "vite";
|
|
139
|
-
}
|
|
140
|
-
return null;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
117
|
const main = async () => {
|
|
144
118
|
const argv = yargs(hideBin(process.argv))
|
|
145
119
|
.option("add", {
|
|
@@ -147,11 +121,6 @@ const main = async () => {
|
|
|
147
121
|
describe: "Component to install",
|
|
148
122
|
type: "string",
|
|
149
123
|
})
|
|
150
|
-
.option("framework", {
|
|
151
|
-
alias: "f",
|
|
152
|
-
describe: "Framework to use (next or vite)",
|
|
153
|
-
type: "string",
|
|
154
|
-
})
|
|
155
124
|
.option("list", {
|
|
156
125
|
alias: "l",
|
|
157
126
|
describe: "List available components",
|
|
@@ -185,28 +154,8 @@ const main = async () => {
|
|
|
185
154
|
process.exit(1);
|
|
186
155
|
}
|
|
187
156
|
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
if (!framework) {
|
|
191
|
-
framework = detectFramework();
|
|
192
|
-
if (!framework) {
|
|
193
|
-
console.error(
|
|
194
|
-
"Could not detect framework. Please specify using -f or --framework"
|
|
195
|
-
);
|
|
196
|
-
process.exit(1);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (!CONFIG.frameworks[framework]) {
|
|
201
|
-
console.error(`Unsupported framework: ${framework}`);
|
|
202
|
-
process.exit(1);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Create destination directory
|
|
206
|
-
const destPath = path.join(
|
|
207
|
-
process.cwd(),
|
|
208
|
-
...CONFIG.frameworks[framework].path
|
|
209
|
-
);
|
|
157
|
+
// Create destination directory in project root
|
|
158
|
+
const destPath = DEFAULT_DEST_PATH;
|
|
210
159
|
await fs.ensureDir(destPath);
|
|
211
160
|
|
|
212
161
|
// Copy common files if they don't exist
|