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gB,EAAK,GAIjB,KAAK,GAAG,KACJ,KAAK,aAAa,gBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,SAExC,KAAK,GAAG,KACJ,KAAK,aAAa,mBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,UAExC,KAAK,GAAG,KACJ,KAAK,aAAa,kBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,SAExC,KAAK,GAAG,KACJ,KAAK,aAAa,iBAClB,KAAK,gBAAgB,IAIzB,KAAK,GAAG,QACJ,KAAK,aAAa,iBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,MAAO,eAC3C,GAGJ,KAAK,GAAG,QACJ,KAAK,aAAa,mBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,iBACpC,EAyBR,CACA,eAAA,CAAgB,EAAK,GAEjB,KAAK,GAAG,QACJ,KAAK,aAAa,iBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,MAAO,eAC3C,GAGJ,KAAK,GAAG,QACJ,KAAK,aAAa,wBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,MAAO,KAAM,QAAQ,EAAK,eAC9D,GAGJ,KAAK,GAAG,KACJ,KAAK,aAAa,sBAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,MAAO,aAG/C,KAAK,GAAG,QACJ,KAAK,aAAa,2BAClB,KAAK,gBAAgB,KAAK,KAAK,EAAK,MAAO,QAAS,QAAQ,EAAK,WAAW,EAAK,gBACjF,EAER","file":"/npm/generator-axapp@0.0.8/app/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/generator-axapp@0.0.8/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","\"use strict\";\n\nconst _ = require(\"lodash\");\nconst Path = require(\"path\");\nconst Beautify = require(\"gulp-jsbeautifier\");\nconst Generators = require(\"yeoman-generator\");\n\nconst DEFAULT_APPNAME = \"axapp\";\n\nmodule.exports = class extends Generators {\n    constructor(args, opts) {\n        super(args, opts);\n        // argument appname is not required\n        this.argument(\"appname\", {\n            desc: \"project name\",\n            type: String,\n            required: false\n        });\n        // current选项代表是否在当前目录文件夹中创建项目\n        this.option(\"current\", {\n            desc: \"generate app in current folder\",\n            type: Boolean,\n            alias: \"c\",\n            required: false,\n            default: false\n        });\n    }\n    initializing() {\n        // 美化输出文件格式\n        this.registerTransformStream(Beautify());\n    }\n    prompting() {\n        let prompts = [{\n            type: \"list\",\n            name: \"templateType\",\n            message: \"Which template would you like to generate:\",\n            choices: [{\n                name: \"Single Page Application\",\n                value: \"spa\"\n            }, {\n                name: \"Vue Application\",\n                value: \"vue\"\n            }, {\n                name: \"MultiPage Application\",\n                value: \"mpa\"\n            }],\n            default: 0\n        }];\n        // 如果没有指定appname则提示用户输入\n        !this.options.appname && prompts.unshift({\n            type: \"input\",\n            name: \"appname\",\n            message: \"Input your project\\\"s name\",\n            default: DEFAULT_APPNAME,\n            validate: (name) => {\n                return !/\\s+/.test(name.trim());\n            }\n        });\n\n        prompts = prompts.concat(require(\"./_prompts/_js.js\"))\n        .concat(require(\"./_prompts/_style.js\"));\n\n        return this.prompt(prompts).then((res) => {\n            let appname = res.appname || this.options.appname;\n            let options = Object.assign({}, res, {\n                appname\n            });\n            // dependencies\n            this.pkg = options.templateType === \"vue\" ? [\"vue\", \"vuex\", \"vue-router\", \"vue-axios\", \"vue-template-compiler\"] : [];\n            // 渲染配置项\n            this.renderOpts = options;\n        });\n    }\n    writing() {\n        this._renderTpl(this.renderOpts);\n    }\n    install() {\n        if (!this.options.current) {\n            process.chdir(Path.join(process.cwd(), this.options.appname));\n        }\n\n        this.installDependencies({ bower: false });\n    }\n    end() {}\n    /**\n     * @method\n     * @private\n     * @desc 根据用户配置将template模板render成对应的文件类型\n     * @param  {Object} opts 用户配置项\n     */\n    _renderTpl(opts) {\n        const DestFolder = this.options.current ? \"\" : Path.join(this.options.appname, \"/\");\n\n        // 生成ax.conf.js文件\n        this.fs.copyTpl(\n            this.templatePath(\"ax.conf.ejs\"),\n            this.destinationPath(Path.join(DestFolder, \"ax.conf.js\")),\n            opts\n        );\n        // 生成ax.mock.js文件\n        // this.fs.copyTpl(\n        //     this.templatePath(\"ax.mock.js\"),\n        //     this.destinationPath(Path.join(DestFolder, \"ax.mock.js\"))\n        // );\n        // 复制静态资源\n        this.fs.copy(\n            this.templatePath(\"_assets/**/*\"),\n            this.destinationPath(Path.join(DestFolder, \"src\", \"assets\"))\n        );\n        // 复制gitignore配置文件\n        this.fs.copy(\n            this.templatePath(\"gitignore\"),\n            this.destinationPath(Path.join(DestFolder, \".gitignore\"))\n        );\n        switch (opts.templateType) {\n            case \"spa\":\n                this._renderTplOfSpa(DestFolder, opts);\n                break;\n            case \"mpa\":\n                this._renderTplOfMpa(DestFolder, opts);\n                break;\n            case \"vue\":\n                this._renderTplOfVue(DestFolder, opts);\n                break;\n        }\n    }\n    _renderTplOfMpa(dir, opts) {\n        // 生成index.html文件\n        this.fs.copyTpl(\n            this.templatePath(\"mpa/index.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", `index.html`)),\n            opts\n        );\n        // 生成about.html文件\n        this.fs.copyTpl(\n            this.templatePath(\"mpa/index.about.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", `index.about.html`)),\n            opts\n        );\n        // 生成main.app.js文件\n        this.fs.copyTpl(\n            this.templatePath(\"mpa/_js/main.app.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", \"js\", `main.${opts.appname}.js`)),\n            opts\n        );\n        // 生成main.about.js文件\n        this.fs.copyTpl(\n            this.templatePath(\"mpa/_js/main.about.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", \"js\", `main.about.js`)),\n            opts\n        );\n        // 复制part文件\n        this.fs.copy(\n            this.templatePath(\"mpa/_js/part/**.js\"),\n            this.destinationPath(Path.join(dir, \"src\", \"js/part\"))\n        );\n        // 生成main.app.css文件\n        this.fs.copyTpl(\n            this.templatePath(\"mpa/_style/main.app.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", \"style\", `main.${opts.appname}.${opts.styleSyntax}`)),\n            opts\n        );\n        // 生成main.about.css文件\n        this.fs.copyTpl(\n            this.templatePath(\"mpa/_style/main.about.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", \"style\", `main.about.${opts.styleSyntax}`)),\n            opts\n        );\n    }\n    _renderTplOfVue(dir, opts) {\n        /**\n         * 文档：https://github.com/SBoudrias/mem-fs-editor\n         */\n        this.fs.copy(\n            this.templatePath(\"vue/src/**/*\"),\n            this.destinationPath(Path.join(dir, \"src\"))\n        );\n        this.fs.copy(\n            this.templatePath(\"vue/dist/{*,.*}\"),\n            this.destinationPath(Path.join(dir, \"dist\"))\n        );\n        this.fs.copy(\n            this.templatePath(\"vue/dll/{*,.*}\"),\n            this.destinationPath(Path.join(dir, \"dll\"))\n        );\n        this.fs.copy(\n            this.templatePath(\"vue/{.*,*.sh}\"),\n            this.destinationPath(dir)\n        );\n\n        // 生成html文件\n        this.fs.copyTpl(\n            this.templatePath(\"vue/index.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", \"index.html\")),\n            opts\n        );\n        // 生成 package.json\n        this.fs.copyTpl(\n            this.templatePath(\"vue/package.ejs\"),\n            this.destinationPath(Path.join(dir, \"package.json\")),\n            opts\n        );\n        // 生成js文件\n        // this.fs.copyTpl(\n        //     this.templatePath(\"vue/_js/main.app.ejs\"),\n        //     this.destinationPath(Path.join(dir, \"src\", \"js\", `main.${opts.appname}.js`)),\n        //     opts\n        // );\n        // // 生成vue文件\n        // this.fs.copyTpl(\n        //     this.templatePath(\"vue/_js/App.vue.ejs\"),\n        //     this.destinationPath(Path.join(dir, \"src\", \"js\", `App.vue`)),\n        //     opts\n        // );\n        // // 复制part文件\n        // this.fs.copy(\n        //     this.templatePath(\"vue/_js/part/**.js\"),\n        //     this.destinationPath(Path.join(dir, \"src\", \"js/part\"))\n        // );\n        // // 生成style文件\n        // this.fs.copyTpl(\n        //     this.templatePath(\"vue/_style/main.app.ejs\"),\n        //     this.destinationPath(Path.join(dir, \"src\", \"style\", `main.${opts.appname}.${opts.styleSyntax}`)),\n        //     opts\n        // );\n    }\n    _renderTplOfSpa(dir, opts) {\n        // 生成html文件\n        this.fs.copyTpl(\n            this.templatePath(\"spa/index.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", `index.html`)),\n            opts\n        );\n        // 生成js文件\n        this.fs.copyTpl(\n            this.templatePath(\"spa/_js/main.app.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", \"js\", `main.${opts.appname}.js`)),\n            opts\n        );\n        // 复制part文件\n        this.fs.copy(\n            this.templatePath(\"spa/_js/part/**.js\"),\n            this.destinationPath(Path.join(dir, \"src\", \"js/part\"))\n        );\n        // 生成style文件\n        this.fs.copyTpl(\n            this.templatePath(\"spa/_style/main.app.ejs\"),\n            this.destinationPath(Path.join(dir, \"src\", \"style\", `main.${opts.appname}.${opts.styleSyntax}`)),\n            opts\n        );\n    }\n};"]}