{"id":20345665,"url":"https://github.com/kscript/vue-config-wrapper","last_synced_at":"2025-10-25T15:09:48.787Z","repository":{"id":57395419,"uuid":"285768699","full_name":"kscript/vue-config-wrapper","owner":"kscript","description":"vue项目配置的包装器. 项目依赖更新时, 给出提示或直接修补配置","archived":false,"fork":false,"pushed_at":"2020-08-10T10:36:44.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T12:42:22.131Z","etag":null,"topics":["config","vue","vue-cli","wrapper"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kscript.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-07T07:39:02.000Z","updated_at":"2023-03-08T03:02:01.000Z","dependencies_parsed_at":"2022-09-02T15:30:31.181Z","dependency_job_id":null,"html_url":"https://github.com/kscript/vue-config-wrapper","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/kscript%2Fvue-config-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kscript%2Fvue-config-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kscript%2Fvue-config-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kscript%2Fvue-config-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kscript","download_url":"https://codeload.github.com/kscript/vue-config-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241876557,"owners_count":20035396,"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":["config","vue","vue-cli","wrapper"],"created_at":"2024-11-14T22:09:19.530Z","updated_at":"2025-10-25T15:09:43.744Z","avatar_url":"https://github.com/kscript.png","language":"JavaScript","readme":"## vue-config-wrapper\n一个vue项目配置的包装器.  \n当项目依赖的模块更换配置项时, 根据 项目已有配置 和 实际安装的版本, 给出提示或直接修补配置, 使开发者可以比较平滑地升级项目依赖, 获得更好的开发体验.\n\n\n## 支持的配置项\n- [x] sass\n\n## 开发说明\n我们可以在lib里基于vue.config.js里某个配置的变动, 建立一个对它进行适配的脚本, 比如项目创建最初的[sassLoader.js](./src/lib/sassLoader.js)  \n一个这样的脚本, 一般最少包含以下几种属性:  \n| 属性名 | 类型 | 描述 |\n| -- | -- | -- |\n| name | string | 标识名 |\n| path | string | 要操作的项在vue.config.js导出对象中的访问路径, 用.进行分级 |\n| type | string | 操作类型, option/module, option表示一般配置项, module表示模块配置项 |\n| changelog | object[] | 变动记录 |\n| handler | function | 操作方法 |\n  \n### changelog 规则\n``` javascript\n[{\n    // changelog是一个对象数组, 它的每一个元素都应当有一个版本号.\n    version: '8.0.0',\n    // utils 工具方法 updateConfig 里预定义了对 replace 属性的处理\n    // replace: {key: value} 如果是低版本向高版本升级\n    // 在 handler 方法的参数 itemConfig 里, 如果有相同key, 会被替换为value\n    // 如果是高版本向低版本降, 则是逆向操作\n    replace: {\n        data: 'prependData'\n    },\n    // 如果update不是函数, 或 是函数且返回值严格相等于true, 那么执行预定义的处理\n    \n    // itemConfig 是 handler 的参数\n    // item 即update函数所在的元素\n    // index 索引 reverseIndex 开始翻转的索引\n\n    // changelog会按版本从小到大进行一次排序, 然后依次与itemInfo.version比较\n    // 小于等于的按正常顺序, 大于的会被翻转(从大到小)\n    // changelog: [{version: 0},1,2,3,4,5] item.version: 3 实际遍历时的数组顺序 [0,1,2,3,5,4]\n    // index: 0,1,2,3,4,5 reverseIndex 4\n    update(itemConfig, item, index, reverseIndex) {\n        return true\n    }\n}]\n// 例如\n// 7.0.0 升 8.0.0 时, \n// 原来的itemConfig为 {data: '@/assets/scss/index.scss'}\n// 处理后itemConfig为 {prependData: '@/assets/scss/index.scss'}\n\n```\n\n### type 可选值\n- option: 只读取@vue/cli-service信息\n- module: 同时读取 @vue/cli-service 和 模块自身信息\n\n### handler 参数\n- itemConfig  根据path读取到的配置 (如果path指向一个非对象, 会被包装到一个对象里, 可以通过path最后一级地址访问它)\n- itemInfo  当前可用的信息. type为module时, 那么它是模块自身的信息, type为option时, 则是@vue/cli-service的信息\n- utils  提供的一些工具方法\n- moreInfo  type为module时, 会传入@vue/cli-service的信息, 否则就是{}\n\n## license\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkscript%2Fvue-config-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkscript%2Fvue-config-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkscript%2Fvue-config-wrapper/lists"}