create-tina-app 1.5.0 → 1.5.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
@@ -34,7 +34,7 @@ var require_package = __commonJS({
34
34
  "package.json"(exports2, module2) {
35
35
  module2.exports = {
36
36
  name: "create-tina-app",
37
- version: "1.5.0",
37
+ version: "1.5.1",
38
38
  main: "dist/index.js",
39
39
  files: [
40
40
  "dist",
@@ -188,6 +188,19 @@ function updateProjectPackageVersion(dir, version2) {
188
188
  packageJson.version = version2;
189
189
  import_fs_extra.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
190
190
  }
191
+ async function updateThemeSettings(dir, selectedTheme) {
192
+ const settingsDir = import_path.default.join(dir, "content", "settings");
193
+ const configPath = import_path.default.join(settingsDir, "config.json");
194
+ await import_fs_extra.default.mkdirp(settingsDir);
195
+ let config = {};
196
+ try {
197
+ const existingConfig = await import_fs_extra.default.readFile(configPath, "utf8");
198
+ config = JSON.parse(existingConfig);
199
+ } catch (error) {
200
+ }
201
+ config.selectedTheme = selectedTheme;
202
+ await import_fs_extra.default.writeFile(configPath, JSON.stringify(config, null, 2));
203
+ }
191
204
 
192
205
  // src/util/install.ts
193
206
  var import_cross_spawn = __toESM(require("cross-spawn"));
@@ -330,6 +343,14 @@ var TEMPLATES = [
330
343
  gitURL: "https://github.com/tinacms/tina-cloud-starter",
331
344
  devUrl: "http://localhost:3000"
332
345
  },
346
+ {
347
+ title: "\u2B50\uFE0F TinaDocs",
348
+ description: "Get your documentation site up and running with TinaCMS and Next.JS in minutes.",
349
+ value: "tina-docs",
350
+ isInternal: false,
351
+ gitURL: "https://github.com/tinacms/tina-docs",
352
+ devUrl: "http://localhost:3000"
353
+ },
333
354
  {
334
355
  title: "Astro Starter",
335
356
  description: "Get started with Astro - a modern static site generator designed for fast, lightweight, and flexible web projects.",
@@ -472,6 +493,40 @@ var import_validate_npm_package_name = __toESM(require("validate-npm-package-nam
472
493
  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 -==- :===- :====. ";
473
494
  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";
474
495
 
496
+ // src/themes.ts
497
+ var THEMES = [
498
+ {
499
+ title: "Default",
500
+ description: "The default monochromatic theme for your documentation site",
501
+ value: "default"
502
+ },
503
+ {
504
+ title: "Tina",
505
+ description: "The warm color scheme of TinaCMS for your documentation",
506
+ value: "tina"
507
+ },
508
+ {
509
+ title: "Blossom",
510
+ value: "blossom",
511
+ description: "A Blossom theme for your project"
512
+ },
513
+ {
514
+ title: "Lake",
515
+ value: "lake",
516
+ description: "A Lake theme for your project"
517
+ },
518
+ {
519
+ title: "Pine",
520
+ value: "pine",
521
+ description: "A Pine theme for your project"
522
+ },
523
+ {
524
+ title: "Indigo",
525
+ value: "indigo",
526
+ description: "An Indigo theme for your project"
527
+ }
528
+ ];
529
+
475
530
  // src/index.ts
476
531
  async function run() {
477
532
  if (process.stdout.columns >= 60) {
@@ -559,6 +614,17 @@ async function run() {
559
614
  if (!Object.hasOwn(res, "template")) (0, import_node_process.exit)(1);
560
615
  template = TEMPLATES.find((_template) => _template.value === res.template);
561
616
  }
617
+ let themeChoice;
618
+ if (template.value === "tina-docs") {
619
+ const res = await (0, import_prompts.default)({
620
+ name: "theme",
621
+ type: "select",
622
+ message: "What theme would you like to use?",
623
+ choices: THEMES
624
+ });
625
+ if (!Object.hasOwn(res, "theme")) (0, import_node_process.exit)(1);
626
+ themeChoice = res.theme;
627
+ }
562
628
  await telemetry.submitRecord({
563
629
  event: {
564
630
  name: "create-tina-app:invoke",
@@ -581,6 +647,10 @@ async function run() {
581
647
  (0, import_node_process.exit)(1);
582
648
  }
583
649
  try {
650
+ await downloadTemplate(template, rootDir, spinner);
651
+ if (themeChoice) {
652
+ await updateThemeSettings(rootDir, themeChoice);
653
+ }
584
654
  spinner.start("Downloading template...");
585
655
  await downloadTemplate(template, rootDir, spinner);
586
656
  spinner.succeed();
@@ -1,5 +1,5 @@
1
1
  import { Ora } from 'ora';
2
- type BaseExample = {
2
+ export type BaseExample = {
3
3
  title: string;
4
4
  description?: string;
5
5
  value: string;
@@ -15,4 +15,3 @@ export type ExternalTemplate = BaseExample & {
15
15
  export type Template = InternalTemplate | ExternalTemplate;
16
16
  export declare const TEMPLATES: Template[];
17
17
  export declare function downloadTemplate(template: Template, root: string, spinner: Ora): Promise<void>;
18
- export {};
@@ -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 {};
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tina-app",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",