{"id":32486329,"url":"https://github.com/fefeding/fepkg","last_synced_at":"2025-10-27T05:50:02.622Z","repository":{"id":57234441,"uuid":"257196791","full_name":"fefeding/fepkg","owner":"fefeding","description":"npm包发布工具，主动更新依赖发布","archived":false,"fork":false,"pushed_at":"2020-04-22T10:49:59.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T09:39:27.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/fefeding.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-04-20T06:54:14.000Z","updated_at":"2020-04-22T10:50:02.000Z","dependencies_parsed_at":"2022-09-14T12:12:24.308Z","dependency_job_id":null,"html_url":"https://github.com/fefeding/fepkg","commit_stats":null,"previous_names":["fefeding/fepkg","jiamao/fepkg"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fefeding/fepkg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Ffepkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Ffepkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Ffepkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Ffepkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fefeding","download_url":"https://codeload.github.com/fefeding/fepkg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Ffepkg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281222745,"owners_count":26464003,"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","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-10-27T05:49:57.669Z","updated_at":"2025-10-27T05:50:02.613Z","avatar_url":"https://github.com/fefeding.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fepkg\nnpm包发布工具，主动更新依赖发布。\n\n# 安装\n\n```sh\nnpm i fepkg\n```\n\n\n# 包管理功能\n你也可以用此项目管修改`package.json`文件。\n```js\nconst fepkg = require('fepkg');\nconst pkg = fepkg.loadPackage('/data/packages/pkg1');\npkg.addVersion();// 增加版本号\npkg.scripts['build'] = 'tsc';// 修改编译命令\npkg.save();// 保存到 package.json  , 这里也可以指定其它路径\n```\n\n包版本修改，更新依赖它的包引用。\n可以把以下脚本放到项目集根目录。\n```js\n// prepublish.js\nconst fepkg = require('fepkg');\nconst pattern = `{./app-base/*/package.json,./app-fronts/*/package.json}`;// 所有需要处理的包路径集合\n\n\n// 加载管理的模块，顺序不用管，组件会处理\nconst pkgs = fepkg.load(pattern, {\n    root: __dirname\n});\n\nconst curpkg = pkgs.getByName('module1');// 从所有包中获取我要修改的包\npkgs.updateVersion(curPkg);// 给module1小版本号加1，这里会同时更新依赖module1的引用版本号\n```\n\n然后在你发布需要触发的模块`package.json`中配置一个`scripts`,`npm publish` 勾子 `prepublish`\n```js\n// package.json\n\"scripts\": {\n    \"prepublish\": \"node ../prepublish.js\"\n  }\n```\n\n当每次在模块中执行 `npm publish` 时，会自动把当前模块版本号加1，并更新集合中所有依赖它的模块的依赖版本。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffefeding%2Ffepkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffefeding%2Ffepkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffefeding%2Ffepkg/lists"}