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AAU,KAAK,MAAM,QAC1B,KAAK,SAAW,KAAK,MAAM,SAC3B,KAAK,YAAc,KAAK,MAAM,YAC9B,KAAK,cAAgB,KAAK,kBAC1B,KAAK,UAAY,KAAK,MAAM,UAK5B,KAAK,IAAI,YAAY,KAAK,YAC1B,KAAK,IAAI,eAAe,KAAK,eAC7B,KAAK,IAAI,iBAAiB,KAAK,iBAEI,aAA/B,KAAK,MAAM,gBACX,KAAK,YAAY,QAAQ,QAAQ,gBACK,SAA/B,KAAK,MAAM,gBAClB,KAAK,YAAY,QAAQ,QAAQ,YAEjC,KAAK,YAAY,QAAQ,QAAQ,aAIrC,KAAK,WAAa,OAAO,KAAK,MAAM,cAAc,KAAK,MAAM,OAE7D,IACI,KAAK,eAAe,8BAA+B,SAAU,OAAQ,SAAU,qIACnF,CAAE,MAAO,GACL,KAAK,IAAI,GAAG,MAAM,IAAI,KAAK,2EAC/B,CACJ,CAEA,OAAA,GACI,KAAK,aAAa,KAAM,CAAC,cAAe,GAAG,KAAK,cAChD,KAAK,aAAa,QAAS,MAAO,CAAC,cAAe,GAAG,KAAK,aAC9D,CAEA,GAAA,GACI,KAAK,IAAI,qCACb","file":"/npm/generator-jhipster-kutilang@0.0.16/generators/app/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/generator-jhipster-kutilang@0.0.16/generators/app/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","const chalk = require('chalk');\n// const semver = require('semver');\nconst shelljs = require('shelljs');\nconst BaseGenerator = require('generator-jhipster/generators/generator-base');\n// const jhipsterConstants = require('generator-jhipster/generators/generator-constants');\nconst packagejs = require('../../package.json');\n\n\nmodule.exports = class extends BaseGenerator {\n    get initializing() {\n        return {\n            init(args) {\n                if (args === 'default') {\n                    // do something when argument is 'default'\n                }\n            },\n            readConfig() {\n                //  this.jhipsterAppConfig = this.getAllJhipsterConfig();\n                /*  if (!this.jhipsterAppConfig) {\n                    this.error('Can\\'t read .yo-rc.json');\n                }  */\n                // this.log(this.destinationRoot());\n            },\n            displayLogo() {\n                this.log(`${chalk.bold.cyan('_          _   _ _                   ')}`);\n                this.log(`${chalk.bold.cyan('| |        | | (_) |                  ')}`);\n                this.log(`${chalk.bold.cyan('| | ___   _| |_ _| | __ _ _ __   __ _ ')}`);\n                this.log(`${chalk.bold.cyan('| |/ / | | | __| | |/ _` | \\'_ \\\\ / _` |')}`);\n                this.log(`${chalk.bold.cyan('|   <| |_| | |_| | | (_| | | | | (_| |')}`);\n                this.log(`${chalk.bold.cyan('|_\\\\_\\\\\\\\__,_|\\\\__|_|_|\\\\__,_|_| |_|\\\\__,  |')}`);\n                this.log(`${chalk.bold.cyan('                                 __/ |')}`);\n                this.log(`${chalk.bold.cyan('                                |___/ ')}`);\n                this.log(`\\nWelcome to the ${chalk.bold.yellow('Flutter Apps')} generator! ${chalk.yellow(`v${packagejs.version}\\n`)}`);\n            },\n        };\n    }\n\n    prompting() {\n        /* this.getExistingEntities().forEach((entity) => {\n            this.log(entity.name);\n            this.log(entity);\n        }); */\n        // this.log(this.auditedEntities[0]);\n        const appsName = this.getDefaultAppName();\n\n        const prompts = [\n            {\n                type: 'input',\n                name: 'appsName',\n                message: 'What is your Flutter application name?',\n                default: appsName,\n                store: true\n            },\n            {\n                type: 'input',\n                name: 'directoryPath',\n                message: 'Where JHipster app directory is located?',\n                default: 'backend',\n                store: true,\n                validate: (input) => {\n                    const path = this.destinationPath(input);\n                    if (shelljs.test('-d', path)) {\n                        const appsFolders = getAppFolder.call(this, input);\n                        if (appsFolders.length === 0) {\n                            return `No application found in ${path}`;\n                        }\n                        return true;\n                    }\n                    return `${path} is not a directory or doesn't exist`;\n                }\n            },\n            {\n                type: 'input',\n                name: 'packageName',\n                validate: input => (/^([a-z_]{1}[a-z0-9_]*(\\.[a-z_]{1}[a-z0-9_]*)*)$/.test(input) ? true : 'The package name you have provided is not a valid Java package name.'),\n                message: 'What is your package name?',\n                // default: this.jhipsterAppConfig.packageName,\n                store: true\n            },\n            {\n                type: 'list',\n                name: 'android',\n                message: 'Which Android native code do you want to use?',\n                choices: [\n                    {\n                        value: 'kotlin',\n                        name: 'Kotlin'\n                    },\n                    {\n                        value: 'java',\n                        name: 'Java'\n                    },\n                ],\n                default: 'kotlin'\n            },\n            {\n                type: 'list',\n                name: 'ios',\n                message: 'Which iOS native code do you want to use?',\n                choices: [\n                    {\n                        value: 'swift',\n                        name: 'Swift'\n                    },\n                    {\n                        value: 'objc',\n                        name: 'Objective-C'\n                    },\n                ],\n                default: 'swift'\n            },\n            {\n                type: 'list',\n                name: 'stateManageType',\n                message: 'Which State-Management style do you want to use?',\n                choices: [\n                    /*  {\n                         value: 'basic',\n                         name: 'Basic state-management'\n                     },\n                     {\n                         value: 'provider',\n                         name: 'Provider state-management'\n                     }, */\n                    {\n                        value: 'mobx',\n                        name: 'MobX state-management'\n                    },\n\n                ],\n                default: 'basic'\n            },\n        ];\n\n        const done = this.async();\n        this.prompt(prompts).then((props) => {\n            this.props = props;\n            done();\n        });\n    }\n\n    get configuring() {\n        return {\n            saveConfig() {\n                this.config.set('appsName', this.props.appsName);\n                this.config.set('packageName', this.props.packageName);\n                this.config.set('directoryPath', `${this.props.directoryPath}`);\n                this.config.set('packageFolder', `${this.props.appsName}`);\n                this.config.set('android', this.props.android);\n                this.config.set('ios', this.props.ios);\n                this.config.set('stateManageType', this.props.stateManageType);\n            }\n        };\n    }\n\n    writing() {\n        const fromPath = `${this.props.directoryPath}/.yo-rc.json`;\n        this.log(fromPath);\n        this.jhipsterAppConfig = this.fs.readJSON(fromPath)['generator-jhipster'];\n\n        // function to use directly template\n        this.template = function (source, destination) {\n            this.fs.copyTpl(\n                this.templatePath(source),\n                this.destinationPath(destination),\n                this\n            );\n        };\n\n        this.message = this.props.message;\n        this.baseName = this.props.appsName;\n        this.packageName = this.props.packageName;\n        this.packageFolder = this.destinationRoot();\n        this.buildTool = this.props.buildTool;\n\n        // variable from questions\n        // show all variables\n        // this.log('\\n--- some config read from config ---');\n        this.log(`baseName=${this.baseName}`);\n        this.log(`packageName=${this.packageName}`);\n        this.log(`packageFolder=${this.packageFolder}`);\n\n        if (this.props.stateManageType === 'provider') {\n            this.composeWith(require.resolve('../provider'));\n        } else if (this.props.stateManageType === 'mobx') {\n            this.composeWith(require.resolve('../mobx'));\n        } else {\n            this.composeWith(require.resolve('../basic'));\n        }\n\n        // variable for native code\n        this.nativeCode = ` -a ${this.props.android} -i ${this.props.ios} `;\n\n        try {\n            this.registerModule('generator-jhipster-kutilang', 'entity', 'post', 'entity', 'Generate Mobile (iOS/Andoird), Web and Desktop(Linux, MacOS, Windows) Apps using Flutter & Dart Language and JHipster as a backend');\n        } catch (err) {\n            this.log(`${chalk.red.bold('WARN!')} Could not register as a jhipster entity post creation hook...\\n`);\n        }\n    }\n\n    install() {\n        this.spawnCommand('mv', ['.yo-rc.json', `${this.baseName}/`]);\n        this.spawnCommand('chmod', 'a+x', ['run_watcher', `${this.baseName}/`]);\n    }\n\n    end() {\n        this.log('Finish generated kutilang packages');\n    }\n};\n\n\n/**\n * Get App Folders\n * @param input path to join to destination path\n * @returns {Array} array of string representing app folders\n */\nfunction getAppFolder(input) {\n    const destinationPath = this.destinationPath(input);\n    const appsFolders = [];\n\n    if (shelljs.test('-f', `${destinationPath}/.yo-rc.json`)) {\n        try {\n            const fileData = this.fs.readJSON(`${destinationPath}/.yo-rc.json`);\n            if (fileData['generator-jhipster'].baseName !== undefined) {\n                appsFolders.push(destinationPath);\n            }\n        } catch (err) {\n            this.log(chalk.red(`The .yo-rc.json in ${destinationPath} can't be read!`));\n            this.debug('Error:', err);\n        }\n    }\n\n    return appsFolders;\n}\n"]}