pejay-ui 1.2.0 → 1.2.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 (2) hide show
  1. package/bin/cli.js +17 -4
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -156,10 +156,23 @@ program
156
156
  }
157
157
 
158
158
  if (missingDependencies.length > 0) {
159
- console.error(`Error: Missing required package dependencies to use '${compToInstall}':`);
160
- console.log(`Please run the following command to install them first:`);
161
- console.log(`\n npm install ${missingDependencies.join(" ")}\n`);
162
- process.exit(1);
159
+ console.log(`Missing required package dependencies: ${missingDependencies.join(", ")}`);
160
+ console.log(`Installing missing dependencies...`);
161
+
162
+ let installCmd = `npm install ${missingDependencies.join(" ")}`;
163
+ if (await fs.pathExists(path.join(cwd, "yarn.lock"))) {
164
+ installCmd = `yarn add ${missingDependencies.join(" ")}`;
165
+ } else if (await fs.pathExists(path.join(cwd, "pnpm-lock.yaml"))) {
166
+ installCmd = `pnpm add ${missingDependencies.join(" ")}`;
167
+ }
168
+
169
+ try {
170
+ execSync(installCmd, { cwd, stdio: "inherit" });
171
+ console.log(`\nDependencies installed successfully!\n`);
172
+ } catch (error) {
173
+ console.error(`\nFailed to automatically install dependencies. Please run: ${installCmd}`);
174
+ process.exit(1);
175
+ }
163
176
  }
164
177
 
165
178
  // 2. Process & Copy Utility dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pejay-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "description": "react ui components",
6
6
  "bin": {