create-tina-app 1.5.0 → 1.5.2
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 +77 -4
- package/dist/templates.d.ts +1 -2
- package/dist/themes.d.ts +7 -0
- package/dist/util/fileUtil.d.ts +1 -0
- package/package.json +1 -1
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.
|
|
37
|
+
version: "1.5.2",
|
|
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.",
|
|
@@ -427,7 +448,6 @@ async function checkPackageExists(name2) {
|
|
|
427
448
|
|
|
428
449
|
// src/index.ts
|
|
429
450
|
var import_node_process = require("node:process");
|
|
430
|
-
var import_ora = __toESM(require("ora"));
|
|
431
451
|
|
|
432
452
|
// src/util/options.ts
|
|
433
453
|
var import_commander = require("commander");
|
|
@@ -472,8 +492,43 @@ var import_validate_npm_package_name = __toESM(require("validate-npm-package-nam
|
|
|
472
492
|
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
493
|
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
494
|
|
|
495
|
+
// src/themes.ts
|
|
496
|
+
var THEMES = [
|
|
497
|
+
{
|
|
498
|
+
title: "Default",
|
|
499
|
+
description: "The default monochromatic theme for your documentation site",
|
|
500
|
+
value: "default"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
title: "Tina",
|
|
504
|
+
description: "The warm color scheme of TinaCMS for your documentation",
|
|
505
|
+
value: "tina"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
title: "Blossom",
|
|
509
|
+
value: "blossom",
|
|
510
|
+
description: "A Blossom theme for your project"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
title: "Lake",
|
|
514
|
+
value: "lake",
|
|
515
|
+
description: "A Lake theme for your project"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
title: "Pine",
|
|
519
|
+
value: "pine",
|
|
520
|
+
description: "A Pine theme for your project"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
title: "Indigo",
|
|
524
|
+
value: "indigo",
|
|
525
|
+
description: "An Indigo theme for your project"
|
|
526
|
+
}
|
|
527
|
+
];
|
|
528
|
+
|
|
475
529
|
// src/index.ts
|
|
476
530
|
async function run() {
|
|
531
|
+
const ora = (await import("ora")).default;
|
|
477
532
|
if (process.stdout.columns >= 60) {
|
|
478
533
|
console.log(TextStyles.tinaOrange(`${llama}`));
|
|
479
534
|
console.log(TextStyles.tinaOrange(`${tinaCms}`));
|
|
@@ -482,7 +537,7 @@ async function run() {
|
|
|
482
537
|
}
|
|
483
538
|
const version2 = require_package().version;
|
|
484
539
|
console.log(`Create Tina App v${version2}`);
|
|
485
|
-
const spinner = (
|
|
540
|
+
const spinner = ora();
|
|
486
541
|
preRunChecks(spinner);
|
|
487
542
|
const opts = extractOptions(process.argv);
|
|
488
543
|
const telemetry = new import_metrics.Telemetry({ disabled: opts?.noTelemetry });
|
|
@@ -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();
|
|
@@ -638,7 +708,10 @@ async function run() {
|
|
|
638
708
|
` \u2022 \u{1F680} Deploy to Production: ${TextStyles.link("https://tina.io/docs/tina-cloud/")}`
|
|
639
709
|
);
|
|
640
710
|
}
|
|
641
|
-
run()
|
|
711
|
+
run().catch((error) => {
|
|
712
|
+
console.error("Error running create-tina-app:", error);
|
|
713
|
+
process.exit(1);
|
|
714
|
+
});
|
|
642
715
|
// Annotate the CommonJS export names for ESM import in node:
|
|
643
716
|
0 && (module.exports = {
|
|
644
717
|
run
|
package/dist/templates.d.ts
CHANGED
|
@@ -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 {};
|
package/dist/themes.d.ts
ADDED
package/dist/util/fileUtil.d.ts
CHANGED
|
@@ -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>;
|