create-tina-app 1.2.5 → 1.3.1

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
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -36,7 +40,7 @@ var import_node_path = __toESM(require("path"));
36
40
 
37
41
  // package.json
38
42
  var name = "create-tina-app";
39
- var version = "1.2.5";
43
+ var version = "1.3.1";
40
44
 
41
45
  // src/util/fileUtil.ts
42
46
  var import_fs_extra = __toESM(require("fs-extra"));
@@ -164,11 +168,9 @@ function install(root, dependencies, { packageManager, isOnline, devDependencies
164
168
  switch (packageManager) {
165
169
  case "yarn":
166
170
  args = ["add", "--exact"];
167
- if (!isOnline)
168
- args.push("--offline");
171
+ if (!isOnline) args.push("--offline");
169
172
  args.push("--cwd", root);
170
- if (devDependencies)
171
- args.push("--dev");
173
+ if (devDependencies) args.push("--dev");
172
174
  args.push(...dependencies);
173
175
  break;
174
176
  case "npm":
@@ -178,11 +180,9 @@ function install(root, dependencies, { packageManager, isOnline, devDependencies
178
180
  break;
179
181
  case "pnpm":
180
182
  args = ["add"];
181
- if (!isOnline)
182
- args.push("--offline");
183
+ if (!isOnline) args.push("--offline");
183
184
  args.push("--save-exact");
184
- if (devDependencies)
185
- args.push("-D");
185
+ if (devDependencies) args.push("-D");
186
186
  args.push(...dependencies);
187
187
  break;
188
188
  }
@@ -282,7 +282,14 @@ var import_tar = require("tar");
282
282
  async function getRepoInfo(url, examplePath) {
283
283
  const [, username, name2, t, _branch, ...file] = url.pathname.split("/");
284
284
  const filePath = examplePath ? examplePath.replace(/^\//, "") : file.join("/");
285
- if (t === void 0 || t === "" && _branch === void 0) {
285
+ if (
286
+ // Support repos whose entire purpose is to be a Next.js example, e.g.
287
+ // https://github.com/:username/:my-cool-nextjs-example-repo-name.
288
+ t === void 0 || // Support GitHub URL that ends with a trailing slash, e.g.
289
+ // https://github.com/:username/:my-cool-nextjs-example-repo-name/
290
+ // In this case "t" will be an empty string while the next part "_branch" will be undefined
291
+ t === "" && _branch === void 0
292
+ ) {
286
293
  try {
287
294
  const infoResponse = await fetch(
288
295
  `https://api.github.com/repos/${username}/${name2}`
@@ -334,6 +341,13 @@ var TEMPLATES = [
334
341
  isInternal: false,
335
342
  gitURL: "https://github.com/tinacms/tina-cloud-starter"
336
343
  },
344
+ {
345
+ title: "Astro Starter",
346
+ description: "Get started with Astro - a modern static site generator designed for fast, lightweight, and flexible web projects.",
347
+ value: "tina-astro-starter",
348
+ isInternal: false,
349
+ gitURL: "https://github.com/tinacms/tina-astro-starter"
350
+ },
337
351
  {
338
352
  title: "Hugo Starter",
339
353
  description: "With Hugo, you wield the power of lightning-fast site generation, crafting web experiences at the speed of thought.",
@@ -383,16 +397,20 @@ async function downloadTemplate(template, root) {
383
397
  }
384
398
 
385
399
  // src/util/preRunChecks.ts
386
- var SUPPORTED_NODE_VERSIONS = ["18", "20", "22"];
400
+ var SUPPORTED_NODE_VERSION_BOUNDS = { oldest: 18, latest: 22 };
401
+ var SUPPORTED_NODE_VERSION_RANGE = [
402
+ ...Array(SUPPORTED_NODE_VERSION_BOUNDS.latest).keys()
403
+ ].map((i) => i + SUPPORTED_NODE_VERSION_BOUNDS.oldest);
404
+ var isSupported = SUPPORTED_NODE_VERSION_RANGE.some(
405
+ (version2) => process.version.startsWith(`v${version2}`)
406
+ );
387
407
  function preRunChecks() {
388
408
  checkSupportedNodeVersion();
389
409
  }
390
410
  function checkSupportedNodeVersion() {
391
- if (!SUPPORTED_NODE_VERSIONS.some(
392
- (version2) => process.version.startsWith(`v${version2}`)
393
- )) {
411
+ if (!isSupported) {
394
412
  log.warn(
395
- `Version ${process.version} of Node.js is not supported in create-tina-app, please update to the latest LTS version. See https://nodejs.org/en/download/ for more details.`
413
+ `Node ${process.version} is not supported by create-tina-app. Please update to be within v${SUPPORTED_NODE_VERSION_BOUNDS.oldest}-v${SUPPORTED_NODE_VERSION_BOUNDS.latest}. See https://nodejs.org/en/download/ for more details.`
396
414
  );
397
415
  }
398
416
  }
@@ -485,8 +503,7 @@ async function run() {
485
503
  return { title: manager, value: manager };
486
504
  })
487
505
  });
488
- if (!Object.hasOwn(res, "packageManager"))
489
- (0, import_node_process.exit)(1);
506
+ if (!Object.hasOwn(res, "packageManager")) (0, import_node_process.exit)(1);
490
507
  pkgManager = res.packageManager;
491
508
  }
492
509
  if (!projectName) {
@@ -499,13 +516,11 @@ async function run() {
499
516
  const { validForNewPackages, errors } = (0, import_validate_npm_package_name.default)(
500
517
  import_node_path.default.basename(import_node_path.default.resolve(name2))
501
518
  );
502
- if (validForNewPackages)
503
- return true;
504
- return "Invalid project name: " + errors[0];
519
+ if (validForNewPackages) return true;
520
+ return `Invalid project name: ${errors[0]}`;
505
521
  }
506
522
  });
507
- if (!Object.hasOwn(res, "name"))
508
- (0, import_node_process.exit)(1);
523
+ if (!Object.hasOwn(res, "name")) (0, import_node_process.exit)(1);
509
524
  projectName = res.name;
510
525
  }
511
526
  if (!template) {
@@ -515,8 +530,7 @@ async function run() {
515
530
  message: "What starter code would you like to use?",
516
531
  choices: TEMPLATES
517
532
  });
518
- if (!Object.hasOwn(res, "template"))
519
- (0, import_node_process.exit)(1);
533
+ if (!Object.hasOwn(res, "template")) (0, import_node_process.exit)(1);
520
534
  template = TEMPLATES.find((_template) => _template.value === res.template);
521
535
  }
522
536
  await telemetry.submitRecord({
@@ -1,2 +1 @@
1
- export declare const SUPPORTED_NODE_VERSIONS: string[];
2
1
  export declare function preRunChecks(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tina-app",
3
- "version": "1.2.5",
3
+ "version": "1.3.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",