{"version":3,"file":"index.cjs","sources":["../../src/init/index.js","../../src/index.js"],"sourcesContent":["import fs from 'fs';\nimport Path from 'path';\nimport { createModule } from './create-module.js';\n/**\n  * init main structure for modules.\n  * @param name   - name of  main module .\n  * @param path   - path for init module , by defulte (./) \n  * @param isAuth - if need to add auth module\n  */\nexport const initModules = (name, path, isAuth, i18n) => {\n  // main module dir\n  const modulePath = Path.resolve(process.cwd(), path, \"modules\");\n  ///////////////////////////////////////////////////////////\n  // recursive : true for not throw error in dir not exest \n  // if not exest it will add in parent dir\n  ///////////////////////////////////////////////////////\n  fs.mkdirSync(modulePath, { recursive: true });\n  // app module-\n  // create main module\n  const main_module_conf = {\n    targetPath: `${path}/modules`,\n    moduleName: name,\n    isPages: false,\n    isStore: true,\n    isLayout: true,\n    i18n: i18n\n  }\n  createModule(main_module_conf)\n  // create auth module if needed\n  if (isAuth) {\n    const auth_conf = {\n      targetPath: `${path}/modules`,\n      moduleName: \"auth\",\n      isPages: true,\n      isStore: true,\n      isLayout: true,\n      i18n: i18n\n    }\n    createModule(auth_conf)\n  }\n}","// init structure module to be a parent of modules\n\nimport readline from \"readline\"\nimport { initModules } from \"./init/index.js\";\nconst args = process.argv.slice(2);\nlet path = args[0] ? args[0] : './'\nconst rl = readline.createInterface({\n    input: process.stdin,\n    output: process.stdout\n});\nlet main_module_name = \"app\"\nlet hasAuth = true\n\n\nconst askQuestion = (question) => {\n    return new Promise((resolve) => rl.question(question, resolve));\n}\n// ask for main module app\n// ask for if need auth module\nconst askForInput = async () => {\n    let name = await askQuestion('Name of main module (default : app) : =>');\n    name ? main_module_name = name : main_module_name = 'app'\n    let auth = await askQuestion('are u need auth module (defulte : yes) :=>');\n    // auth ? hasAuth = auth : hasAuth = \"yes\"\n    if (auth.toLowerCase() === 'yes') {\n        hasAuth = true\n    } else if (auth.toLowerCase() === 'no') {\n        hasAuth = false\n    } else {\n        hasAuth = true\n    }\n    initModules(main_module_name, path, hasAuth, args.includes('i18n'))\n    rl.close();\n};\naskForInput();"],"names":["args","process","argv","slice","path","rl","readline","createInterface","input","stdin","output","stdout","main_module_name","hasAuth","askQuestion","question","Promise","resolve","async","name","auth","toLowerCase","isAuth","i18n","modulePath","Path","cwd","fs","mkdirSync","recursive","main_module_conf","targetPath","moduleName","isPages","isStore","isLayout","createModule","auth_conf","initModules","includes","close","askForInput"],"mappings":"mHASO,MCLDA,EAAOC,QAAQC,KAAKC,MAAM,GAChC,IAAIC,EAAOJ,EAAK,GAAKA,EAAK,GAAK,KAC/B,MAAMK,EAAKC,EAASC,gBAAgB,CAChCC,MAAOP,QAAQQ,MACfC,OAAQT,QAAQU,SAEpB,IAAIC,EAAmB,MACnBC,GAAU,EAGd,MAAMC,EAAeC,GACV,IAAIC,SAASC,GAAYZ,EAAGU,SAASA,EAAUE,KAItCC,WAChB,IAAIC,QAAaL,EAAY,4CACtBF,EAAPO,GAAoD,MACpD,IAAIC,QAAaN,EAAY,8CAGzBD,EADuB,QAAvBO,EAAKC,eAEyB,OAAvBD,EAAKC,cDjBO,EAACF,EAAMf,EAAMkB,EAAQC,KAE9C,MAAMC,EAAaC,EAAKR,QAAQhB,QAAQyB,MAAOtB,EAAM,WAKrDuB,EAAGC,UAAUJ,EAAY,CAAEK,WAAW,IAGtC,MAAMC,EAAmB,CACvBC,WAAY,GAAG3B,YACf4B,WAAYb,EACZc,SAAS,EACTC,SAAS,EACTC,UAAU,EACVZ,KAAMA,GAIR,GAFAa,EAAAA,aAAaN,GAETR,EAAQ,CACV,MAAMe,EAAY,CAChBN,WAAY,GAAG3B,YACf4B,WAAY,OACZC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVZ,KAAMA,GAERa,EAAAA,aAAaC,EACd,GCRCC,CAAY1B,EAAkBR,EAAMS,EAASb,EAAKuC,SAAS,SAC3DlC,EAAGmC,OAAO,EAEdC"}