| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/usr/bin/env node
- /* eslint-disable */
- const fs = require("fs");
- const path = require("path");
- console.log("NCore UI Kit - Mobile Kurulumu");
- console.log("==============================");
- const targetDir = process.cwd();
- const targetPath = path.resolve(targetDir, "metro.config.js");
- if (fs.existsSync(targetPath)) {
- let content = fs.readFileSync(targetPath, "utf-8");
- if (!content.includes("withNCoreUIKit")) {
- content = "const { withNCoreUIKit } = require(\"ncore-ui-kit/metro-config\");\n" + content;
- if (/module\.exports\s*=\s*\{/.test(content)) {
- content = content.replace(/module\.exports\s*=\s*\{/g, "const _ncoreMetroConfig = {");
- content += "\nmodule.exports = withNCoreUIKit(_ncoreMetroConfig);\n";
- fs.writeFileSync(targetPath, content);
- console.log("✅ metro.config.js başarıyla güncellendi.");
- }
- else if (/module\.exports\s*=\s*([^;]+);?/.test(content)) {
- content = content.replace(/module\.exports\s*=\s*([^;]+);?/g, "module.exports = withNCoreUIKit($1);");
- fs.writeFileSync(targetPath, content);
- console.log("✅ metro.config.js başarıyla güncellendi.");
- } else {
- console.log("⚠️ metro.config.js formatı anlaşılamadı. Lütfen config objesini withNCoreUIKit ile manuel olarak sarmalayın.");
- }
- } else {
- console.log("✅ metro.config.js zaten ayarlı.");
- }
- } else {
- console.log("⚠️ metro.config.js bulunamadı. Mobile projesi değilse bu adımı atlayabilirsiniz.");
- }
|