react-apps-ui 1.0.6 ā 1.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/dist/index.js +22 -0
- package/package.json +1 -1
- package/src/index.ts +36 -0
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const prompts_1 = __importDefault(require("prompts"));
|
|
10
10
|
const fs_1 = __importDefault(require("fs"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const child_process_1 = require("child_process");
|
|
12
13
|
// base URL to GitHub Raw folder
|
|
13
14
|
const REGISTRY_URL = "https://raw.githubusercontent.com/anandvyas2021/react-apps-ui-registry/refs/heads/prod/__registry__";
|
|
14
15
|
const program = new commander_1.Command();
|
|
@@ -178,6 +179,27 @@ program
|
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
}
|
|
182
|
+
// 5. INSTALL NPM DEPENDENCIES
|
|
183
|
+
const depsToInstall = new Set();
|
|
184
|
+
// Collect all dependencies from the components we just added
|
|
185
|
+
for (const compName of componentsToAdd) {
|
|
186
|
+
const compData = registry.find((c) => c.name === compName);
|
|
187
|
+
if (compData && compData.dependencies) {
|
|
188
|
+
compData.dependencies.forEach((dep) => depsToInstall.add(dep));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (depsToInstall.size > 0) {
|
|
192
|
+
const depList = Array.from(depsToInstall).join(" ");
|
|
193
|
+
console.log(chalk_1.default.blue(`\nš¦ Installing NPM dependencies: ${depList}...`));
|
|
194
|
+
try {
|
|
195
|
+
// This runs 'npm install' directly in the user's terminal
|
|
196
|
+
(0, child_process_1.execSync)(`npm install ${depList}`, { stdio: "inherit" });
|
|
197
|
+
console.log(chalk_1.default.green("ā Dependencies installed successfully."));
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
console.log(chalk_1.default.red("ā Failed to install dependencies. You may need to install them manually."));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
181
203
|
console.log(chalk_1.default.blue("\nš Components installed successfully!"));
|
|
182
204
|
}
|
|
183
205
|
catch (error) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import prompts from "prompts";
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import path from "path";
|
|
7
|
+
import { execSync } from "child_process";
|
|
7
8
|
|
|
8
9
|
// base URL to GitHub Raw folder
|
|
9
10
|
const REGISTRY_URL =
|
|
@@ -278,6 +279,41 @@ program
|
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
281
|
|
|
282
|
+
// 5. INSTALL NPM DEPENDENCIES
|
|
283
|
+
const depsToInstall = new Set<string>();
|
|
284
|
+
|
|
285
|
+
// Collect all dependencies from the components we just added
|
|
286
|
+
for (const compName of componentsToAdd) {
|
|
287
|
+
const compData = registry.find((c: any) => c.name === compName);
|
|
288
|
+
if (compData && compData.dependencies) {
|
|
289
|
+
compData.dependencies.forEach((dep: string) =>
|
|
290
|
+
depsToInstall.add(dep),
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (depsToInstall.size > 0) {
|
|
296
|
+
const depList = Array.from(depsToInstall).join(" ");
|
|
297
|
+
console.log(
|
|
298
|
+
chalk.blue(
|
|
299
|
+
`\nš¦ Installing NPM dependencies: ${depList}...`,
|
|
300
|
+
),
|
|
301
|
+
);
|
|
302
|
+
try {
|
|
303
|
+
// This runs 'npm install' directly in the user's terminal
|
|
304
|
+
execSync(`npm install ${depList}`, { stdio: "inherit" });
|
|
305
|
+
console.log(
|
|
306
|
+
chalk.green("ā Dependencies installed successfully."),
|
|
307
|
+
);
|
|
308
|
+
} catch (err) {
|
|
309
|
+
console.log(
|
|
310
|
+
chalk.red(
|
|
311
|
+
"ā Failed to install dependencies. You may need to install them manually.",
|
|
312
|
+
),
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
281
317
|
console.log(chalk.blue("\nš Components installed successfully!"));
|
|
282
318
|
} catch (error) {
|
|
283
319
|
console.log(chalk.red(`\nFailed to add components:`));
|