{"id":21322560,"url":"https://github.com/wanglei8381/wag-cli","last_synced_at":"2026-05-20T02:47:21.539Z","repository":{"id":136017014,"uuid":"82039374","full_name":"wanglei8381/wag-cli","owner":"wanglei8381","description":"A multi-page packaging tool based on webpack","archived":false,"fork":false,"pushed_at":"2017-11-01T11:55:10.000Z","size":3390,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T11:48:34.396Z","etag":null,"topics":["multi-page","packaging-tool","react-cli","vue-cli","wag","wag-cli","webpack"],"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/wanglei8381.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-15T08:48:42.000Z","updated_at":"2017-08-09T09:22:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"ffa121cc-54c8-4c5c-ac84-e484a18830e1","html_url":"https://github.com/wanglei8381/wag-cli","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglei8381%2Fwag-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglei8381%2Fwag-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglei8381%2Fwag-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglei8381%2Fwag-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wanglei8381","download_url":"https://codeload.github.com/wanglei8381/wag-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801683,"owners_count":20350108,"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":["multi-page","packaging-tool","react-cli","vue-cli","wag","wag-cli","webpack"],"created_at":"2024-11-21T20:16:18.848Z","updated_at":"2026-05-20T02:47:16.502Z","avatar_url":"https://github.com/wanglei8381.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wag-cli\n基于webpack多页面打包工具，主要针对vue,react项目，支持css，stylus，less和sass/scss\n\n## Install\n\nnpm install -g wag-cli\n\n## Usage\nwag [options] [value ...]\n\n```\nwag init projectName [--cover] [--react]\n初始化一个项目，如果项目已经存在，可以添加--cover参数将其覆盖, 默认生成vue项目，使用--react参数生成react项目\n\n项目目录\n|-components 通用组件\n|-pages 项目模块\n    |-home 其中一个模块，模块必须有一个src目录\n        |-src\n|-test 测试\n    |-unit 单元测试\n|-wag.config.js/webpack.config.js wag配置文件\n\n\nwag dev\n在本地会持续编译并生成对应的文件，主要在联调时供后端人员访问\nwag start\n在本地会持续编译并打开浏览器，实现热加载和代理\nwag build\n上线发布\nwag test [参数同karma]\n测试框架karma+mocha+chai\n```\n\n```javascript\n// wag.config.js配置文件详情\nmodule.exports = {\n // 编译文件入口\n \"files\": {\n   \"pages/home/src/index.js\": 1\n },\n // 对于node_modules下的js是否排除\n \"exclude\": true,\n\n /**  生产配置  **/\n // 提取js模块\n \"vendor\": true,\n // 生成文件的hash值,默认不生成\n \"chunkhash\": 8,\n // 是否提取css,默认不提取\n \"extractCSS\": true,\n // 是否生成source-map, 默认不生成\n \"devtool\": \"#source-map\",\n // 线上访问地址，默认//static.wuage.com/项目目录\n \"publicPath\": \"/\",\n // 分析块之间的依赖\n \"bundleAnalyzerReport\": true,\n\n /**  开发配置  **/\n // 上下文,默认当前目录\n \"context\": __dirname,\n // 入口文件\n \"index\": \"pages/home/index.html\",\n // 静态资源目录,默认index的上级目录\n \"staticPath\": \"./\",\n // 端口默认8080\n \"port\": 8080,\n // 自动打开浏览器\n \"autoOpenBrowser\": true,\n // api\n \"proxyTable\": {\n   '/api': {\n     target: 'http://127.0.0.1:3000',\n     changeOrigin: true\n   }\n },\n // 添加mock，key：请求路径，value:文件地址\n \"mockTable\": {\n    '/api': 'mocks/home.js'\n },\n \n /** 测试配置 */\n // 是否展示测试覆盖率，默认false\n coverage: true\n} \n```\n\n\n## Commands\n\n    init [projectName]  初始化项目\n    dev                 开发\n    build               发布上线\n    start               开发自动启动服务\n    test [参数同karma]   测试\n    help [cmd]          display help for [cmd]\n\n## Options\n\n    -h, --help     output usage information\n    -V, --version  output the version number\n    -c, --cover    如果工程名存在,就覆盖掉\n    -r, --remove   build之前将dist目录删掉\n\n## 其他\n在测试时使用PhantomJS，但安装经常失败，在package.json依赖中去掉了，\n需要手动安装karma-phantomjs-launcher和karma-phantomjs-shim\n经常失败的包，手动安装\nsass-loader\nnode-sass\nless\nless-loader","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanglei8381%2Fwag-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwanglei8381%2Fwag-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanglei8381%2Fwag-cli/lists"}