{"id":19840403,"url":"https://github.com/heyui/hey-cli","last_synced_at":"2025-04-09T15:02:02.170Z","repository":{"id":14723663,"uuid":"76939842","full_name":"heyui/hey-cli","owner":"heyui","description":"hey-cli, webpack scaffolding，hot-dev-server，build","archived":false,"fork":false,"pushed_at":"2022-12-10T12:47:16.000Z","size":3769,"stargazers_count":161,"open_issues_count":13,"forks_count":25,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-01T22:17:23.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heyui.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-20T08:51:39.000Z","updated_at":"2024-06-26T07:26:35.000Z","dependencies_parsed_at":"2023-01-13T18:05:09.836Z","dependency_job_id":null,"html_url":"https://github.com/heyui/hey-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyui%2Fhey-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyui%2Fhey-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyui%2Fhey-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyui%2Fhey-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyui","download_url":"https://codeload.github.com/heyui/hey-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055272,"owners_count":21040153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T12:26:46.354Z","updated_at":"2025-04-09T15:02:02.154Z","avatar_url":"https://github.com/heyui.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hey-cli\nWebpack scaffolding, hot-dev-server, build.  \nDo not need to understand webpack, only need to know how to configure it to use, get rid of cumbersome duplication of webpack configuration.\n\n## 中文文档\n此处有[中文文档](https://github.com/heyui/hey-cli/blob/master/README_zh.md)\n\n\n## Advantage\n- Global installation, all development projects are supported, do not need to install and configure each project webpack.    \n- Support \u003ccode\u003eES6\u003c/code\u003e\n- Support Hot Module Replacement\n- Support Http Proxy\n- Default support \u003ccode\u003evue2.0\u003c/code\u003e, support \u003ccode\u003ereact\u003c/code\u003e\n- Support the global less parameter definition\n- Build UMD mode code\n- Only need to configure \u003ccode\u003ehey.conf.js\u003c/code\u003e configuration file\n\n## Installation\n\n```sh\nnpm install -g hey-cli\n\n# new version npm\nsudo npm install -g hey-cli --unsafe-perm=true --allow-root\n\n```\n\n## Configuration\n\nAdd the hey.conf.js configuration file in the project root directory.  \n```js\nmodule.exports = {\n  \"port\": 9002, //Port\n  \"dist\": 'dist', //the root of the build file\n  \"clean\": true, //clean dist folder before build\n  \"timestamp\": false, //the static folder generated by build with the static[timestamp] named folder\n  \"react\": true, //support react project\n  \"openBrowser\": true, // open browser auto\n  \"stat\": true, // Whether to generate stat.json\n  \"webpack\": { //webpack related configuration\n    \"console\": false, //package compression whether to retain the console, the default is false\n    \"publicPath\": \"/\", //public path\n    \"compress\": true / false, // default value depends on build or dev, or you can set compress js when build.\n    \"output\": {\n      // Output what documents, mainly html,\n      // Default setting will load the same js file as the html file name for the entrance. \n      // Support for defining common packages.\n      \"./*.html\": {\n        // Load js file by default, and html automatically references. \n        //If not configured, the same js file as the html file name is automatically\n        \"entry\":\"./src/index.js\"\n      }\n    },\n\n    //define resolve, https://webpack.js.org/configuration/resolve/\n    \"alias\": {\n      components: './src/components/',\n      // You can use import index from 'components/index'  =\u003e src/components/index\n    },\n\n    //define global, https://webpack.js.org/plugins/provide-plugin\n    \"global\": {\n      \"Vue\": \"vue\",\n      \"$\": \"jquery\",\n      \"log\": \"./js/common/log\",\n      // use export default\n      Utils: [path.resolve(__dirname, 'src/js/common/utils'), 'default'],\n    },\n\n    //define proxy, https://webpack.js.org/configuration/dev-server/#devserver-proxy\n    \"devServer\": {\n      \"proxy\": {\n        \"/api\": {\n          \"target\": \"http://yoda:9000\"\n        }\n      },\n      historyApiFallback: true\n    },\n    //define externals, https://webpack.js.org/configuration/externals/\n    \"externals\":{\n\n    },\n\n    //Define the global less parameter definition, you can use the globalVars parameter in any less\n    globalVars: './static/css/var.less',\n  },\n\n  // The files that are not referenced are copied to the packaged folder when build\n  \"copy\": [\n    \"./images/**/*\",\n    \"./help/**/*\",\n    \"./template/**/*\"\n  ]\n};\n```\n\n### Extended Configuration\nYou can expand and configure the following properties in the webpack configuration item in hey.conf.js:  \n- plugins\n- module\n- node\n- externals\n- devServer\n\nSpecific use, please refer to [webpack](https://webpack.js.org/) document.\n\n## Example\n\n### Load vue,vue-router\n\n```json\n\"hey\": {\n  \"port\": 9008,\n  \"timestamp\": true,\n  \"dist\": \"gen\",\n  \"webpack\": {\n    \"publicPath\": \"/\",\n    \"output\": {\n      \"./*.html\": {\n        \"entry\":\"./src/app\"\n      }\n    },\n    \"global\": {\n      \"Vue\": \"vue\"\n    },\n    \"devServer\": {\n      \"historyApiFallback\":true\n    }\n  }\n}\n```\n### External loading vue,vue-router  \n\n```json\n\"hey\": {\n  \"port\": 9008,\n  \"timestamp\": true,\n  \"dist\": \"gen\",\n  \"webpack\": {\n    \"publicPath\": \"/\",\n    \"output\": {\n      \"./*.html\": {\n        \"entry\":\"src/app\"\n      }\n    },\n    \"global\": {\n      \"Vue\": \"vue\"\n    },\n    \"devServer\": {\n      \"historyApiFallback\":true\n    },\n    \"externals\": {\n      \"Vue\": \"window.Vue\",\n      \"VueRouter\": \"window.VueRouter\"\n    }\n  }\n}\n```\n\n### Common code to build UMD mode\nMainly used to build some of the common code, simple configuration can be used.   \n*Because it is a public package packaged into UMD mode, do not use the import mode.*\n\n```js\nmodule.exports = {\n  dist: \"build\",\n  webpack: {\n    umd: {\n      entry: \"./src/index.js\",\n      library: \"Validator\",\n      filename: 'validator.js', //build generation /build/validator.js\n      libraryExport: 'default'\n    },\n    externals: {\n      \"manba\": \"manba\"  //The dependent package will not be packaged into the source code\n    }\n  }\n};\n```\n\n## Deploy\n\nStart webpack server\n\n```sh\nhey dev\nhey build\n\n# use custom config file build project\nhey build -f index.esm.js\n```\n\n## Analyze\n\nYou can generate analyze.\n\n``` sh\nhey dev -r\n# or\nhey dev --report\n\n# after hey build\nhey report\n# or\nhey report -p port -f dist/stat.json\n\n```\n![analyze](analyze.png)\n\n\n## Parameter\n\n``` javascript\n//Identification is a development environment, or a production environment\nconst debug = process.env.NODE_ENV == 'development'; //production\n```\n\n## Generate Project\nGenerate project using template.\n\n```sh\nhey init \u003cproject-name\u003e\n# hey init test\n```\n\nThe current template\n\n- Simple: Base ES6 project\n- HeyUI: HeyUI project\n- HeyAdmin: HeyAdmin project\n- Vue: Base Vue project\n- React: Base React project\n- ElementUI: Element project\n- iViewUI: iViewUI project\n- ViewUI: ViewUI project\n\nFor specific projects, please refer to [hey-cli-template](https://github.com/heyui/hey-cli-template)。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyui%2Fhey-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyui%2Fhey-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyui%2Fhey-cli/lists"}