create-tina-app 0.0.0-ddc5e8e-20250611011547 → 0.0.0-dde3eb3-20251028070343
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 +1 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.js +284 -111
- package/dist/templates.d.ts +4 -3
- package/dist/themes.d.ts +7 -0
- package/dist/util/asciiArt.d.ts +2 -0
- package/dist/util/checkPkgManagers.d.ts +1 -1
- package/dist/util/fileUtil.d.ts +1 -0
- package/dist/util/git.d.ts +2 -1
- package/dist/util/install.d.ts +2 -2
- package/dist/util/options.d.ts +9 -0
- package/dist/util/packageManagers.d.ts +7 -0
- package/dist/util/preRunChecks.d.ts +2 -1
- package/dist/util/textstyles.d.ts +11 -0
- package/package.json +4 -3
- package/dist/util/logger.d.ts +0 -20
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
|
|
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
|
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
|
@@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
7
10
|
var __export = (target, all) => {
|
|
8
11
|
for (var name2 in all)
|
|
9
12
|
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
@@ -26,6 +29,68 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
29
|
));
|
|
27
30
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
31
|
|
|
32
|
+
// package.json
|
|
33
|
+
var require_package = __commonJS({
|
|
34
|
+
"package.json"(exports2, module2) {
|
|
35
|
+
module2.exports = {
|
|
36
|
+
name: "create-tina-app",
|
|
37
|
+
version: "1.5.2",
|
|
38
|
+
main: "dist/index.js",
|
|
39
|
+
files: [
|
|
40
|
+
"dist",
|
|
41
|
+
"examples",
|
|
42
|
+
"bin/*"
|
|
43
|
+
],
|
|
44
|
+
bin: "bin/create-tina-app",
|
|
45
|
+
typings: "dist/index.d.ts",
|
|
46
|
+
license: "Apache-2.0",
|
|
47
|
+
buildConfig: {
|
|
48
|
+
entryPoints: [
|
|
49
|
+
{
|
|
50
|
+
name: "src/index.ts",
|
|
51
|
+
target: "node"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
engines: {
|
|
56
|
+
node: ">=18.18.0"
|
|
57
|
+
},
|
|
58
|
+
scripts: {
|
|
59
|
+
types: "pnpm tsc",
|
|
60
|
+
build: "tinacms-scripts build",
|
|
61
|
+
"test-run-bin": "pnpm create-tina-app"
|
|
62
|
+
},
|
|
63
|
+
publishConfig: {
|
|
64
|
+
registry: "https://registry.npmjs.org"
|
|
65
|
+
},
|
|
66
|
+
repository: {
|
|
67
|
+
url: "https://github.com/tinacms/tinacms.git",
|
|
68
|
+
directory: "packages/create-tina-app"
|
|
69
|
+
},
|
|
70
|
+
devDependencies: {
|
|
71
|
+
"@tinacms/scripts": "workspace:*",
|
|
72
|
+
"@types/cross-spawn": "catalog:",
|
|
73
|
+
"@types/fs-extra": "^11.0.4",
|
|
74
|
+
"@types/node": "^22.13.1",
|
|
75
|
+
"@types/prompts": "catalog:",
|
|
76
|
+
"@types/tar": "catalog:",
|
|
77
|
+
typescript: "^5.7.3"
|
|
78
|
+
},
|
|
79
|
+
dependencies: {
|
|
80
|
+
"@tinacms/metrics": "workspace:*",
|
|
81
|
+
chalk: "4.1.2",
|
|
82
|
+
commander: "^12.1.0",
|
|
83
|
+
"cross-spawn": "catalog:",
|
|
84
|
+
"fs-extra": "catalog:",
|
|
85
|
+
ora: "catalog:",
|
|
86
|
+
prompts: "catalog:",
|
|
87
|
+
tar: "catalog:",
|
|
88
|
+
"validate-npm-package-name": "catalog:"
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
29
94
|
// src/index.ts
|
|
30
95
|
var index_exports = {};
|
|
31
96
|
__export(index_exports, {
|
|
@@ -33,53 +98,25 @@ __export(index_exports, {
|
|
|
33
98
|
});
|
|
34
99
|
module.exports = __toCommonJS(index_exports);
|
|
35
100
|
var import_metrics = require("@tinacms/metrics");
|
|
36
|
-
var import_commander = require("commander");
|
|
37
101
|
var import_prompts = __toESM(require("prompts"));
|
|
38
102
|
var import_node_path = __toESM(require("node:path"));
|
|
39
103
|
|
|
40
|
-
// package.json
|
|
41
|
-
var name = "create-tina-app";
|
|
42
|
-
var version = "1.3.4";
|
|
43
|
-
|
|
44
104
|
// src/util/fileUtil.ts
|
|
45
105
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
46
106
|
var import_path = __toESM(require("path"));
|
|
47
107
|
|
|
48
|
-
// src/util/
|
|
108
|
+
// src/util/textstyles.ts
|
|
49
109
|
var import_chalk = __toESM(require("chalk"));
|
|
50
110
|
var TextStyles = {
|
|
51
|
-
|
|
52
|
-
|
|
111
|
+
tinaOrange: import_chalk.default.hex("#EC4816"),
|
|
112
|
+
link: (url) => `\x1B]8;;${url}\x07${import_chalk.default.cyan.underline(url)}\x1B]8;;\x07`,
|
|
113
|
+
cmd: import_chalk.default.bgBlackBright.bold.white,
|
|
53
114
|
info: import_chalk.default.blue,
|
|
54
115
|
success: import_chalk.default.green,
|
|
55
116
|
warn: import_chalk.default.yellow,
|
|
56
117
|
err: import_chalk.default.red,
|
|
57
118
|
bold: import_chalk.default.bold
|
|
58
119
|
};
|
|
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
120
|
|
|
84
121
|
// src/util/fileUtil.ts
|
|
85
122
|
async function isWriteable(directory) {
|
|
@@ -120,24 +157,22 @@ async function setupProjectDirectory(dir) {
|
|
|
120
157
|
process.chdir(dir);
|
|
121
158
|
const conflicts = folderContainsInstallConflicts(dir);
|
|
122
159
|
if (conflicts.length > 0) {
|
|
123
|
-
|
|
124
|
-
`The directory '${TextStyles.bold(
|
|
125
|
-
|
|
126
|
-
)}' contains files that could conflict. Below is a list of conflicts, please remove them and try again.`
|
|
127
|
-
);
|
|
160
|
+
const errorMessageLines = [
|
|
161
|
+
`The directory '${TextStyles.bold(appName)}' contains files that could conflict. Below is a list of conflicts, please remove them and try again.`
|
|
162
|
+
];
|
|
128
163
|
for (const file of conflicts) {
|
|
129
164
|
try {
|
|
130
165
|
const stats = import_fs_extra.default.lstatSync(import_path.default.join(dir, file));
|
|
131
166
|
if (stats.isDirectory()) {
|
|
132
|
-
|
|
167
|
+
errorMessageLines.push(` - ${TextStyles.info(file)}/`);
|
|
133
168
|
} else {
|
|
134
|
-
|
|
169
|
+
errorMessageLines.push(` - ${file}`);
|
|
135
170
|
}
|
|
136
171
|
} catch {
|
|
137
|
-
|
|
172
|
+
errorMessageLines.push(` - ${file}`);
|
|
138
173
|
}
|
|
139
174
|
}
|
|
140
|
-
|
|
175
|
+
throw new Error(errorMessageLines.join("\n"));
|
|
141
176
|
}
|
|
142
177
|
return appName;
|
|
143
178
|
}
|
|
@@ -153,13 +188,26 @@ function updateProjectPackageVersion(dir, version2) {
|
|
|
153
188
|
packageJson.version = version2;
|
|
154
189
|
import_fs_extra.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
155
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
|
+
}
|
|
156
204
|
|
|
157
205
|
// src/util/install.ts
|
|
158
206
|
var import_cross_spawn = __toESM(require("cross-spawn"));
|
|
159
|
-
function install(packageManager) {
|
|
207
|
+
function install(packageManager, verboseOutput) {
|
|
160
208
|
return new Promise((resolve, reject) => {
|
|
161
209
|
const child = (0, import_cross_spawn.default)(packageManager, ["install"], {
|
|
162
|
-
stdio: "inherit",
|
|
210
|
+
stdio: verboseOutput ? "inherit" : "ignore",
|
|
163
211
|
env: { ...process.env, ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" }
|
|
164
212
|
});
|
|
165
213
|
child.on("close", (code) => {
|
|
@@ -204,14 +252,16 @@ function makeFirstCommit(root) {
|
|
|
204
252
|
throw err;
|
|
205
253
|
}
|
|
206
254
|
}
|
|
207
|
-
function initializeGit() {
|
|
255
|
+
function initializeGit(spinner) {
|
|
208
256
|
(0, import_child_process.execSync)("git --version", { stdio: "ignore" });
|
|
209
257
|
if (isInGitRepository() || isInMercurialRepository()) {
|
|
210
|
-
|
|
258
|
+
spinner.warn("Already in a Git repository, skipping.");
|
|
211
259
|
return false;
|
|
212
260
|
}
|
|
213
261
|
if (!import_fs_extra2.default.existsSync(".gitignore")) {
|
|
214
|
-
|
|
262
|
+
spinner.warn(
|
|
263
|
+
"There is no .gitignore file in this repository, creating one..."
|
|
264
|
+
);
|
|
215
265
|
import_fs_extra2.default.writeFileSync(
|
|
216
266
|
".gitignore",
|
|
217
267
|
`node_modules
|
|
@@ -287,59 +337,71 @@ var import_path3 = __toESM(require("path"));
|
|
|
287
337
|
var TEMPLATES = [
|
|
288
338
|
{
|
|
289
339
|
title: "\u2B50 NextJS starter",
|
|
290
|
-
description: "Kickstart your project with
|
|
291
|
-
value: "tina-
|
|
340
|
+
description: "Kickstart your project with Next.js \u2013 our top recommendation for a seamless, performant, and versatile web experience.",
|
|
341
|
+
value: "tina-nextjs-starter",
|
|
342
|
+
isInternal: false,
|
|
343
|
+
gitURL: "https://github.com/tinacms/tina-nextjs-starter",
|
|
344
|
+
devUrl: "http://localhost:3000"
|
|
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",
|
|
292
350
|
isInternal: false,
|
|
293
|
-
gitURL: "https://github.com/tinacms/tina-
|
|
351
|
+
gitURL: "https://github.com/tinacms/tina-docs",
|
|
352
|
+
devUrl: "http://localhost:3000"
|
|
294
353
|
},
|
|
295
354
|
{
|
|
296
355
|
title: "Astro Starter",
|
|
297
356
|
description: "Get started with Astro - a modern static site generator designed for fast, lightweight, and flexible web projects.",
|
|
298
357
|
value: "tina-astro-starter",
|
|
299
358
|
isInternal: false,
|
|
300
|
-
gitURL: "https://github.com/tinacms/tina-astro-starter"
|
|
359
|
+
gitURL: "https://github.com/tinacms/tina-astro-starter",
|
|
360
|
+
devUrl: "http://localhost:4321"
|
|
301
361
|
},
|
|
302
362
|
{
|
|
303
363
|
title: "Hugo Starter",
|
|
304
364
|
description: "With Hugo, you wield the power of lightning-fast site generation, crafting web experiences at the speed of thought.",
|
|
305
365
|
value: "tina-hugo-starter",
|
|
306
366
|
isInternal: false,
|
|
307
|
-
gitURL: "https://github.com/tinacms/tina-hugo-starter"
|
|
367
|
+
gitURL: "https://github.com/tinacms/tina-hugo-starter",
|
|
368
|
+
devUrl: "http://localhost:1313"
|
|
308
369
|
},
|
|
309
370
|
{
|
|
310
371
|
title: "Remix Starter",
|
|
311
372
|
description: "Dive into Remix to orchestrate seamless, interactive user journeys like a maestro of the web.",
|
|
312
373
|
value: "tina-remix-starter",
|
|
313
374
|
isInternal: false,
|
|
314
|
-
gitURL: "https://github.com/tinacms/tina-remix-starter"
|
|
375
|
+
gitURL: "https://github.com/tinacms/tina-remix-starter",
|
|
376
|
+
devUrl: "http://localhost:3000"
|
|
315
377
|
},
|
|
316
378
|
{
|
|
317
379
|
title: "Docusaurus Starter",
|
|
318
380
|
description: "Docusaurus empowers you to build and evolve documentation like crafting a living, breathing knowledge repository.",
|
|
319
381
|
value: "tinasaurus",
|
|
320
382
|
isInternal: false,
|
|
321
|
-
gitURL: "https://github.com/tinacms/tinasaurus"
|
|
383
|
+
gitURL: "https://github.com/tinacms/tinasaurus",
|
|
384
|
+
devUrl: "http://localhost:3000"
|
|
322
385
|
},
|
|
323
386
|
{
|
|
324
387
|
title: "Bare bones starter",
|
|
325
388
|
description: "Stripped down to essentials, this starter is the canvas for pure, unadulterated code creativity.",
|
|
326
389
|
value: "basic",
|
|
327
390
|
isInternal: false,
|
|
328
|
-
gitURL: "https://github.com/tinacms/tina-barebones-starter"
|
|
391
|
+
gitURL: "https://github.com/tinacms/tina-barebones-starter",
|
|
392
|
+
devUrl: "http://localhost:3000"
|
|
329
393
|
}
|
|
330
394
|
];
|
|
331
|
-
async function downloadTemplate(template, root) {
|
|
395
|
+
async function downloadTemplate(template, root, spinner) {
|
|
332
396
|
if (template.isInternal === false) {
|
|
333
397
|
const repoURL = new URL(template.gitURL);
|
|
334
398
|
const repoInfo = await getRepoInfo(repoURL);
|
|
335
399
|
if (!repoInfo) {
|
|
336
400
|
throw new Error("Repository information not found.");
|
|
337
401
|
}
|
|
338
|
-
|
|
339
|
-
`
|
|
340
|
-
|
|
341
|
-
)}.`
|
|
342
|
-
);
|
|
402
|
+
spinner.text = `Downloading files from repo ${TextStyles.tinaOrange(
|
|
403
|
+
`${repoInfo?.username}/${repoInfo?.name}`
|
|
404
|
+
)}`;
|
|
343
405
|
await downloadAndExtractRepo(root, repoInfo);
|
|
344
406
|
} else {
|
|
345
407
|
const templateFile = import_path3.default.join(__dirname, "..", "examples", template.value);
|
|
@@ -348,21 +410,21 @@ async function downloadTemplate(template, root) {
|
|
|
348
410
|
}
|
|
349
411
|
|
|
350
412
|
// src/util/preRunChecks.ts
|
|
351
|
-
var SUPPORTED_NODE_VERSION_BOUNDS = { oldest:
|
|
413
|
+
var SUPPORTED_NODE_VERSION_BOUNDS = { oldest: 20, latest: 22 };
|
|
352
414
|
var SUPPORTED_NODE_VERSION_RANGE = [
|
|
353
415
|
...Array(SUPPORTED_NODE_VERSION_BOUNDS.latest).keys()
|
|
354
416
|
].map((i) => i + SUPPORTED_NODE_VERSION_BOUNDS.oldest);
|
|
355
417
|
var isSupported = SUPPORTED_NODE_VERSION_RANGE.some(
|
|
356
418
|
(version2) => process.version.startsWith(`v${version2}`)
|
|
357
419
|
);
|
|
358
|
-
function preRunChecks() {
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
function checkSupportedNodeVersion() {
|
|
420
|
+
function preRunChecks(spinner) {
|
|
421
|
+
spinner.start("Running pre-run checks...");
|
|
362
422
|
if (!isSupported) {
|
|
363
|
-
|
|
423
|
+
spinner.warn(
|
|
364
424
|
`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
425
|
);
|
|
426
|
+
} else {
|
|
427
|
+
spinner.succeed(`Node ${process.version} is supported.`);
|
|
366
428
|
}
|
|
367
429
|
}
|
|
368
430
|
|
|
@@ -386,13 +448,19 @@ async function checkPackageExists(name2) {
|
|
|
386
448
|
|
|
387
449
|
// src/index.ts
|
|
388
450
|
var import_node_process = require("node:process");
|
|
389
|
-
|
|
451
|
+
|
|
452
|
+
// src/util/options.ts
|
|
453
|
+
var import_commander = require("commander");
|
|
454
|
+
var import_package = __toESM(require_package());
|
|
455
|
+
|
|
456
|
+
// src/util/packageManagers.ts
|
|
390
457
|
var PKG_MANAGERS = ["npm", "yarn", "pnpm", "bun"];
|
|
391
|
-
|
|
392
|
-
|
|
458
|
+
|
|
459
|
+
// src/util/options.ts
|
|
460
|
+
function extractOptions(args) {
|
|
393
461
|
let projectName = "";
|
|
394
|
-
const program = new import_commander.Command(name);
|
|
395
|
-
program.version(version).option(
|
|
462
|
+
const program = new import_commander.Command(import_package.name);
|
|
463
|
+
program.version(import_package.version).option(
|
|
396
464
|
"-t, --template <template>",
|
|
397
465
|
`Choose which template to start from. Valid templates are: ${TEMPLATES.map(
|
|
398
466
|
(x2) => x2.value
|
|
@@ -403,20 +471,82 @@ async function run() {
|
|
|
403
471
|
).option(
|
|
404
472
|
"-d, --dir <dir>",
|
|
405
473
|
"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) => {
|
|
474
|
+
).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
475
|
projectName = name2;
|
|
408
476
|
});
|
|
409
|
-
program.parse(
|
|
477
|
+
program.parse(args);
|
|
410
478
|
const opts = program.opts();
|
|
411
479
|
if (opts.dir) {
|
|
412
480
|
process.chdir(opts.dir);
|
|
413
481
|
}
|
|
482
|
+
if (projectName) {
|
|
483
|
+
opts.projectName = projectName;
|
|
484
|
+
}
|
|
485
|
+
return opts;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// src/index.ts
|
|
489
|
+
var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"));
|
|
490
|
+
|
|
491
|
+
// src/util/asciiArt.ts
|
|
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 -==- :===- :====. ";
|
|
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";
|
|
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
|
+
|
|
529
|
+
// src/index.ts
|
|
530
|
+
async function run() {
|
|
531
|
+
const ora = (await import("ora")).default;
|
|
532
|
+
let packageManagerInstallationHadError = false;
|
|
533
|
+
if (process.stdout.columns >= 60) {
|
|
534
|
+
console.log(TextStyles.tinaOrange(`${llama}`));
|
|
535
|
+
console.log(TextStyles.tinaOrange(`${tinaCms}`));
|
|
536
|
+
} else {
|
|
537
|
+
console.log(TextStyles.tinaOrange(`\u{1F999} TinaCMS`));
|
|
538
|
+
}
|
|
539
|
+
const version2 = require_package().version;
|
|
540
|
+
console.log(`Create Tina App v${version2}`);
|
|
541
|
+
const spinner = ora();
|
|
542
|
+
preRunChecks(spinner);
|
|
543
|
+
const opts = extractOptions(process.argv);
|
|
414
544
|
const telemetry = new import_metrics.Telemetry({ disabled: opts?.noTelemetry });
|
|
415
|
-
let template =
|
|
416
|
-
if (template) {
|
|
417
|
-
template = TEMPLATES.find((_template) => _template.value === template);
|
|
545
|
+
let template = null;
|
|
546
|
+
if (opts.template) {
|
|
547
|
+
template = TEMPLATES.find((_template) => _template.value === opts.template);
|
|
418
548
|
if (!template) {
|
|
419
|
-
|
|
549
|
+
spinner.fail(
|
|
420
550
|
`The provided template '${opts.template}' is invalid. Please provide one of the following: ${TEMPLATES.map(
|
|
421
551
|
(x2) => x2.value
|
|
422
552
|
)}`
|
|
@@ -427,7 +557,7 @@ async function run() {
|
|
|
427
557
|
let pkgManager = opts.pkgManager;
|
|
428
558
|
if (pkgManager) {
|
|
429
559
|
if (!PKG_MANAGERS.find((_pkgManager) => _pkgManager === pkgManager)) {
|
|
430
|
-
|
|
560
|
+
spinner.fail(
|
|
431
561
|
`The provided package manager '${opts.pkgManager}' is not supported. Please provide one of the following: ${PKG_MANAGERS}`
|
|
432
562
|
);
|
|
433
563
|
(0, import_node_process.exit)(1);
|
|
@@ -441,7 +571,7 @@ async function run() {
|
|
|
441
571
|
}
|
|
442
572
|
}
|
|
443
573
|
if (installedPkgManagers.length === 0) {
|
|
444
|
-
|
|
574
|
+
spinner.fail(
|
|
445
575
|
`You have no supported package managers installed. Please install one of the following: ${PKG_MANAGERS}`
|
|
446
576
|
);
|
|
447
577
|
(0, import_node_process.exit)(1);
|
|
@@ -457,6 +587,7 @@ async function run() {
|
|
|
457
587
|
if (!Object.hasOwn(res, "packageManager")) (0, import_node_process.exit)(1);
|
|
458
588
|
pkgManager = res.packageManager;
|
|
459
589
|
}
|
|
590
|
+
let projectName = opts.projectName;
|
|
460
591
|
if (!projectName) {
|
|
461
592
|
const res = await (0, import_prompts.default)({
|
|
462
593
|
name: "name",
|
|
@@ -484,63 +615,105 @@ async function run() {
|
|
|
484
615
|
if (!Object.hasOwn(res, "template")) (0, import_node_process.exit)(1);
|
|
485
616
|
template = TEMPLATES.find((_template) => _template.value === res.template);
|
|
486
617
|
}
|
|
618
|
+
let themeChoice;
|
|
619
|
+
if (template.value === "tina-docs") {
|
|
620
|
+
const res = await (0, import_prompts.default)({
|
|
621
|
+
name: "theme",
|
|
622
|
+
type: "select",
|
|
623
|
+
message: "What theme would you like to use?",
|
|
624
|
+
choices: THEMES
|
|
625
|
+
});
|
|
626
|
+
if (!Object.hasOwn(res, "theme")) (0, import_node_process.exit)(1);
|
|
627
|
+
themeChoice = res.theme;
|
|
628
|
+
}
|
|
487
629
|
await telemetry.submitRecord({
|
|
488
630
|
event: {
|
|
489
631
|
name: "create-tina-app:invoke",
|
|
490
|
-
template,
|
|
632
|
+
template: template.value,
|
|
491
633
|
pkgManager
|
|
492
634
|
}
|
|
493
635
|
});
|
|
494
636
|
const rootDir = import_node_path.default.join(process.cwd(), projectName);
|
|
495
637
|
if (!await isWriteable(import_node_path.default.dirname(rootDir))) {
|
|
496
|
-
|
|
638
|
+
spinner.fail(
|
|
497
639
|
"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
640
|
);
|
|
499
641
|
process.exit(1);
|
|
500
642
|
}
|
|
501
|
-
|
|
643
|
+
let appName;
|
|
644
|
+
try {
|
|
645
|
+
appName = await setupProjectDirectory(rootDir);
|
|
646
|
+
} catch (err) {
|
|
647
|
+
spinner.fail(err.message);
|
|
648
|
+
(0, import_node_process.exit)(1);
|
|
649
|
+
}
|
|
502
650
|
try {
|
|
503
|
-
await downloadTemplate(template, rootDir);
|
|
651
|
+
await downloadTemplate(template, rootDir, spinner);
|
|
652
|
+
if (themeChoice) {
|
|
653
|
+
await updateThemeSettings(rootDir, themeChoice);
|
|
654
|
+
}
|
|
655
|
+
spinner.start("Downloading template...");
|
|
656
|
+
await downloadTemplate(template, rootDir, spinner);
|
|
657
|
+
spinner.succeed();
|
|
658
|
+
spinner.start("Updating project metadata...");
|
|
504
659
|
updateProjectPackageName(rootDir, projectName);
|
|
505
660
|
updateProjectPackageVersion(rootDir, "0.0.1");
|
|
661
|
+
spinner.succeed();
|
|
506
662
|
} catch (err) {
|
|
507
|
-
|
|
663
|
+
spinner.fail(`Failed to download template: ${err.message}`);
|
|
508
664
|
(0, import_node_process.exit)(1);
|
|
509
665
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
666
|
+
spinner.start("Installing packages.");
|
|
667
|
+
try {
|
|
668
|
+
await install(pkgManager, opts.verbose);
|
|
669
|
+
spinner.succeed();
|
|
670
|
+
} catch (err) {
|
|
671
|
+
spinner.fail(`Failed to install packages: ${err.message}`);
|
|
672
|
+
packageManagerInstallationHadError = true;
|
|
673
|
+
}
|
|
674
|
+
spinner.start("Initializing git repository.");
|
|
513
675
|
try {
|
|
514
|
-
if (initializeGit()) {
|
|
676
|
+
if (initializeGit(spinner)) {
|
|
515
677
|
makeFirstCommit(rootDir);
|
|
516
|
-
|
|
678
|
+
spinner.succeed();
|
|
517
679
|
}
|
|
518
680
|
} catch (err) {
|
|
519
|
-
|
|
681
|
+
spinner.fail("Failed to initialize Git repository, skipping.");
|
|
520
682
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
683
|
+
spinner.succeed(`Created ${TextStyles.tinaOrange(appName)}
|
|
684
|
+
`);
|
|
685
|
+
if (template.value === "tina-hugo-starter") {
|
|
686
|
+
spinner.warn(
|
|
687
|
+
`Hugo is required for this starter. Install it via ${TextStyles.link("https://gohugo.io/installation/")}
|
|
688
|
+
`
|
|
525
689
|
);
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
)}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
)}
|
|
541
|
-
|
|
690
|
+
}
|
|
691
|
+
const padCommand = (cmd, width = 20) => TextStyles.cmd(cmd) + " ".repeat(Math.max(0, width - cmd.length));
|
|
692
|
+
spinner.info(`${TextStyles.bold("To get started:")}
|
|
693
|
+
|
|
694
|
+
${padCommand(`cd ${appName}`)}# move into your project directory${packageManagerInstallationHadError ? `
|
|
695
|
+
${padCommand(`${pkgManager} install`)}# install dependencies` : ""}
|
|
696
|
+
${padCommand(`${pkgManager} run dev`)}# start the dev server ${TextStyles.link(template.devUrl)}
|
|
697
|
+
${padCommand(`${pkgManager} run build`)}# build the app for production
|
|
698
|
+
`);
|
|
699
|
+
console.log("Next steps:");
|
|
700
|
+
console.log(
|
|
701
|
+
` \u2022 \u{1F4DD} Edit some content: ${TextStyles.link("https://tina.io/docs/using-tina-editor")}`
|
|
702
|
+
);
|
|
703
|
+
console.log(
|
|
704
|
+
` \u2022 \u{1F4D6} Learn the basics: ${TextStyles.link("https://tina.io/docs/schema/")}`
|
|
705
|
+
);
|
|
706
|
+
console.log(
|
|
707
|
+
` \u2022 \u{1F58C}\uFE0F Extend Tina with custom field components: ${TextStyles.link("https://tina.io/docs/advanced/extending-tina/")}`
|
|
708
|
+
);
|
|
709
|
+
console.log(
|
|
710
|
+
` \u2022 \u{1F680} Deploy to Production: ${TextStyles.link("https://tina.io/docs/tinacloud/")}`
|
|
711
|
+
);
|
|
542
712
|
}
|
|
543
|
-
run()
|
|
713
|
+
run().catch((error) => {
|
|
714
|
+
console.error("Error running create-tina-app:", error);
|
|
715
|
+
process.exit(1);
|
|
716
|
+
});
|
|
544
717
|
// Annotate the CommonJS export names for ESM import in node:
|
|
545
718
|
0 && (module.exports = {
|
|
546
719
|
run
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
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>;
|
package/dist/themes.d.ts
ADDED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PackageManager } from '
|
|
1
|
+
import { PackageManager } from './packageManagers';
|
|
2
2
|
export declare function checkPackageExists(name: PackageManager): Promise<boolean>;
|
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>;
|
package/dist/util/git.d.ts
CHANGED
package/dist/util/install.d.ts
CHANGED
|
@@ -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,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
|
-
|
|
1
|
+
import { Ora } from 'ora';
|
|
2
|
+
export declare function preRunChecks(spinner: Ora): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tina-app",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-dde3eb3-20251028070343",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -35,17 +35,18 @@
|
|
|
35
35
|
"@types/prompts": "^2.4.9",
|
|
36
36
|
"@types/tar": "6.1.13",
|
|
37
37
|
"typescript": "^5.7.3",
|
|
38
|
-
"@tinacms/scripts": "0.0.0-
|
|
38
|
+
"@tinacms/scripts": "0.0.0-dde3eb3-20251028070343"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"chalk": "4.1.2",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"cross-spawn": "^7.0.6",
|
|
44
44
|
"fs-extra": "^11.3.0",
|
|
45
|
+
"ora": "^8.2.0",
|
|
45
46
|
"prompts": "^2.4.2",
|
|
46
47
|
"tar": "7.4.0",
|
|
47
48
|
"validate-npm-package-name": "^5.0.1",
|
|
48
|
-
"@tinacms/metrics": "
|
|
49
|
+
"@tinacms/metrics": "1.1.0"
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
52
|
"types": "pnpm tsc",
|
package/dist/util/logger.d.ts
DELETED
|
@@ -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;
|