{"id":14155812,"url":"https://github.com/sonofmagic/npm-lib-template","last_synced_at":"2025-07-30T11:04:46.162Z","repository":{"id":41380371,"uuid":"428966327","full_name":"sonofmagic/npm-lib-template","owner":"sonofmagic","description":"npm-lib-template","archived":false,"fork":false,"pushed_at":"2025-06-19T01:24:41.000Z","size":1177,"stargazers_count":26,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-07T11:43:05.939Z","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/sonofmagic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["sonofmagic"],"custom":["https://github.com/sonofmagic/sponsors"]}},"created_at":"2021-11-17T08:33:32.000Z","updated_at":"2025-06-19T01:24:45.000Z","dependencies_parsed_at":"2023-12-17T06:25:45.751Z","dependency_job_id":"911d7b0c-0a1a-4d74-a514-917e0341a593","html_url":"https://github.com/sonofmagic/npm-lib-template","commit_stats":null,"previous_names":["sonofmagic/npm-lib-template","sonofmagic/npm-lib-rollup-template"],"tags_count":29,"template":true,"template_full_name":null,"purl":"pkg:github/sonofmagic/npm-lib-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonofmagic%2Fnpm-lib-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonofmagic%2Fnpm-lib-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonofmagic%2Fnpm-lib-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonofmagic%2Fnpm-lib-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sonofmagic","download_url":"https://codeload.github.com/sonofmagic/npm-lib-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonofmagic%2Fnpm-lib-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267857797,"owners_count":24155914,"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-07-30T02:00:09.044Z","response_time":70,"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-08-17T08:05:01.264Z","updated_at":"2025-07-30T11:04:46.099Z","avatar_url":"https://github.com/sonofmagic.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sonofmagic","https://github.com/sonofmagic/sponsors"],"categories":["others"],"sub_categories":[],"readme":"# npm-lib-template\n\n[![codecov](https://codecov.io/gh/sonofmagic/npm-lib-template/branch/main/graph/badge.svg?token=zn05qXYznt)](https://codecov.io/gh/sonofmagic/npm-lib-template)\n\n[icebreaker](https://github.com/sonofmagic) 编写的一个 `npm` 包的一个模板\n\n- 使用 `tsup` 打包 , `rollup` 打包版本在 [rollup](https://github.com/sonofmagic/npm-lib-template/tree/rollup) 分支 (兼容 `tsc`)\n- 使用 `vitest` 作为单元测试框架\n- 使用 `eslint` 来规范代码风格\n- 输出 `dist` -\u003e `cjs`,`esm` and `.d.ts`\n- 使用 `semantic-release` 来发布 `npm`/`github`\n\n## 为什么使用 `vitest` 而不是原先的 `jest`\n\n`vitest` 开箱即用, `jest` 在同时遇到 `cjs` 和 `esm` 依赖的时候，支持差，而且配置复杂，依赖的 `preset` 多，比如 `ts-jest`..\n\n## scripts\n\n### rename\n\n执行 `npm run init:rename`\n\n作用为替换 `package.json` 中默认包含的所有名称为 `npm-lib-template` 的字段\n\n默认替换为新建代码仓库的文件夹名称！\n\n### bin\n\n执行 `npm run init:bin`\n\n作用为 `package.json` 添加 `files` 和 `bin`，同时生成 `bin/{{pkg.name}}.js` 和 `src/cli.ts` 文件\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonofmagic%2Fnpm-lib-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonofmagic%2Fnpm-lib-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonofmagic%2Fnpm-lib-template/lists"}