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