cmyr-template-cli 1.34.2 → 1.35.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 (2) hide show
  1. package/dist/plopfile.js +44 -11
  2. package/package.json +1 -1
package/dist/plopfile.js CHANGED
@@ -113,7 +113,8 @@ var TEMPLATES_META_LIST = [
113
113
  runtime: "browser",
114
114
  vueVersion: 2,
115
115
  docker: false,
116
- priority: 0
116
+ priority: 0,
117
+ tags: ["nuxt"]
117
118
  },
118
119
  {
119
120
  name: "uni-template",
@@ -121,7 +122,8 @@ var TEMPLATES_META_LIST = [
121
122
  runtime: "browser",
122
123
  vueVersion: 2,
123
124
  docker: false,
124
- priority: 0
125
+ priority: 0,
126
+ tags: ["uni-app"]
125
127
  },
126
128
  {
127
129
  name: "uni-vite2-template",
@@ -129,7 +131,8 @@ var TEMPLATES_META_LIST = [
129
131
  runtime: "browser",
130
132
  vueVersion: 3,
131
133
  docker: false,
132
- priority: 0
134
+ priority: 0,
135
+ tags: ["uni-app"]
133
136
  },
134
137
  {
135
138
  name: "react-vite-template",
@@ -186,7 +189,8 @@ var TEMPLATES_META_LIST = [
186
189
  runtime: "nodejs",
187
190
  vueVersion: 0,
188
191
  docker: true,
189
- priority: 0
192
+ priority: 0,
193
+ tags: ["nestjs"]
190
194
  },
191
195
  {
192
196
  name: "hono-template",
@@ -194,7 +198,8 @@ var TEMPLATES_META_LIST = [
194
198
  runtime: "nodejs",
195
199
  vueVersion: 0,
196
200
  docker: true,
197
- priority: 0
201
+ priority: 0,
202
+ tags: ["hono", "vercel", "cloudflare-workers"]
198
203
  },
199
204
  // {
200
205
  // name: 'auto-release-template',
@@ -238,7 +243,8 @@ var TEMPLATES_META_LIST = [
238
243
  runtime: "nodejs",
239
244
  vueVersion: 0,
240
245
  docker: false,
241
- priority: 0
246
+ priority: 0,
247
+ tags: ["github-action"]
242
248
  },
243
249
  {
244
250
  name: "python-flask-template",
@@ -246,7 +252,8 @@ var TEMPLATES_META_LIST = [
246
252
  runtime: "python",
247
253
  vueVersion: 0,
248
254
  docker: true,
249
- priority: 0
255
+ priority: 0,
256
+ tags: ["flask"]
250
257
  },
251
258
  {
252
259
  name: "go-gin-template",
@@ -254,7 +261,8 @@ var TEMPLATES_META_LIST = [
254
261
  runtime: "golang",
255
262
  vueVersion: 0,
256
263
  docker: true,
257
- priority: 0
264
+ priority: 0,
265
+ tags: ["gin"]
258
266
  },
259
267
  {
260
268
  name: "spring-boot-template",
@@ -263,7 +271,8 @@ var TEMPLATES_META_LIST = [
263
271
  vueVersion: 0,
264
272
  javaVersion: 8,
265
273
  docker: true,
266
- priority: 0
274
+ priority: 0,
275
+ tags: ["spring-boot"]
267
276
  },
268
277
  {
269
278
  name: "spring-boot-v3-template",
@@ -272,7 +281,8 @@ var TEMPLATES_META_LIST = [
272
281
  vueVersion: 0,
273
282
  javaVersion: 17,
274
283
  docker: true,
275
- priority: 0
284
+ priority: 0,
285
+ tags: ["spring-boot"]
276
286
  }
277
287
  ];
278
288
 
@@ -695,6 +705,9 @@ async function initRemoteGitRepo(projectPath, answers) {
695
705
  if (templateMeta?.vueVersion === 3) {
696
706
  keywords.push("vue3");
697
707
  }
708
+ if (templateMeta.tags?.length) {
709
+ keywords.push(...templateMeta.tags);
710
+ }
698
711
  await replaceGithubRepositoryTopics(authToken, {
699
712
  owner,
700
713
  repo,
@@ -1398,6 +1411,23 @@ async function initCommitizen(projectPath) {
1398
1411
  async function initDocker(projectPath, answers) {
1399
1412
  const loading = (0, import_ora.default)("正在初始化 Docker ……").start();
1400
1413
  try {
1414
+ const { name } = answers;
1415
+ if (answers.template === "hono-template") {
1416
+ const dockerComposePath = import_path.default.join(projectPath, "docker-compose.yml");
1417
+ if (await import_fs_extra.default.pathExists(dockerComposePath)) {
1418
+ let dockerCompose = await import_fs_extra.default.readFile(dockerComposePath, "utf-8");
1419
+ dockerCompose = dockerCompose.replaceAll("hono-template", name);
1420
+ await import_fs_extra.default.writeFile(dockerComposePath, dockerCompose);
1421
+ }
1422
+ const wranglerPath = import_path.default.join(projectPath, "wrangler.toml");
1423
+ if (await import_fs_extra.default.pathExists(wranglerPath)) {
1424
+ let wrangler = await import_fs_extra.default.readFile(wranglerPath, "utf-8");
1425
+ wrangler = wrangler.replaceAll("hono-template", name);
1426
+ await import_fs_extra.default.writeFile(wranglerPath, wrangler);
1427
+ }
1428
+ loading.succeed("Docker 初始化成功!");
1429
+ return;
1430
+ }
1401
1431
  const templateMeta = getTemplateMeta(answers.template);
1402
1432
  const files = [".dockerignore", "docker-compose.yml", ".github/workflows/docker.yml"];
1403
1433
  await copyFilesFromTemplates(projectPath, files);
@@ -1855,7 +1885,10 @@ module.exports = function(plop) {
1855
1885
  type: "confirm",
1856
1886
  name: "isInitDocker",
1857
1887
  message: "是否初始化 Docker?",
1858
- default: false,
1888
+ default(answers) {
1889
+ const templateMeta = getTemplateMeta(answers.template);
1890
+ return templateMeta?.docker;
1891
+ },
1859
1892
  when(answers) {
1860
1893
  const templateMeta = getTemplateMeta(answers.template);
1861
1894
  return templateMeta?.docker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.34.2",
3
+ "version": "1.35.0",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",