{"id":19681031,"url":"https://github.com/wang-jun-coder/lerna-example","last_synced_at":"2026-05-14T17:32:18.988Z","repository":{"id":57151470,"uuid":"225986664","full_name":"wang-jun-coder/lerna-example","owner":"wang-jun-coder","description":"这是一个使用 lerna 的 demo，请不要使用","archived":false,"fork":false,"pushed_at":"2019-12-05T06:49:03.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T21:36:56.503Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/wang-jun-coder.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}},"created_at":"2019-12-05T01:03:23.000Z","updated_at":"2019-12-05T06:49:05.000Z","dependencies_parsed_at":"2022-09-06T16:40:52.856Z","dependency_job_id":null,"html_url":"https://github.com/wang-jun-coder/lerna-example","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/wang-jun-coder/lerna-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-jun-coder%2Flerna-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-jun-coder%2Flerna-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-jun-coder%2Flerna-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-jun-coder%2Flerna-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wang-jun-coder","download_url":"https://codeload.github.com/wang-jun-coder/lerna-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-jun-coder%2Flerna-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33035662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":"2024-11-11T18:06:46.065Z","updated_at":"2026-05-14T17:32:18.970Z","avatar_url":"https://github.com/wang-jun-coder.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lerna-example\n这是一个使用 lerna 的 demo，请不要使用\n\n## 操作步骤记录\n\n### 初始化仓库\n* 全局安装 lerna \n* lerna init --independent 初始化仓库\n\t* 如不适用 independent 参数， 则默认所有包均共享一个版本号\n* 配置初始配置\n\t* lerna.json \n\t\t\n\t\t```json\n\t\t{\n\t\t  \"packages\": [\n\t\t    \"packages/*\"\n\t\t  ],\n\t\t  \"npmClient\": \"yarn\",\t\t\t// 指定包管理器，使用 yarn，默认 npm\n\t\t  \"useWorkspaces\": true,\t\t// 配合使用 yarn workspace\n\t\t  \"command\": {\n\t\t  \t\"publish\": {\n\t\t  \t\t\"ignoreChanges\": [],\n\t\t  \t\t\"message\": \"chore(none): publish\", // 发布时提交的commit message\n\t\t  \t\t\"registry\": \" https://registry.npmjs.org\"\n\t\t  \t},\n\t\t  },\n\t\t  \"version\": \"independent\"\n\t\t}\n\n\t\t```\n\t* package.json\n\t\t\n\t\t```json\n\t\t{\n\t\t  \"name\": \"root\",\n\t\t  \"private\": true,\n\t\t  \"packages\": [\t\t\t\t// yarn workspace 对应的配置项\n\t\t    \"packages/*\"\n\t\t  ],\n\t\t  \"devDependencies\": {\n\t\t    \"lerna\": \"^3.19.0\"\n\t\t  }\n\t\t}\n\t\t``` \n* 创建包\n\t* `lerna create @wangjuncode/lerna-example-tools`\n\t\t* 创建一个工具包，可单独使用，也可作为依赖\n\t\t* 注意：\n\t\t\t* 如为 scope 包， 则package.json 需有如下配置(使用命令创建，默认会有配置)\n\t\t\t\t\n\t\t\t\t```json\n\t\t\t\t{\n\t\t\t\t\t...\n\t\t\t\t\t  \"publishConfig\": {\n\t\t\t\t\t    \"access\": \"public\"\n\t\t\t\t\t  },\n\t\t\t\t\t...\n\t\t\t\t}\n\t\t\t\t```\n\t* `lerna create @wangjuncode/lerna-example-module`\n\t\t* 创建一个独立模块包\n\t* `lerna create @wangjuncode/lerna-example`\n\t\t* 创建一个主包，依赖 tools 和 module\n* 安装通用依赖\n\t此处均已 typescript 包来进行配置\n\t\n\t* `yarn add typescript -W -D`\n\t\t* 安装 ts 依赖\n\t* 创建 tsconfig.json 文件\n\t\t\n\t\t```json\n\t\t{\n\t\t  \"compilerOptions\": {\n\t\t    \"module\": \"commonjs\",\n\t\t    \"target\": \"es5\",\n\t\t    \"sourceMap\": true,\n\t\t    \"strict\": true,\n\t\t    \"outDir\": \"lib\",\n\t\t    \"declaration\": true\n\t\t  },\n\t\t  \"include\": [\n\t\t    \"packages/**/*\"\n\t\t  ],\n\t\t  \"exclude\": [\n\t\t    \"node_modules\",\n\t\t    \"**/__tests__/*\"\n\t\t  ]\n\t\t}\n\t\t``` \n\t* 编写相关代码逻辑（见代码）\n\t* 安装 lint 相关依赖并配置\n\t\t* `yarn add prettier tslint tslint-config-prettier -W -D`\n\t\t* 配置 .prettierrc\n\t\t* tslint.json\n\t* 安装 jest 相关\n\t\t* `yarn add jest ts-jest @types/jest -W -D`\n\t\t* 配置 jestconfig.json\n\t\n* 配置 git 等流程\n\t* 安装相关依赖\n\t\t* `yarn add -W -D @commitlint/cli @commitlint/config-conventional commitizen cz-lerna-changelog lint-staged husky`\n\t* commitizen, cz-lerna-changelog 规范化提交记录\n\t* commitlint, husky 提交前校验提交信息是否符合规范\n\t* tslint 校验代码风格\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang-jun-coder%2Flerna-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwang-jun-coder%2Flerna-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang-jun-coder%2Flerna-example/lists"}