create-tina-app 0.0.0-f608f48-20250617065117 → 0.0.0-fbc6afb-20251208042646

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/README.md CHANGED
@@ -6,6 +6,6 @@ Create Tina App is a powerful command-line interface (CLI) tool designed to kick
6
6
 
7
7
  To get started, you need to first build the code - see [contributing](https://github.com/tinacms/tinacms/blob/main/CONTRIBUTING.md).
8
8
 
9
- 1. run `pnpm link create-tina-app`
9
+ 1. run `pnpm link --global`
10
10
  1. Test your changes by running `npx create-tina-app`
11
11
  1. Run `pnpm unlink` when done to unlink the local build
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('../dist')
3
+ import('../dist/index.js');
package/dist/index.d.ts CHANGED
@@ -1,9 +1 @@
1
- /**
2
- * The available package managers a user can use.
3
- * To add a new supported package manager, add the usage command to this list.
4
- * The `PackageManager` type will be automatically updated as a result.
5
- */
6
- declare const PKG_MANAGERS: readonly ["npm", "yarn", "pnpm", "bun"];
7
- export type PackageManager = (typeof PKG_MANAGERS)[number];
8
1
  export declare function run(): Promise<void>;
9
- export {};
package/dist/index.js CHANGED
@@ -1,90 +1,30 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name2 in all)
9
- __defProp(target, name2, { get: all[name2], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
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.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
1
  // src/index.ts
30
- var index_exports = {};
31
- __export(index_exports, {
32
- run: () => run
33
- });
34
- module.exports = __toCommonJS(index_exports);
35
- var import_metrics = require("@tinacms/metrics");
36
- var import_commander = require("commander");
37
- var import_prompts = __toESM(require("prompts"));
38
- var import_node_path = __toESM(require("node:path"));
39
-
40
- // package.json
41
- var name = "create-tina-app";
42
- var version = "1.3.4";
2
+ import { Telemetry } from "@tinacms/metrics";
3
+ import prompts from "prompts";
4
+ import path4 from "node:path";
5
+ import { createRequire } from "node:module";
43
6
 
44
7
  // src/util/fileUtil.ts
45
- var import_fs_extra = __toESM(require("fs-extra"));
46
- var import_path = __toESM(require("path"));
8
+ import fs from "fs-extra";
9
+ import path from "path";
47
10
 
48
- // src/util/logger.ts
49
- var import_chalk = __toESM(require("chalk"));
11
+ // src/util/textstyles.ts
12
+ import chalk from "chalk";
50
13
  var TextStyles = {
51
- link: import_chalk.default.bold.cyan,
52
- cmd: import_chalk.default.inverse,
53
- info: import_chalk.default.blue,
54
- success: import_chalk.default.green,
55
- warn: import_chalk.default.yellow,
56
- err: import_chalk.default.red,
57
- bold: import_chalk.default.bold
14
+ tinaOrange: chalk.hex("#EC4816"),
15
+ link: (url) => `\x1B]8;;${url}\x07${chalk.cyan.underline(url)}\x1B]8;;\x07`,
16
+ cmd: chalk.bgBlackBright.bold.white,
17
+ info: chalk.blue,
18
+ success: chalk.green,
19
+ warn: chalk.yellow,
20
+ err: chalk.red,
21
+ bold: chalk.bold
58
22
  };
59
- var Logger = class {
60
- log(message) {
61
- console.info(message);
62
- }
63
- debug(message) {
64
- console.debug(TextStyles.info(`[DEBUG] ${message}`));
65
- }
66
- info(message) {
67
- console.info(TextStyles.info(`[INFO] ${message}`));
68
- }
69
- success(message) {
70
- console.log(TextStyles.success(`[SUCCESS] ${message}`));
71
- }
72
- cmd(message) {
73
- console.log(TextStyles.cmd(message));
74
- }
75
- warn(message) {
76
- console.warn(TextStyles.warn(`[WARNING] ${message}`));
77
- }
78
- err(message) {
79
- console.error(TextStyles.err(`[ERROR] ${message}`));
80
- }
81
- };
82
- var log = new Logger();
83
23
 
84
24
  // src/util/fileUtil.ts
85
25
  async function isWriteable(directory) {
86
26
  try {
87
- await import_fs_extra.default.promises.access(directory, (import_fs_extra.default.constants || import_fs_extra.default).W_OK);
27
+ await fs.promises.access(directory, (fs.constants || fs).W_OK);
88
28
  return true;
89
29
  } catch (err) {
90
30
  return false;
@@ -111,55 +51,66 @@ function folderContainsInstallConflicts(root) {
111
51
  "yarn-debug.log",
112
52
  "yarn-error.log"
113
53
  ];
114
- const conflicts = import_fs_extra.default.readdirSync(root).filter((file) => !validFiles.includes(file)).filter((file) => !/\.iml$/.test(file));
54
+ const conflicts = fs.readdirSync(root).filter((file) => !validFiles.includes(file)).filter((file) => !/\.iml$/.test(file));
115
55
  return conflicts;
116
56
  }
117
57
  async function setupProjectDirectory(dir) {
118
- const appName = import_path.default.basename(dir);
119
- await import_fs_extra.default.mkdirp(dir);
58
+ const appName = path.basename(dir);
59
+ await fs.mkdirp(dir);
120
60
  process.chdir(dir);
121
61
  const conflicts = folderContainsInstallConflicts(dir);
122
62
  if (conflicts.length > 0) {
123
- log.err(
124
- `The directory '${TextStyles.bold(
125
- appName
126
- )}' contains files that could conflict. Below is a list of conflicts, please remove them and try again.`
127
- );
63
+ const errorMessageLines = [
64
+ `The directory '${TextStyles.bold(appName)}' contains files that could conflict. Below is a list of conflicts, please remove them and try again.`
65
+ ];
128
66
  for (const file of conflicts) {
129
67
  try {
130
- const stats = import_fs_extra.default.lstatSync(import_path.default.join(dir, file));
68
+ const stats = fs.lstatSync(path.join(dir, file));
131
69
  if (stats.isDirectory()) {
132
- log.log(`- ${TextStyles.info(file)}/`);
70
+ errorMessageLines.push(` - ${TextStyles.info(file)}/`);
133
71
  } else {
134
- log.log(`- ${file}`);
72
+ errorMessageLines.push(` - ${file}`);
135
73
  }
136
74
  } catch {
137
- log.log(`- ${file}`);
75
+ errorMessageLines.push(` - ${file}`);
138
76
  }
139
77
  }
140
- process.exit(1);
78
+ throw new Error(errorMessageLines.join("\n"));
141
79
  }
142
80
  return appName;
143
81
  }
144
82
  function updateProjectPackageName(dir, name2) {
145
- const packageJsonPath = import_path.default.join(dir, "package.json");
146
- const packageJson = JSON.parse(import_fs_extra.default.readFileSync(packageJsonPath, "utf8"));
83
+ const packageJsonPath = path.join(dir, "package.json");
84
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
147
85
  packageJson.name = name2;
148
- import_fs_extra.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
86
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
149
87
  }
150
88
  function updateProjectPackageVersion(dir, version2) {
151
- const packageJsonPath = import_path.default.join(dir, "package.json");
152
- const packageJson = JSON.parse(import_fs_extra.default.readFileSync(packageJsonPath, "utf8"));
89
+ const packageJsonPath = path.join(dir, "package.json");
90
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
153
91
  packageJson.version = version2;
154
- import_fs_extra.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
92
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
93
+ }
94
+ async function updateThemeSettings(dir, selectedTheme) {
95
+ const settingsDir = path.join(dir, "content", "settings");
96
+ const configPath = path.join(settingsDir, "config.json");
97
+ await fs.mkdirp(settingsDir);
98
+ let config = {};
99
+ try {
100
+ const existingConfig = await fs.readFile(configPath, "utf8");
101
+ config = JSON.parse(existingConfig);
102
+ } catch (error) {
103
+ }
104
+ config.selectedTheme = selectedTheme;
105
+ await fs.writeFile(configPath, JSON.stringify(config, null, 2));
155
106
  }
156
107
 
157
108
  // src/util/install.ts
158
- var import_cross_spawn = __toESM(require("cross-spawn"));
159
- function install(packageManager) {
109
+ import spawn from "cross-spawn";
110
+ function install(packageManager, verboseOutput) {
160
111
  return new Promise((resolve, reject) => {
161
- const child = (0, import_cross_spawn.default)(packageManager, ["install"], {
162
- stdio: "inherit",
112
+ const child = spawn(packageManager, ["install"], {
113
+ stdio: verboseOutput ? "inherit" : "ignore",
163
114
  env: { ...process.env, ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" }
164
115
  });
165
116
  child.on("close", (code) => {
@@ -173,12 +124,12 @@ function install(packageManager) {
173
124
  }
174
125
 
175
126
  // src/util/git.ts
176
- var import_child_process = require("child_process");
177
- var import_path2 = __toESM(require("path"));
178
- var import_fs_extra2 = __toESM(require("fs-extra"));
127
+ import { execSync } from "child_process";
128
+ import path2 from "path";
129
+ import fs2 from "fs-extra";
179
130
  function isInGitRepository() {
180
131
  try {
181
- (0, import_child_process.execSync)("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
132
+ execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
182
133
  return true;
183
134
  } catch (_) {
184
135
  }
@@ -186,7 +137,7 @@ function isInGitRepository() {
186
137
  }
187
138
  function isInMercurialRepository() {
188
139
  try {
189
- (0, import_child_process.execSync)("hg --cwd . root", { stdio: "ignore" });
140
+ execSync("hg --cwd . root", { stdio: "ignore" });
190
141
  return true;
191
142
  } catch (_) {
192
143
  }
@@ -194,25 +145,27 @@ function isInMercurialRepository() {
194
145
  }
195
146
  function makeFirstCommit(root) {
196
147
  try {
197
- (0, import_child_process.execSync)("git checkout -b main", { stdio: "ignore" });
198
- (0, import_child_process.execSync)("git add -A", { stdio: "ignore" });
199
- (0, import_child_process.execSync)('git commit -m "Initial commit from Create Tina App"', {
148
+ execSync("git checkout -b main", { stdio: "ignore" });
149
+ execSync("git add -A", { stdio: "ignore" });
150
+ execSync('git commit -m "Initial commit from Create Tina App"', {
200
151
  stdio: "ignore"
201
152
  });
202
153
  } catch (err) {
203
- import_fs_extra2.default.removeSync(import_path2.default.join(root, ".git"));
154
+ fs2.removeSync(path2.join(root, ".git"));
204
155
  throw err;
205
156
  }
206
157
  }
207
- function initializeGit() {
208
- (0, import_child_process.execSync)("git --version", { stdio: "ignore" });
158
+ function initializeGit(spinner) {
159
+ execSync("git --version", { stdio: "ignore" });
209
160
  if (isInGitRepository() || isInMercurialRepository()) {
210
- log.warn("Already in a Git repository, skipping.");
161
+ spinner.warn("Already in a Git repository, skipping.");
211
162
  return false;
212
163
  }
213
- if (!import_fs_extra2.default.existsSync(".gitignore")) {
214
- log.warn("There is no .gitignore file in this repository, creating one...");
215
- import_fs_extra2.default.writeFileSync(
164
+ if (!fs2.existsSync(".gitignore")) {
165
+ spinner.warn(
166
+ "There is no .gitignore file in this repository, creating one..."
167
+ );
168
+ fs2.writeFileSync(
216
169
  ".gitignore",
217
170
  `node_modules
218
171
  .yarn/*
@@ -222,14 +175,14 @@ function initializeGit() {
222
175
  `
223
176
  );
224
177
  }
225
- (0, import_child_process.execSync)("git init", { stdio: "ignore" });
178
+ execSync("git init", { stdio: "ignore" });
226
179
  return true;
227
180
  }
228
181
 
229
182
  // src/util/examples.ts
230
- var import_node_stream = require("node:stream");
231
- var import_promises = require("node:stream/promises");
232
- var import_tar = require("tar");
183
+ import { Readable } from "node:stream";
184
+ import { pipeline } from "node:stream/promises";
185
+ import { x } from "tar";
233
186
  async function getRepoInfo(url, examplePath) {
234
187
  const [, username, name2, t, _branch, ...file] = url.pathname.split("/");
235
188
  const filePath = examplePath ? examplePath.replace(/^\//, "") : file.join("/");
@@ -264,14 +217,14 @@ async function downloadTarStream(url) {
264
217
  if (!res.body) {
265
218
  throw new Error(`Failed to download: ${url}`);
266
219
  }
267
- return import_node_stream.Readable.fromWeb(res.body);
220
+ return Readable.fromWeb(res.body);
268
221
  }
269
222
  async function downloadAndExtractRepo(root, { username, name: name2, branch, filePath }) {
270
- await (0, import_promises.pipeline)(
223
+ await pipeline(
271
224
  await downloadTarStream(
272
225
  `https://codeload.github.com/${username}/${name2}/tar.gz/${branch}`
273
226
  ),
274
- (0, import_tar.x)({
227
+ x({
275
228
  cwd: root,
276
229
  strip: filePath ? filePath.split("/").length + 1 : 1,
277
230
  filter: (p) => p.startsWith(
@@ -282,96 +235,108 @@ async function downloadAndExtractRepo(root, { username, name: name2, branch, fil
282
235
  }
283
236
 
284
237
  // src/templates.ts
285
- var import_fs_extra3 = require("fs-extra");
286
- var import_path3 = __toESM(require("path"));
238
+ import { copy } from "fs-extra";
239
+ import path3 from "path";
287
240
  var TEMPLATES = [
288
241
  {
289
242
  title: "\u2B50 NextJS starter",
290
- description: "Kickstart your project with NextJS \u2013 our top recommendation for a seamless, performant, and versatile web experience.",
291
- value: "tina-cloud-starter",
243
+ description: "Kickstart your project with Next.js \u2013 our top recommendation for a seamless, performant, and versatile web experience.",
244
+ value: "tina-nextjs-starter",
245
+ isInternal: false,
246
+ gitURL: "https://github.com/tinacms/tina-nextjs-starter",
247
+ devUrl: "http://localhost:3000"
248
+ },
249
+ {
250
+ title: "\u2B50\uFE0F TinaDocs",
251
+ description: "Get your documentation site up and running with TinaCMS and Next.js in minutes.",
252
+ value: "tina-docs",
292
253
  isInternal: false,
293
- gitURL: "https://github.com/tinacms/tina-cloud-starter"
254
+ gitURL: "https://github.com/tinacms/tina-docs",
255
+ devUrl: "http://localhost:3000"
294
256
  },
295
257
  {
296
258
  title: "Astro Starter",
297
259
  description: "Get started with Astro - a modern static site generator designed for fast, lightweight, and flexible web projects.",
298
260
  value: "tina-astro-starter",
299
261
  isInternal: false,
300
- gitURL: "https://github.com/tinacms/tina-astro-starter"
262
+ gitURL: "https://github.com/tinacms/tina-astro-starter",
263
+ devUrl: "http://localhost:4321"
301
264
  },
302
265
  {
303
266
  title: "Hugo Starter",
304
267
  description: "With Hugo, you wield the power of lightning-fast site generation, crafting web experiences at the speed of thought.",
305
268
  value: "tina-hugo-starter",
306
269
  isInternal: false,
307
- gitURL: "https://github.com/tinacms/tina-hugo-starter"
270
+ gitURL: "https://github.com/tinacms/tina-hugo-starter",
271
+ devUrl: "http://localhost:1313"
308
272
  },
309
273
  {
310
274
  title: "Remix Starter",
311
275
  description: "Dive into Remix to orchestrate seamless, interactive user journeys like a maestro of the web.",
312
276
  value: "tina-remix-starter",
313
277
  isInternal: false,
314
- gitURL: "https://github.com/tinacms/tina-remix-starter"
278
+ gitURL: "https://github.com/tinacms/tina-remix-starter",
279
+ devUrl: "http://localhost:3000"
315
280
  },
316
281
  {
317
282
  title: "Docusaurus Starter",
318
283
  description: "Docusaurus empowers you to build and evolve documentation like crafting a living, breathing knowledge repository.",
319
284
  value: "tinasaurus",
320
285
  isInternal: false,
321
- gitURL: "https://github.com/tinacms/tinasaurus"
286
+ gitURL: "https://github.com/tinacms/tinasaurus",
287
+ devUrl: "http://localhost:3000"
322
288
  },
323
289
  {
324
290
  title: "Bare bones starter",
325
291
  description: "Stripped down to essentials, this starter is the canvas for pure, unadulterated code creativity.",
326
292
  value: "basic",
327
293
  isInternal: false,
328
- gitURL: "https://github.com/tinacms/tina-barebones-starter"
294
+ gitURL: "https://github.com/tinacms/tina-barebones-starter",
295
+ devUrl: "http://localhost:3000"
329
296
  }
330
297
  ];
331
- async function downloadTemplate(template, root) {
298
+ async function downloadTemplate(template, root, spinner) {
332
299
  if (template.isInternal === false) {
333
300
  const repoURL = new URL(template.gitURL);
334
301
  const repoInfo = await getRepoInfo(repoURL);
335
302
  if (!repoInfo) {
336
303
  throw new Error("Repository information not found.");
337
304
  }
338
- log.info(
339
- `Downloading files from repo ${TextStyles.link(
340
- `${repoInfo?.username}/${repoInfo?.name}`
341
- )}.`
342
- );
305
+ spinner.text = `Downloading files from repo ${TextStyles.tinaOrange(
306
+ `${repoInfo?.username}/${repoInfo?.name}`
307
+ )}`;
343
308
  await downloadAndExtractRepo(root, repoInfo);
344
309
  } else {
345
- const templateFile = import_path3.default.join(__dirname, "..", "examples", template.value);
346
- await (0, import_fs_extra3.copy)(`${templateFile}/`, "./");
310
+ const templateFile = path3.join(__dirname, "..", "examples", template.value);
311
+ await copy(`${templateFile}/`, "./");
347
312
  }
348
313
  }
349
314
 
350
315
  // src/util/preRunChecks.ts
351
- var SUPPORTED_NODE_VERSION_BOUNDS = { oldest: 18, latest: 22 };
316
+ var SUPPORTED_NODE_VERSION_BOUNDS = { oldest: 20, latest: 22 };
352
317
  var SUPPORTED_NODE_VERSION_RANGE = [
353
318
  ...Array(SUPPORTED_NODE_VERSION_BOUNDS.latest).keys()
354
319
  ].map((i) => i + SUPPORTED_NODE_VERSION_BOUNDS.oldest);
355
320
  var isSupported = SUPPORTED_NODE_VERSION_RANGE.some(
356
321
  (version2) => process.version.startsWith(`v${version2}`)
357
322
  );
358
- function preRunChecks() {
359
- checkSupportedNodeVersion();
360
- }
361
- function checkSupportedNodeVersion() {
323
+ function preRunChecks(spinner) {
324
+ spinner.start("Running pre-run checks...");
362
325
  if (!isSupported) {
363
- log.warn(
326
+ spinner.warn(
364
327
  `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.`
365
328
  );
329
+ } else {
330
+ spinner.succeed(`Node ${process.version} is supported.`);
366
331
  }
367
332
  }
368
333
 
369
334
  // src/util/checkPkgManagers.ts
370
- var import_child_process2 = require("child_process");
335
+ import { exec } from "child_process";
371
336
  async function checkPackageExists(name2) {
372
337
  try {
373
338
  await new Promise((resolve, reject) => {
374
- (0, import_child_process2.exec)(`${name2} -v`, (error, stdout, stderr) => {
339
+ exec(`${name2} -v`, (error, stdout, stderr) => {
375
340
  if (error) {
376
341
  reject(stderr);
377
342
  }
@@ -385,13 +350,22 @@ async function checkPackageExists(name2) {
385
350
  }
386
351
 
387
352
  // src/index.ts
388
- var import_node_process = require("node:process");
389
- var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"));
353
+ import { exit } from "node:process";
354
+
355
+ // src/util/options.ts
356
+ import { Command } from "commander";
357
+
358
+ // package.json
359
+ var name = "create-tina-app";
360
+ var version = "1.6.2";
361
+
362
+ // src/util/packageManagers.ts
390
363
  var PKG_MANAGERS = ["npm", "yarn", "pnpm", "bun"];
391
- async function run() {
392
- preRunChecks();
364
+
365
+ // src/util/options.ts
366
+ function extractOptions(args) {
393
367
  let projectName = "";
394
- const program = new import_commander.Command(name);
368
+ const program = new Command(name);
395
369
  program.version(version).option(
396
370
  "-t, --template <template>",
397
371
  `Choose which template to start from. Valid templates are: ${TEMPLATES.map(
@@ -403,34 +377,97 @@ async function run() {
403
377
  ).option(
404
378
  "-d, --dir <dir>",
405
379
  "Choose which directory to run this script from."
406
- ).option("--noTelemetry", "Disable anonymous telemetry that is collected.").arguments("[project-directory]").usage(`${TextStyles.success("<project-directory>")} [options]`).action((name2) => {
380
+ ).option("-v, --verbose", "Enable verbose output.").option("--noTelemetry", "Disable anonymous telemetry that is collected.").arguments("[project-directory]").usage(`${TextStyles.success("<project-directory>")} [options]`).action((name2) => {
407
381
  projectName = name2;
408
382
  });
409
- program.parse(process.argv);
383
+ program.parse(args);
410
384
  const opts = program.opts();
411
385
  if (opts.dir) {
412
386
  process.chdir(opts.dir);
413
387
  }
414
- const telemetry = new import_metrics.Telemetry({ disabled: opts?.noTelemetry });
415
- let template = opts.template;
416
- if (template) {
417
- template = TEMPLATES.find((_template) => _template.value === template);
388
+ if (projectName) {
389
+ opts.projectName = projectName;
390
+ }
391
+ return opts;
392
+ }
393
+
394
+ // src/index.ts
395
+ import validate from "validate-npm-package-name";
396
+
397
+ // src/util/asciiArt.ts
398
+ var llama = " :--=: \n :-===- \n -=====- \n -=======. \n .=========-. \n :===========--:\n -=============.\n .==========-:. \n :=========-. \n -=========- \n .==========- \n -==========- \n :===========- \n -=============. \n :==============: \n :===============- \n .:-================- \n ..::---==================== \n ....::::::::::-------============================. \n .---=================================================: \n .-=====================================================- \n:=======================================================. \n .-====================================================. \n .-=================================================. \n :=============================================- \n -============================================. \n .============-:. -==========- \n :=========-: .. -==========. \n -========: :-=- -=========- \n .========. .-==== :=========: \n -=======: :=====. -========: \n -======- -====- -=======: \n -=====: -====: :======. \n .=====. -====. .-====- \n :==== -===- -====: \n -==- :===- :====. ";
399
+ var tinaCms = "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\n \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\n \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D";
400
+
401
+ // src/themes.ts
402
+ var THEMES = [
403
+ {
404
+ title: "Default",
405
+ description: "The default monochromatic theme for your documentation site",
406
+ value: "default"
407
+ },
408
+ {
409
+ title: "Tina",
410
+ description: "The warm color scheme of TinaCMS for your documentation",
411
+ value: "tina"
412
+ },
413
+ {
414
+ title: "Blossom",
415
+ value: "blossom",
416
+ description: "A Blossom theme for your project"
417
+ },
418
+ {
419
+ title: "Lake",
420
+ value: "lake",
421
+ description: "A Lake theme for your project"
422
+ },
423
+ {
424
+ title: "Pine",
425
+ value: "pine",
426
+ description: "A Pine theme for your project"
427
+ },
428
+ {
429
+ title: "Indigo",
430
+ value: "indigo",
431
+ description: "An Indigo theme for your project"
432
+ }
433
+ ];
434
+
435
+ // src/index.ts
436
+ async function run() {
437
+ const ora = (await import("ora")).default;
438
+ let packageManagerInstallationHadError = false;
439
+ if (process.stdout.columns >= 60) {
440
+ console.log(TextStyles.tinaOrange(`${llama}`));
441
+ console.log(TextStyles.tinaOrange(`${tinaCms}`));
442
+ } else {
443
+ console.log(TextStyles.tinaOrange(`\u{1F999} TinaCMS`));
444
+ }
445
+ const require2 = createRequire(import.meta.url);
446
+ const version2 = require2("../package.json").version;
447
+ console.log(`Create Tina App v${version2}`);
448
+ const spinner = ora();
449
+ preRunChecks(spinner);
450
+ const opts = extractOptions(process.argv);
451
+ const telemetry = new Telemetry({ disabled: opts?.noTelemetry });
452
+ let template = null;
453
+ if (opts.template) {
454
+ template = TEMPLATES.find((_template) => _template.value === opts.template);
418
455
  if (!template) {
419
- log.err(
456
+ spinner.fail(
420
457
  `The provided template '${opts.template}' is invalid. Please provide one of the following: ${TEMPLATES.map(
421
458
  (x2) => x2.value
422
459
  )}`
423
460
  );
424
- (0, import_node_process.exit)(1);
461
+ exit(1);
425
462
  }
426
463
  }
427
464
  let pkgManager = opts.pkgManager;
428
465
  if (pkgManager) {
429
466
  if (!PKG_MANAGERS.find((_pkgManager) => _pkgManager === pkgManager)) {
430
- log.err(
467
+ spinner.fail(
431
468
  `The provided package manager '${opts.pkgManager}' is not supported. Please provide one of the following: ${PKG_MANAGERS}`
432
469
  );
433
- (0, import_node_process.exit)(1);
470
+ exit(1);
434
471
  }
435
472
  }
436
473
  if (!pkgManager) {
@@ -441,12 +478,12 @@ async function run() {
441
478
  }
442
479
  }
443
480
  if (installedPkgManagers.length === 0) {
444
- log.err(
481
+ spinner.fail(
445
482
  `You have no supported package managers installed. Please install one of the following: ${PKG_MANAGERS}`
446
483
  );
447
- (0, import_node_process.exit)(1);
484
+ exit(1);
448
485
  }
449
- const res = await (0, import_prompts.default)({
486
+ const res = await prompts({
450
487
  message: "Which package manager would you like to use?",
451
488
  name: "packageManager",
452
489
  type: "select",
@@ -454,94 +491,148 @@ async function run() {
454
491
  return { title: manager, value: manager };
455
492
  })
456
493
  });
457
- if (!Object.hasOwn(res, "packageManager")) (0, import_node_process.exit)(1);
494
+ if (!Object.hasOwn(res, "packageManager")) exit(1);
458
495
  pkgManager = res.packageManager;
459
496
  }
497
+ let projectName = opts.projectName;
460
498
  if (!projectName) {
461
- const res = await (0, import_prompts.default)({
499
+ const res = await prompts({
462
500
  name: "name",
463
501
  type: "text",
464
502
  message: "What is your project named?",
465
503
  initial: "my-tina-app",
466
504
  validate: (name2) => {
467
- const { validForNewPackages, errors } = (0, import_validate_npm_package_name.default)(
468
- import_node_path.default.basename(import_node_path.default.resolve(name2))
505
+ const { validForNewPackages, errors } = validate(
506
+ path4.basename(path4.resolve(name2))
469
507
  );
470
508
  if (validForNewPackages) return true;
471
509
  return `Invalid project name: ${errors[0]}`;
472
510
  }
473
511
  });
474
- if (!Object.hasOwn(res, "name")) (0, import_node_process.exit)(1);
512
+ if (!Object.hasOwn(res, "name")) exit(1);
475
513
  projectName = res.name;
476
514
  }
477
515
  if (!template) {
478
- const res = await (0, import_prompts.default)({
516
+ const res = await prompts({
479
517
  name: "template",
480
518
  type: "select",
481
519
  message: "What starter code would you like to use?",
482
520
  choices: TEMPLATES
483
521
  });
484
- if (!Object.hasOwn(res, "template")) (0, import_node_process.exit)(1);
522
+ if (!Object.hasOwn(res, "template")) exit(1);
485
523
  template = TEMPLATES.find((_template) => _template.value === res.template);
486
524
  }
525
+ let themeChoice;
526
+ if (template.value === "tina-docs") {
527
+ const res = await prompts({
528
+ name: "theme",
529
+ type: "select",
530
+ message: "What theme would you like to use?",
531
+ choices: THEMES
532
+ });
533
+ if (!Object.hasOwn(res, "theme")) exit(1);
534
+ themeChoice = res.theme;
535
+ }
487
536
  await telemetry.submitRecord({
488
537
  event: {
489
538
  name: "create-tina-app:invoke",
490
- template,
539
+ template: template.value,
491
540
  pkgManager
492
541
  }
493
542
  });
494
- const rootDir = import_node_path.default.join(process.cwd(), projectName);
495
- if (!await isWriteable(import_node_path.default.dirname(rootDir))) {
496
- log.err(
543
+ const rootDir = path4.join(process.cwd(), projectName);
544
+ if (!await isWriteable(path4.dirname(rootDir))) {
545
+ spinner.fail(
497
546
  "The application path is not writable, please check folder permissions and try again. It is likely you do not have write permissions for this folder."
498
547
  );
499
548
  process.exit(1);
500
549
  }
501
- const appName = await setupProjectDirectory(rootDir);
550
+ let appName;
502
551
  try {
503
- await downloadTemplate(template, rootDir);
552
+ appName = await setupProjectDirectory(rootDir);
553
+ } catch (err) {
554
+ spinner.fail(err.message);
555
+ exit(1);
556
+ }
557
+ try {
558
+ await downloadTemplate(template, rootDir, spinner);
559
+ if (themeChoice) {
560
+ await updateThemeSettings(rootDir, themeChoice);
561
+ }
562
+ spinner.start("Downloading template...");
563
+ await downloadTemplate(template, rootDir, spinner);
564
+ spinner.succeed();
565
+ spinner.start("Updating project metadata...");
504
566
  updateProjectPackageName(rootDir, projectName);
505
567
  updateProjectPackageVersion(rootDir, "0.0.1");
568
+ spinner.succeed();
569
+ } catch (err) {
570
+ spinner.fail(`Failed to download template: ${err.message}`);
571
+ exit(1);
572
+ }
573
+ spinner.start("Installing packages.");
574
+ try {
575
+ await install(pkgManager, opts.verbose);
576
+ spinner.succeed();
506
577
  } catch (err) {
507
- log.err(`Failed to download template: ${err.message}`);
508
- (0, import_node_process.exit)(1);
578
+ spinner.fail(`Failed to install packages: ${err.message}`);
579
+ packageManagerInstallationHadError = true;
509
580
  }
510
- log.info("Installing packages.");
511
- await install(pkgManager);
512
- log.info("Initializing git repository.");
581
+ spinner.start("Initializing git repository.");
513
582
  try {
514
- if (initializeGit()) {
583
+ if (initializeGit(spinner)) {
515
584
  makeFirstCommit(rootDir);
516
- log.info("Initialized git repository.");
585
+ spinner.succeed();
517
586
  }
518
587
  } catch (err) {
519
- log.err("Failed to initialize Git repository, skipping.");
588
+ spinner.fail("Failed to initialize Git repository, skipping.");
520
589
  }
521
- log.success("Starter successfully created!");
522
- if (template.value === "tina-hugo-starter")
523
- log.warn(
524
- `Hugo is required for this starter. Install it via ${TextStyles.link("https://gohugo.io/installation/")}.`
590
+ spinner.succeed(`Created ${TextStyles.tinaOrange(appName)}
591
+ `);
592
+ if (template.value === "tina-hugo-starter") {
593
+ spinner.warn(
594
+ `Hugo is required for this starter. Install it via ${TextStyles.link(
595
+ "https://gohugo.io/installation/"
596
+ )}
597
+ `
525
598
  );
526
- log.log(TextStyles.bold("\nTo launch your app, run:\n"));
527
- log.cmd(`cd ${appName}
528
- ${pkgManager} run dev`);
529
- log.log(`
530
- Next steps:
531
- \u2022 \u{1F4DD} Edit some content on ${TextStyles.link(
532
- "http://localhost:3000"
533
- )} (See ${TextStyles.link("https://tina.io/docs/using-tina-editor")})
534
- \u2022 \u{1F4D6} Learn the basics: ${TextStyles.link("https://tina.io/docs/schema/")}
535
- \u2022 \u{1F58C}\uFE0F Extend Tina with custom field components: ${TextStyles.link(
536
- "https://tina.io/docs/advanced/extending-tina/"
537
- )}
538
- \u2022 \u{1F680} Deploy to Production: ${TextStyles.link(
539
- "https://tina.io/docs/tina-cloud/"
540
- )}
541
- `);
599
+ }
600
+ const padCommand = (cmd, width = 20) => TextStyles.cmd(cmd) + " ".repeat(Math.max(0, width - cmd.length));
601
+ spinner.info(`${TextStyles.bold("To get started:")}
602
+
603
+ ${padCommand(`cd ${appName}`)}# move into your project directory${packageManagerInstallationHadError ? `
604
+ ${padCommand(`${pkgManager} install`)}# install dependencies` : ""}
605
+ ${padCommand(
606
+ `${pkgManager} run dev`
607
+ )}# start the dev server ${TextStyles.link(template.devUrl)}
608
+ ${padCommand(`${pkgManager} run build`)}# build the app for production
609
+ `);
610
+ console.log("Next steps:");
611
+ console.log(
612
+ ` \u2022 \u{1F4DD} Edit some content: ${TextStyles.link(
613
+ "https://tina.io/docs/using-tina-editor"
614
+ )}`
615
+ );
616
+ console.log(
617
+ ` \u2022 \u{1F4D6} Learn the basics: ${TextStyles.link(
618
+ "https://tina.io/docs/schema/"
619
+ )}`
620
+ );
621
+ console.log(
622
+ ` \u2022 \u{1F58C}\uFE0F Extend Tina with custom field components: ${TextStyles.link(
623
+ "https://tina.io/docs/advanced/extending-tina/"
624
+ )}`
625
+ );
626
+ console.log(
627
+ ` \u2022 \u{1F680} Deploy to Production: ${TextStyles.link(
628
+ "https://tina.io/docs/tinacloud/"
629
+ )}`
630
+ );
542
631
  }
543
- run();
544
- // Annotate the CommonJS export names for ESM import in node:
545
- 0 && (module.exports = {
546
- run
632
+ run().catch((error) => {
633
+ console.error("Error running create-tina-app:", error);
634
+ process.exit(1);
547
635
  });
636
+ export {
637
+ run
638
+ };
@@ -1,7 +1,9 @@
1
- type BaseExample = {
1
+ import { Ora } from 'ora';
2
+ export type BaseExample = {
2
3
  title: string;
3
4
  description?: string;
4
5
  value: string;
6
+ devUrl: string;
5
7
  };
6
8
  export type InternalTemplate = BaseExample & {
7
9
  isInternal: true;
@@ -12,5 +14,4 @@ export type ExternalTemplate = BaseExample & {
12
14
  };
13
15
  export type Template = InternalTemplate | ExternalTemplate;
14
16
  export declare const TEMPLATES: Template[];
15
- export declare function downloadTemplate(template: Template, root: string): Promise<void>;
16
- export {};
17
+ export declare function downloadTemplate(template: Template, root: string, spinner: Ora): Promise<void>;
@@ -0,0 +1,7 @@
1
+ type TinaDocsTheme = {
2
+ title: string;
3
+ value: string;
4
+ description: string;
5
+ };
6
+ export declare const THEMES: TinaDocsTheme[];
7
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const llama: string;
2
+ export declare const tinaCms: string;
@@ -1,2 +1,2 @@
1
- import { PackageManager } from '..';
1
+ import { PackageManager } from './packageManagers';
2
2
  export declare function checkPackageExists(name: PackageManager): Promise<boolean>;
@@ -3,3 +3,4 @@ export declare function folderContainsInstallConflicts(root: string): string[];
3
3
  export declare function setupProjectDirectory(dir: string): Promise<string>;
4
4
  export declare function updateProjectPackageName(dir: string, name: string): void;
5
5
  export declare function updateProjectPackageVersion(dir: string, version: string): void;
6
+ export declare function updateThemeSettings(dir: string, selectedTheme: string): Promise<void>;
@@ -1,2 +1,3 @@
1
+ import { Ora } from 'ora';
1
2
  export declare function makeFirstCommit(root: string): void;
2
- export declare function initializeGit(): boolean;
3
+ export declare function initializeGit(spinner: Ora): boolean;
@@ -1,7 +1,7 @@
1
- import { PackageManager } from '..';
1
+ import { PackageManager } from './packageManagers';
2
2
  /**
3
3
  * Spawn a package manager installation.
4
4
  *
5
5
  * @returns A Promise that resolves once the installation is finished.
6
6
  */
7
- export declare function install(packageManager: PackageManager): Promise<void>;
7
+ export declare function install(packageManager: PackageManager, verboseOutput: boolean): Promise<void>;
@@ -0,0 +1,9 @@
1
+ export interface CreateOptions {
2
+ template: string;
3
+ pkgManager: string;
4
+ dir: string;
5
+ noTelemetry: boolean;
6
+ projectName: string;
7
+ verbose: boolean;
8
+ }
9
+ export declare function extractOptions(args: string[]): CreateOptions;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The available package managers a user can use.
3
+ * To add a new supported package manager, add the usage command to this list.
4
+ * The `PackageManager` type will be automatically updated as a result.
5
+ */
6
+ export declare const PKG_MANAGERS: readonly ["npm", "yarn", "pnpm", "bun"];
7
+ export type PackageManager = (typeof PKG_MANAGERS)[number];
@@ -1 +1,2 @@
1
- export declare function preRunChecks(): void;
1
+ import { Ora } from 'ora';
2
+ export declare function preRunChecks(spinner: Ora): void;
@@ -0,0 +1,10 @@
1
+ export declare const TextStyles: {
2
+ tinaOrange: import("chalk").ChalkInstance;
3
+ link: (url: string) => string;
4
+ cmd: import("chalk").ChalkInstance;
5
+ info: import("chalk").ChalkInstance;
6
+ success: import("chalk").ChalkInstance;
7
+ warn: import("chalk").ChalkInstance;
8
+ err: import("chalk").ChalkInstance;
9
+ bold: import("chalk").ChalkInstance;
10
+ };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "create-tina-app",
3
- "version": "0.0.0-f608f48-20250617065117",
3
+ "version": "0.0.0-fbc6afb-20251208042646",
4
+ "type": "module",
4
5
  "main": "dist/index.js",
5
6
  "files": [
6
7
  "dist",
@@ -35,17 +36,18 @@
35
36
  "@types/prompts": "^2.4.9",
36
37
  "@types/tar": "6.1.13",
37
38
  "typescript": "^5.7.3",
38
- "@tinacms/scripts": "0.0.0-f608f48-20250617065117"
39
+ "@tinacms/scripts": "0.0.0-fbc6afb-20251208042646"
39
40
  },
40
41
  "dependencies": {
41
- "chalk": "4.1.2",
42
+ "chalk": "^5.4.1",
42
43
  "commander": "^12.1.0",
43
44
  "cross-spawn": "^7.0.6",
44
45
  "fs-extra": "^11.3.0",
46
+ "ora": "^8.2.0",
45
47
  "prompts": "^2.4.2",
46
48
  "tar": "7.4.0",
47
49
  "validate-npm-package-name": "^5.0.1",
48
- "@tinacms/metrics": "0.0.0-f608f48-20250617065117"
50
+ "@tinacms/metrics": "0.0.0-fbc6afb-20251208042646"
49
51
  },
50
52
  "scripts": {
51
53
  "types": "pnpm tsc",
@@ -1,20 +0,0 @@
1
- import chalk from 'chalk';
2
- export declare const TextStyles: {
3
- link: chalk.Chalk;
4
- cmd: chalk.Chalk;
5
- info: chalk.Chalk;
6
- success: chalk.Chalk;
7
- warn: chalk.Chalk;
8
- err: chalk.Chalk;
9
- bold: chalk.Chalk;
10
- };
11
- export declare class Logger {
12
- log(message: string): void;
13
- debug(message: string): void;
14
- info(message: string): void;
15
- success(message: string): void;
16
- cmd(message: string): void;
17
- warn(message: string): void;
18
- err(message: string): void;
19
- }
20
- export declare const log: Logger;