create-idp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +205 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +702 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +46 -0
  7. package/templates/empty/README.md +3 -0
  8. package/templates/empty/_gitignore +6 -0
  9. package/templates/empty/_template.json +6 -0
  10. package/templates/node-ts/README.md +21 -0
  11. package/templates/node-ts/_gitignore +7 -0
  12. package/templates/node-ts/_template.json +16 -0
  13. package/templates/node-ts/package.json +19 -0
  14. package/templates/node-ts/src/index.ts +1 -0
  15. package/templates/node-ts/tsconfig.json +17 -0
  16. package/templates/node-ts/tsup.config.ts +9 -0
  17. package/templates/python-uv/README.md +22 -0
  18. package/templates/python-uv/_gitignore +30 -0
  19. package/templates/python-uv/_template.json +14 -0
  20. package/templates/python-uv/pyproject.toml +20 -0
  21. package/templates/python-uv/src/project_name/__init__.py +10 -0
  22. package/templates/python-uv/src/project_name/__main__.py +4 -0
  23. package/templates/react-ts/_gitignore +6 -0
  24. package/templates/react-ts/_template.json +13 -0
  25. package/templates/react-ts/index.html +13 -0
  26. package/templates/react-ts/package.json +23 -0
  27. package/templates/react-ts/src/App.css +14 -0
  28. package/templates/react-ts/src/App.tsx +12 -0
  29. package/templates/react-ts/src/index.css +11 -0
  30. package/templates/react-ts/src/main.tsx +10 -0
  31. package/templates/react-ts/tsconfig.json +20 -0
  32. package/templates/react-ts/vite.config.ts +6 -0
  33. package/templates/template.config.json +34 -0
  34. package/templates/vue-ts/_gitignore +6 -0
  35. package/templates/vue-ts/_template.json +13 -0
  36. package/templates/vue-ts/index.html +13 -0
  37. package/templates/vue-ts/package.json +20 -0
  38. package/templates/vue-ts/src/App.vue +37 -0
  39. package/templates/vue-ts/src/main.ts +5 -0
  40. package/templates/vue-ts/src/style.css +11 -0
  41. package/templates/vue-ts/src/vite-env.d.ts +7 -0
  42. package/templates/vue-ts/tsconfig.json +20 -0
  43. package/templates/vue-ts/vite.config.ts +6 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,205 @@
