create-tina-app 2.1.4 → 2.1.5

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.
package/dist/index.js CHANGED
@@ -213,35 +213,6 @@ function initializeGit(spinner) {
213
213
  import { Readable } from "node:stream";
214
214
  import { pipeline } from "node:stream/promises";
215
215
  import { x } from "tar";
216
- async function getRepoInfo(url, examplePath) {
217
- const [, username, name2, t, _branch, ...file] = url.pathname.split("/");
218
- const filePath = examplePath ? examplePath.replace(/^\//, "") : file.join("/");
219
- if (
220
- // Support repos whose entire purpose is to be a Next.js example, e.g.
221
- // https://github.com/:username/:my-cool-nextjs-example-repo-name.
222
- t === void 0 || // Support GitHub URL that ends with a trailing slash, e.g.
223
- // https://github.com/:username/:my-cool-nextjs-example-repo-name/
224
- // In this case "t" will be an empty string while the next part "_branch" will be undefined
225
- t === "" && _branch === void 0
226
- ) {
227
- try {
228
- const infoResponse = await fetch(
229
- `https://api.github.com/repos/${username}/${name2}`
230
- );
231
- if (infoResponse.status !== 200) {
232
- return;
233
- }
234
- const info = await infoResponse.json();
235
- return { username, name: name2, branch: info.default_branch, filePath };
236
- } catch {
237
- return;
238
- }
239
- }
240
- const branch = examplePath ? `${_branch}/${file.join("/")}`.replace(new RegExp(`/${filePath}|/$`), "") : _branch;
241
- if (username && name2 && branch && t === "tree") {
242
- return { username, name: name2, branch, filePath };
243
- }
244
- }
245
216
  async function downloadTarStream(url) {
246
217
  const res = await fetch(url);
247
218
  if (!res.body) {
@@ -288,6 +259,7 @@ var TEMPLATES = [
288
259
  }
289
260
  ],
290
261
  gitURL: "https://github.com/tinacms/tina-nextjs-starter",
262
+ branch: "main",
291
263
  devUrl: "http://localhost:3000"
292
264
  },
293
265
  {
@@ -310,6 +282,7 @@ var TEMPLATES = [
310
282
  }
311
283
  ],
312
284
  gitURL: "https://github.com/tinacms/tina-docs",
285
+ branch: "main",
313
286
  devUrl: "http://localhost:3000"
314
287
  },
315
288
  {
@@ -332,6 +305,7 @@ var TEMPLATES = [
332
305
  }
333
306
  ],
334
307
  gitURL: "https://github.com/tinacms/tina-astro-starter",
308
+ branch: "main",
335
309
  devUrl: "http://localhost:4321"
336
310
  },
337
311
  {
@@ -354,6 +328,7 @@ var TEMPLATES = [
354
328
  }
355
329
  ],
356
330
  gitURL: "https://github.com/tinacms/tina-hugo-starter",
331
+ branch: "main",
357
332
  devUrl: "http://localhost:1313"
358
333
  },
359
334
  {
@@ -376,6 +351,7 @@ var TEMPLATES = [
376
351
  }
377
352
  ],
378
353
  gitURL: "https://github.com/tinacms/tina-remix-starter",
354
+ branch: "main",
379
355
  devUrl: "http://localhost:3000"
380
356
  },
381
357
  {
@@ -398,6 +374,7 @@ var TEMPLATES = [
398
374
  }
399
375
  ],
400
376
  gitURL: "https://github.com/tinacms/tinasaurus",
377
+ branch: "main",
401
378
  devUrl: "http://localhost:3000"
402
379
  },
403
380
  {
@@ -420,18 +397,22 @@ var TEMPLATES = [
420
397
  }
421
398
  ],
422
399
  gitURL: "https://github.com/tinacms/tina-barebones-starter",
400
+ branch: "main",
423
401
  devUrl: "http://localhost:3000"
424
402
  }
425
403
  ];
426
404
  async function downloadTemplate(template, root, spinner) {
427
405
  if (template.isInternal === false) {
428
406
  const repoURL = new URL(template.gitURL);
429
- const repoInfo = await getRepoInfo(repoURL);
430
- if (!repoInfo) {
431
- throw new Error("Repository information not found.");
432
- }
407
+ const [, username, name2] = repoURL.pathname.split("/");
408
+ const repoInfo = {
409
+ username,
410
+ name: name2,
411
+ branch: template.branch,
412
+ filePath: ""
413
+ };
433
414
  spinner.text = `Downloading files from repo ${TextStyles.tinaOrange(
434
- `${repoInfo?.username}/${repoInfo?.name}`
415
+ `${repoInfo.username}/${repoInfo.name}`
435
416
  )}`;
436
417
  await downloadAndExtractRepo(root, repoInfo);
437
418
  } else {
@@ -485,7 +466,7 @@ import { Command } from "commander";
485
466
 
486
467
  // package.json
487
468
  var name = "create-tina-app";
488
- var version = "2.1.4";
469
+ var version = "2.1.5";
489
470
 
490
471
  // src/util/packageManagers.ts
491
472
  var PKG_MANAGERS = ["npm", "yarn", "pnpm", "bun"];
@@ -16,6 +16,7 @@ export type InternalTemplate = BaseExample & {
16
16
  export type ExternalTemplate = BaseExample & {
17
17
  isInternal: false;
18
18
  gitURL: string;
19
+ branch: string;
19
20
  };
20
21
  export type Template = InternalTemplate | ExternalTemplate;
21
22
  export declare const TEMPLATES: Template[];
@@ -4,9 +4,5 @@ export type RepoInfo = {
4
4
  branch: string;
5
5
  filePath: string;
6
6
  };
7
- export declare function isUrlOk(url: string): Promise<boolean>;
8
- export declare function getRepoInfo(url: URL, examplePath?: string): Promise<RepoInfo | undefined>;
9
- export declare function hasRepo({ username, name, branch, filePath, }: RepoInfo): Promise<boolean>;
10
- export declare function existsInRepo(nameOrUrl: string): Promise<boolean>;
11
7
  export declare function downloadAndExtractRepo(root: string, { username, name, branch, filePath }: RepoInfo): Promise<void>;
12
8
  export declare function downloadAndExtractExample(root: string, name: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tina-app",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -36,7 +36,7 @@
36
36
  "@types/prompts": "^2.4.9",
37
37
  "@types/tar": "6.1.13",
38
38
  "typescript": "^5.7.3",
39
- "@tinacms/scripts": "1.6.0"
39
+ "@tinacms/scripts": "1.6.1"
40
40
  },
41
41
  "dependencies": {
42
42
  "chalk": "^5.4.1",