mongossee 1.0.21 → 1.0.22

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/index.js +18 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,6 +4,7 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const yargs = require('yargs/yargs');
6
6
  const { hideBin } = require('yargs/helpers');
7
+ const { execSync } = require('child_process');
7
8
 
8
9
 
9
10
  const SERVER_URL = "https://mongossee.vercel.app/api/server";
@@ -72,6 +73,23 @@ async function generateProject(prompt, directoryName) {
72
73
  //console.log(`Created file: ${filePath}`);
73
74
  }
74
75
 
76
+ const hasPackageJson = files.some(file => file.filename === 'package.json');
77
+
78
+
79
+ if (hasPackageJson) {
80
+ console.log(`šŸ“¦ package.json detected. Installing dependencies...`);
81
+ try {
82
+ // Folder ke andar jaakar npm install chalao
83
+ execSync('npm install', {
84
+ cwd: directoryName,
85
+ stdio: 'inherit' // Taaki installation progress dikhe
86
+ });
87
+ console.log(`\nāœ… All dependencies installed!`);
88
+ } catch (err) {
89
+ console.error(`\nāš ļø NPM Install failed. Please run 'npm install' manually inside "${directoryName}".`);
90
+ }
91
+ }
92
+
75
93
  // console.log(`\n Project "${directoryName}" created successfully!`);
76
94
 
77
95
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongossee",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {