mongossee 1.0.25 → 1.0.27
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 +14 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -28,11 +28,12 @@ async function generateProject(prompt, directoryName) {
|
|
|
28
28
|
- For DSA/Logic, choose Java, Python, or C++ based on context.
|
|
29
29
|
3. TYPESCRIPT RULES: If using TypeScript, define proper Interfaces/Types for Props and State. No "any" type.
|
|
30
30
|
4. ⛔ NO EXTRA BLOAT: In package.json, include ONLY strictly necessary dependencies (e.g., react, react-dom, react-scripts).
|
|
31
|
-
5. ❌ REMOVE FALTU STUFF: Do NOT include @testing-library, web-vitals, or eslintConfig.
|
|
31
|
+
5. ❌ REMOVE FALTU STUFF: Do NOT include @testing-library, web-vitals, or eslintConfig.
|
|
32
32
|
6. ⛔ ZERO COMMENTS: Return strictly functional code. No // or /* */ comments, and no explanations.
|
|
33
33
|
7. 📁 ARCHITECTURE: If the prompt mentions Parent/Child or Props, strictly follow React best practices (state in parent, props to child, arrow functions for events).
|
|
34
34
|
8. 📄 FORMAT: Return ONLY a valid JSON array of objects: [{"filename": "string", "code": "string"}].
|
|
35
35
|
9. 🚫 NO MARKDOWN: Do not wrap the response in \`\`\`json blocks.
|
|
36
|
+
10. IMPORTANT: I need 'Pretty-Printed' code. Use multi-line formatting. Single-line code is strictly forbidden.
|
|
36
37
|
`
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -90,8 +91,19 @@ async function generateProject(prompt, directoryName) {
|
|
|
90
91
|
fs.mkdirSync(fileDir, { recursive: true });
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
let formattedCode = file.code;
|
|
95
|
+
|
|
96
|
+
if (typeof formattedCode === 'string') {
|
|
97
|
+
formattedCode = formattedCode
|
|
98
|
+
.replace(/\\\\/g, '\\') // Double backslash ko single banaya
|
|
99
|
+
.replace(/\\r/g, '') // Carriage returns hatao
|
|
100
|
+
.replace(/\\n/g, '\n') // Double backslash ko newline banao
|
|
101
|
+
.replace(/\\t/g, ' ') // Tabs ko spaces banao
|
|
102
|
+
.replace(/\\"/g, '"'); // Escaped quotes ko sahi karo
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
// Write the code to the file
|
|
94
|
-
fs.writeFileSync(filePath,
|
|
106
|
+
fs.writeFileSync(filePath, formattedCode);
|
|
95
107
|
//console.log(`Created file: ${filePath}`);
|
|
96
108
|
}
|
|
97
109
|
|