1
+ # create-idp
2
+
3
+ 快速创建项目并自动初始化 GitHub 仓库的 CLI 脚手架工具。
4
+
5
+ ## 特性
6
+
7
+ - 🚀 快速创建项目
8
+ - 🔌 自动初始化 Git 仓库
9
+ - 🐙 内置 GitHub API 集成 (无需 gh CLI)
10
+ - 🔐 安全的 Token 管理
11
+ - 📦 多模板支持
12
+ - ⚡ Node.js 18+ 原生支持
13
+
14
+ ## 安装
15
+
16
+ ```bash
17
+ npm install -g create-idp
18
+ ```
19
+
20
+ ## 快速开始
21
+
22
+ ### 1. 配置 GitHub Token (首次仅需一次)
23
+
24
+ ```bash
25
+ create-idp config --setup-github
26
+ ```
27
+
28
+ 按提示获取 GitHub Personal Access Token: https://github.com/settings/tokens/new?scopes=repo
29
+
30
+ ### 2. 创建项目
31
+
32
+ ```bash
33
+ # 交互式创建
34
+ create-idp
35
+
36
+ # 或一条命令
37
+ create-idp my-app --github --template node-ts
38
+ ```
39
+
40
+ ### 3. 开始开发
41
+
42
+ ```bash
43
+ cd my-app
44
+ pnpm dev
45
+ ```
46
+
47
+ ## 命令
48
+
49
+ ### 配置管理
50
+
51
+ ```bash
52
+ create-idp config --setup-github # 配置 GitHub Token
53
+ create-idp config --show # 显示当前配置
54
+ create-idp config --path # 显示配置文件路径
55
+ ```
56
+
57
+ ### 创建项目
58
+
59
+ ```bash
60
+ create-idp # 交互式创建
61
+ create-idp my-app # 指定项目名
62
+ create-idp my-app --template node-ts # 指定模板
63
+ create-idp my-app --github # 创建 + GitHub 仓库
64
+ create-idp my-app --github --public # 创建公开仓库
65
+ create-idp my-app --no-git # 不初始化 Git
66
+ ```
67
+
68
+ ## 使用场景
69
+
70
+ ### 个人项目
71
+
72
+ ```bash
73
+ create-idp my-project --github
74
+ cd my-project
75
+ pnpm dev
76
+ ```
77
+
78
+ ### 为组织创建项目
79
+
80
+ 首次配置时选择设置默认组织,之后所有项目都会在该组织下创建。
81
+
82
+ ```bash
83
+ create-idp config --setup-github
84
+ # 选择: 设置默认组织 → my-company
85
+
86
+ create-idp my-project --github
87
+ # 仓库创建在: https://github.com/my-company/my-project
88
+ ```
89
+
90
+ ### 公开项目
91
+
92
+ ```bash
93
+ create-idp awesome-lib --github --public
94
+ ```
95
+
96
+ ## 配置文件
97
+
98
+ 配置文件位置: `~/.create-idp.json`
99
+
100
+ ### 查看配置
101
+
102
+ ```bash
103
+ create-idp config --show
104
+ ```
105
+
106
+ ### 手动配置 (可选)
107
+
108
+ 编辑 `~/.create-idp.json`:
109
+
110
+ ```json
111
+ {
112
+ "defaults": {
113
+ "github": true,
114
+ "public": false,
115
+ "template": "node-ts"
116
+ },
117
+ "github": {
118
+ "token": "ghp_xxxxxxxxxxxx",
119
+ "defaultOrg": "my-organization"
120
+ }
121
+ }
122
+ ```
123
+
124
+ ## GitHub API 集成
125
+
126
+ - ✅ Token 验证 (GET /user)
127
+ - ✅ 创建个人仓库 (POST /user/repos)
128
+ - ✅ 创建组织仓库 (POST /orgs/{org}/repos)
129
+ - ✅ 自动配置 git remote
130
+ - ✅ 自动推送初始提交
131
+
132
+ ## 安全性
133
+
134
+ - 配置文件权限自动设置为 600 (仅所有者读写)
135
+ - Token 存储在本地,不会上传
136
+ - 使用 HTTPS 连接 GitHub
137
+ - 完善的错误处理
138
+
139
+ ## 常见问题
140
+
141
+ ### Q: Token 失效了怎么办?
142
+
143
+ ```bash
144
+ create-idp config --setup-github
145
+ ```
146
+
147
+ 重新配置新的 Token。
148
+
149
+ ### Q: 包名被占用了怎么办?
150
+
151
+ 使用不同的项目名称重新创建。
152
+
153
+ ### Q: 如何跳过创建 GitHub 仓库?
154
+
155
+ ```bash
156
+ create-idp my-app --no-git
157
+ ```
158
+
159
+ ### Q: 如何为不同账户创建项目?
160
+
161
+ ```bash
162
+ create-idp config --setup-github
163
+ ```
164
+
165
+ 输入不同账户的 Token 进行切换。
166
+
167
+ ## 文档
168
+
169
+ - [快速开始](./QUICK_START.md) - 5 分钟快速上手
170
+ - [完整使用指南](./USAGE_GUIDE.md) - 所有功能详解
171
+ - [npm 发布指南](./NPM_QUICK_PUBLISH.md) - 如何发布到 npm
172
+
173
+ ## 支持的模板
174
+
175
+ - `node-ts` - Node.js + TypeScript
176
+ - `react-ts` - React + TypeScript
177
+ - `vue-ts` - Vue + TypeScript
178
+ - 更多自定义模板
179
+
180
+ ## 系统要求
181
+
182
+ - Node.js >= 18.0.0
183
+ - npm 或 pnpm
184
+
185
+ ## 许可证
186
+
187
+ MIT
188
+
189
+ ## 相关链接
190
+
191
+ - [GitHub](https://github.com/your-username/create-idp)
192
+ - [npm Package](https://www.npmjs.com/package/create-idp)
193
+
194
+ ## 贡献
195
+
196
+ 欢迎提交 Issue 和 Pull Request!
197
+
198
+ ## 变更日志
199
+
200
+ ### v0.1.0
201
+
202
+ - 初始发布
203
+ - GitHub API 集成
204
+ - CLI 命令完整
205
+ - 完整的文档和指南
@@ -0,0 +1,2 @@
1
+
2
+ export { }