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gBAAiB,EACjB,qBAAsB,EACtB,yBAA0B,EAC1B,sBAAuB,GAGX,MAAM,WAAY,CAAC,GAAU,CAAE,MAAO,UAAW,IAAK,QAAQ,MAAO,QAE7E,GAAG,SAAU,IACJ,IAAT,GACA,QAAQ,MAAM,oCAAoC,IACtD,GACF,IAGN,QAAQ,IAAI,kCAChB,IAGJ,QAlEiD,CACvC,SAAS,OAAO,CACtB,CACI,KAAM,UACN,KAAM,UACN,QAAS,yEACT,SAAS,KAEd,MAAK,IACA,EAAQ,QACR,IAEA,QAAQ,IAAI,uBAChB,GAER,CAqDJ,CAvGA,OAAO,OAAO,CACV,KAAM,UAwGV,MAAM,KAAO,QAAQ,KAAK,MAAM,GAC1B,QAAU,KAAK,GACf,YAAc,KAAK,MAAM,GAK/B,OAFA,iBAAiB,YAET,SACJ,IAAK,OACL,IAAK,QACL,IAAK,OACL,IAAK,SACL,IAAK,OACL,IAAK,UACL,IAAK,eACL,IAAK,OACD,eAAe,QAAS,aACxB,MAEJ,QACI,eAAe","file":"/npm/wpdock@1.2.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/wpdock@1.2.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\n\nimport { exec, spawn } from 'child_process';\nimport fs from 'fs';\nimport path from 'path';\nimport inquirer from 'inquirer';\nimport dotenv from 'dotenv';\n\nconst scriptPath = path.join(path.dirname(new URL(import.meta.url).pathname), 'wpdock.sh');\n\n// get the .env file from current project directory under the subfolder .wpdock is the .env file\nconst envPath = path.join(process.cwd(), '.wpdock', '.env');\n\ndotenv.config({\n    path: envPath\n});\n\nfunction ensureExecutable(filePath) {\n    try {\n        const stats = fs.statSync(filePath);\n        const isExecutable = (stats.mode & 0o111) !== 0; // Check if any execute bit is set\n        if (!isExecutable) {\n            fs.chmodSync(filePath, '755');\n            console.log(`${filePath} is now executable.`);\n        }\n    } catch (err) {\n        console.error(`Failed to check or set executable permission for ${filePath}: ${err.message}`);\n        process.exit(1);\n    }\n}\n\nfunction executeCommand(command, args = [], options = {}) {\n    const fullCommand = `${scriptPath} ${command} ${args.join(' ')}`;\n    const runCommand = () => {\n        const child = spawn(fullCommand, {\n            shell: true,\n            stdio: 'inherit',\n            cwd: process.cwd(),\n            env: { ...process.env, ...options.env }\n        });\n\n        child.on('close', (code) => {\n            if (code !== 0) {\n                console.error(`${command} command exited with code ${code}`);\n            }\n        });\n    };\n\n    if (command === 'init' && !options.skipConfirmation) {\n        const i = inquirer.prompt([\n            {\n                type: 'confirm',\n                name: 'confirm',\n                message: 'This will copy files to the current directory. Do you want to proceed?',\n                default: false\n            }\n        ]).then(answers => {\n            if (answers.confirm) {\n                runCommand();\n            } else {\n                console.log('Operation cancelled.');\n            }\n        });\n    } else if (command === 'install') {\n        exec(`${scriptPath} checkinstall`, { cwd: process.cwd() }, (error, stdout, stderr) => {\n            if (error) {\n                console.error(`Error checking WordPress installation: ${error.message}`);\n                return;\n            }\n            if (stdout.includes('WordPress is not installed.')) {\n                inquirer.prompt([\n                    {\n                        type: 'input',\n                        name: 'title',\n                        message: 'Site Title:'\n                    },\n                    {\n                        type: 'input',\n                        name: 'admin_user',\n                        message: 'Admin Username:'\n                    },\n                    {\n                        type: 'password',\n                        name: 'admin_password',\n                        message: 'Admin Password:'\n                    },\n                    {\n                        type: 'input',\n                        name: 'admin_email',\n                        message: 'Admin Email:'\n                    }\n                ]).then(answers => {\n                    const { title, admin_user, admin_password, admin_email } = answers;\n                    const env = {\n                        ...process.env,\n                        WORDPRESS_TITLE: title,\n                        WORDPRESS_ADMIN_USER: admin_user,\n                        WORDPRESS_ADMIN_PASSWORD: admin_password,\n                        WORDPRESS_ADMIN_EMAIL: admin_email\n                    };\n\n                    const install = spawn(scriptPath, [command], { stdio: 'inherit', cwd: process.cwd(), env });\n\n                    install.on('close', (code) => {\n                        if (code !== 0) {\n                            console.error(`install command exited with code ${code}`);\n                        }\n                    });\n                });\n            } else {\n                console.log('WordPress is already installed.');\n            }\n        });\n    } else {\n        runCommand();\n    }\n}\n\nconst args = process.argv.slice(2);\nconst command = args[0];\nconst commandArgs = args.slice(1);\n\n// Ensure the script is executable once\nensureExecutable(scriptPath);\n\nswitch (command) {\n    case 'init':\n    case 'start':\n    case 'stop':\n    case 'delete':\n    case 'bash':\n    case 'install':\n    case 'checkinstall':\n    case 'cron':\n        executeCommand(command, commandArgs);\n        break;\n    case '--help':\n    default:\n        executeCommand('--help');\n        break;\n}\n"]}