{"id":18777279,"url":"https://github.com/iyowei/create-templates","last_synced_at":"2025-12-16T19:30:16.179Z","repository":{"id":57119750,"uuid":"440134282","full_name":"iyowei/create-templates","owner":"iyowei","description":"无论是创建 Cli、React、Node、Vue、Electron 等等之中的哪一个项目，都会需要用到模板，而这些模板文件也大都相同，小异可以维护在各自专门的脚手架中。","archived":false,"fork":false,"pushed_at":"2022-01-19T12:27:41.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T15:50:55.741Z","etag":null,"topics":["create","generator","infrastructure","npm-package","template"],"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/iyowei.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":"2021-12-20T10:46:03.000Z","updated_at":"2022-01-02T14:02:51.000Z","dependencies_parsed_at":"2022-08-23T06:00:14.873Z","dependency_job_id":null,"html_url":"https://github.com/iyowei/create-templates","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcreate-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcreate-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcreate-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcreate-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iyowei","download_url":"https://codeload.github.com/iyowei/create-templates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239687435,"owners_count":19680732,"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":["create","generator","infrastructure","npm-package","template"],"created_at":"2024-11-07T20:09:34.243Z","updated_at":"2025-12-16T19:30:16.132Z","avatar_url":"https://github.com/iyowei.png","language":"JavaScript","readme":"# @iyowei/create-templates\n\n\u003e 统一提供模板，额外提供与模板紧密相关、有用的帮助函数。无论是创建 Cli、React、Node、Vue、Electron 等等之中的哪一个项目，都会需要用到模板，而这些模板文件也大都相同，小异可以维护在各自专门的脚手架中。\n\n## 使用\n\n### `copiers`\n\n- 返回 { Object } 纯粹 “拷贝” 用途的模板文件\n  - `common` { Array } 通用用途文件列表\n  - `eslintrc` { Object } ESlint 配置模板文件列表\n    - `esm` [ESM][ecmascript module] 模块用途的 ESlint 配置\n  - `mocha` { String } mocha.js 配置文件模板\n  - `benchmark` { String } 文件脚本\n\n```js\nimport { log } from 'console';\nimport { copiers } from '@iyowei/create-templates';\n\nlog(copiers);\n\n/**\n * {\n *   common: [\n *     '/Users/iyowei/Development/iyowei/create-templates/src/.vscode',\n *     '/Users/iyowei/Development/iyowei/create-templates/src/.editorconfig',\n *     ...\n *   ],\n *   esm: [\n *     ...\n *   ],\n *   ...\n * ]\n */\n```\n\n### `prints`\n\n- 返回 { Object } 印刷模板，使用方式参见 [`lodash.template()`][lodash.template]。\n\n```js\nimport { log } from 'console';\nimport { prints } from '@iyowei/create-templates';\n\nlog(prints);\n\n/**\n * {\n *   readme: '/Users/iyowei/Development/iyowei/create-templates/src/README.md',\n *   npmrc: '/Users/iyowei/Development/iyowei/create-templates/src/.npmrc',\n *   ...\n * }\n */\n```\n\n### `stockrooms`\n\n- 返回 { Object } 第三方仓库，如：[github/gitignore][github/gitignore]。\n\n```js\nimport { log } from 'console';\nimport { stockrooms } from '@iyowei/create-templates';\n\nlog(stockrooms);\n\n/**\n * {\n *   gitignore: '/Users/iyowei/Development/iyowei/create-templates/src/gitignore',\n *   ...\n * }\n */\n```\n\n### `writeGitignoreSync({ output, topics })`\n\n在指定位置生成包含指定主题内容的 .gitignore 文件。\n\n- `output` { String } 输出位置，包含输出文件名，例如：`/Users/iyowei/Development/iyowei/.gitignore`\n- `topics` { Array | String } [github/gitignore][github/gitignore] 里模板文件的文件名，单个或者集合\n\n```js\nimport { writeGitignoreSync } from '@iyowei/create-templates';\n\nwriteGitignoreSync({\n  output: join(process.cwd(), '.gitignore'),\n  topics: [\n    'macOS',\n    'Windows',\n    'Linux',\n    'Node',\n    'VisualStudioCode',\n    'SublimeText',\n    'CVS',\n    'Diff',\n    'Vim',\n    'TortoiseGit',\n  ],\n});\n```\n\n### `writeGitignore({ output, topics })`\n\n异步方法，在指定位置生成包含指定主题内容的 .gitignore 文件。\n\n- `output` { String } 输出位置，包含输出文件名，例如：`/Users/iyowei/Development/iyowei/.gitignore`\n- `topics` { Array | String } [github/gitignore][github/gitignore] 里模板文件的文件名，单个或者集合\n\n```js\nimport { writeGitignore } from '@iyowei/create-templates';\n\n(async () =\u003e {\n  await writeGitignore({\n    output: join(process.cwd(), '.gitignore'),\n    topics: [\n      'macOS',\n      'Windows',\n      'Linux',\n      'Node',\n      'VisualStudioCode',\n      'SublimeText',\n      'CVS',\n      'Diff',\n      'Vim',\n      'TortoiseGit',\n    ],\n  });\n})();\n```\n\n### `writeNpmRcSync({ output, data })`\n\n串行方法，在指定位置生成 .npmrc 文件。\n\n- `output` { String } 输出位置，包含输出文件名，例如：`/Users/iyowei/Development/iyowei/.npmrc`\n- `data` { Object} 用来填充[模板][lodash.template]的数据\n\n```js\nimport { writeNpmRcSync } from '@iyowei/create-templates';\n\nwriteNpmRcSync({\n  output: join(process.cwd(), '.npmrc'),\n  data: { namespace: 'iyowei' },\n});\n```\n\n### `writeNpmRc({ output, data })`\n\n异步方法，在指定位置生成 .npmrc 文件。\n\n- `output` { String } 输出位置，包含输出文件名，例如：`/Users/iyowei/Development/iyowei/.npmrc`\n- `data` { Object} 用来填充[模板][lodash.template]的数据\n\n```js\nimport { writeNpmRc } from '@iyowei/create-templates';\n\n(async () =\u003e {\n  await writeNpmRc({\n    output: join(process.cwd(), '.npmrc'),\n    data: { namespace: '' },\n  });\n})();\n```\n\n### `writeReadmeSync({ output, data })`\n\n串行方法，在指定位置生成 README.md 文件。\n\n- `output` { String } 输出位置，包含输出文件名，例如：`/Users/iyowei/Development/iyowei/README.md`\n- `data` { Object} 用来填充[模板][lodash.template]的数据\n\n```js\nimport { writeReadmeSync } from '@iyowei/create-templates';\n\nwriteReadmeSync({\n  output: join(process.cwd(), 'README.md'),\n  data: {\n    name: 'iyowei',\n    description: 'balabala...',\n  },\n});\n```\n\n### `writeReadme({ output, data })`\n\n异步方法，在指定位置生成 README.md 文件。\n\n- `output` { String } 输出位置，包含输出文件名，例如：`/Users/iyowei/Development/iyowei/README.md`\n- `data` { Object} 用来填充[模板][lodash.template]的数据\n\n```js\nimport { writeReadme } from '@iyowei/create-templates';\n\n(async () =\u003e {\n  await writeReadme({\n    output: join(process.cwd(), 'README.md'),\n    data: {\n      name: 'iyowei',\n      description: 'balabala...',\n    },\n  });\n})();\n```\n\n## 安装\n\n\u003c!-- 标明支持的宿主、宿主版本，模块类型 --\u003e\n\n[![Node Version Badge][node version badge]][download node.js] ![esm][esm]\n\n### NPM\n\n```shell\nnpm add @iyowei/create-templates\n```\n\n### PNPM\n\n```shell\npnpm add @iyowei/create-templates\n```\n\n### Yarn\n\n```shell\nyarn add @iyowei/create-templates\n```\n\n## 参考\n\n### \".github\" 文件夹\n\n- [为仓库创建拉取请求模板][为仓库创建拉取请求模板]；\n- [为仓库配置议题模板][为仓库配置议题模板]；\n- [GitHub 表单架构的语法][github 表单架构的语法]；\n- [创建议题模板的旧工作流程][创建议题模板的旧工作流程]；\n\n## 参与贡献\n\n![PRs Welcome][prs welcome badge]\n\n## 其它\n\n\"@iyowei/create-templates\" 使用 [@iyowei/create-esm][create-esm] 脚手架生成。\n\n[创建议题模板的旧工作流程]: https://docs.github.com/cn/communities/using-templates-to-encourage-useful-issues-and-pull-requests/manually-creating-a-single-issue-template-for-your-repository\n[为仓库配置议题模板]: https://docs.github.com/cn/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#creating-issue-forms\n[github 表单架构的语法]: https://docs.github.com/cn/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema\n[为仓库创建拉取请求模板]: https://docs.github.com/cn/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository\n[node version badge]: https://img.shields.io/badge/node.js-%3E%3D12.20.0-brightgreen?style=flat\u0026logo=Node.js\n[download node.js]: https://nodejs.org/en/download/\n[esm]: https://img.shields.io/badge/ESM-brightgreen?style=flat\n[prs welcome badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat\n[create-esm]: https://github.com/iyowei/create-esm\n[github/gitignore]: https://github.com/github/gitignore\n[lodash.template]: https://lodash.com/docs/4.17.15#template\n[ecmascript module]: https://nodejs.org/docs/latest-v12.x/api/esm.html\n\n\u003c!-- 更多文档细节，参考 https://github.com/iyowei/readme-templates --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyowei%2Fcreate-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiyowei%2Fcreate-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyowei%2Fcreate-templates/lists"}