create-tina-app 0.0.0-d80714b-20241205222511 → 0.0.0-e999254-20250610011143
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.d.ts +8 -1
- package/dist/index.js +52 -84
- package/dist/util/checkPkgManagers.d.ts +2 -2
- package/dist/util/install.d.ts +3 -17
- package/dist/util/preRunChecks.d.ts +0 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +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];
|
|
2
8
|
export declare function run(): Promise<void>;
|
|
9
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -17,26 +17,29 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
23
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
28
|
|
|
25
29
|
// src/index.ts
|
|
26
|
-
var
|
|
27
|
-
__export(
|
|
28
|
-
PKG_MANAGERS: () => PKG_MANAGERS,
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
29
32
|
run: () => run
|
|
30
33
|
});
|
|
31
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
32
35
|
var import_metrics = require("@tinacms/metrics");
|
|
33
36
|
var import_commander = require("commander");
|
|
34
37
|
var import_prompts = __toESM(require("prompts"));
|
|
35
|
-
var import_node_path = __toESM(require("path"));
|
|
38
|
+
var import_node_path = __toESM(require("node:path"));
|
|
36
39
|
|
|
37
40
|
// package.json
|
|
38
41
|
var name = "create-tina-app";
|
|
39
|
-
var version = "1.
|
|
42
|
+
var version = "1.3.4";
|
|
40
43
|
|
|
41
44
|
// src/util/fileUtil.ts
|
|
42
45
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
@@ -153,67 +156,15 @@ function updateProjectPackageVersion(dir, version2) {
|
|
|
153
156
|
|
|
154
157
|
// src/util/install.ts
|
|
155
158
|
var import_cross_spawn = __toESM(require("cross-spawn"));
|
|
156
|
-
function install(
|
|
157
|
-
const npmFlags = [];
|
|
158
|
-
const yarnFlags = [];
|
|
159
|
-
const pnpmFlags = [];
|
|
159
|
+
function install(packageManager) {
|
|
160
160
|
return new Promise((resolve, reject) => {
|
|
161
|
-
|
|
162
|
-
const command = packageManager;
|
|
163
|
-
if (dependencies == null ? void 0 : dependencies.length) {
|
|
164
|
-
switch (packageManager) {
|
|
165
|
-
case "yarn":
|
|
166
|
-
args = ["add", "--exact"];
|
|
167
|
-
if (!isOnline)
|
|
168
|
-
args.push("--offline");
|
|
169
|
-
args.push("--cwd", root);
|
|
170
|
-
if (devDependencies)
|
|
171
|
-
args.push("--dev");
|
|
172
|
-
args.push(...dependencies);
|
|
173
|
-
break;
|
|
174
|
-
case "npm":
|
|
175
|
-
args = ["install", "--save-exact"];
|
|
176
|
-
args.push(devDependencies ? "--save-dev" : "--save");
|
|
177
|
-
args.push(...dependencies);
|
|
178
|
-
break;
|
|
179
|
-
case "pnpm":
|
|
180
|
-
args = ["add"];
|
|
181
|
-
if (!isOnline)
|
|
182
|
-
args.push("--offline");
|
|
183
|
-
args.push("--save-exact");
|
|
184
|
-
if (devDependencies)
|
|
185
|
-
args.push("-D");
|
|
186
|
-
args.push(...dependencies);
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
} else {
|
|
190
|
-
args = ["install"];
|
|
191
|
-
if (!isOnline) {
|
|
192
|
-
log.warn("You appear to be offline.");
|
|
193
|
-
if (packageManager === "yarn") {
|
|
194
|
-
log.warn("Falling back to the local Yarn cache.");
|
|
195
|
-
args.push("--offline");
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
switch (packageManager) {
|
|
200
|
-
case "yarn":
|
|
201
|
-
args.push(...yarnFlags);
|
|
202
|
-
break;
|
|
203
|
-
case "npm":
|
|
204
|
-
args.push(...npmFlags);
|
|
205
|
-
break;
|
|
206
|
-
case "pnpm":
|
|
207
|
-
args.push(...pnpmFlags);
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
const child = (0, import_cross_spawn.default)(command, args, {
|
|
161
|
+
const child = (0, import_cross_spawn.default)(packageManager, ["install"], {
|
|
211
162
|
stdio: "inherit",
|
|
212
163
|
env: { ...process.env, ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" }
|
|
213
164
|
});
|
|
214
165
|
child.on("close", (code) => {
|
|
215
166
|
if (code !== 0) {
|
|
216
|
-
reject({ command: `${
|
|
167
|
+
reject({ command: `${packageManager} install` });
|
|
217
168
|
return;
|
|
218
169
|
}
|
|
219
170
|
resolve();
|
|
@@ -276,13 +227,20 @@ function initializeGit() {
|
|
|
276
227
|
}
|
|
277
228
|
|
|
278
229
|
// src/util/examples.ts
|
|
279
|
-
var import_node_stream = require("stream");
|
|
280
|
-
var import_promises = require("stream/promises");
|
|
230
|
+
var import_node_stream = require("node:stream");
|
|
231
|
+
var import_promises = require("node:stream/promises");
|
|
281
232
|
var import_tar = require("tar");
|
|
282
233
|
async function getRepoInfo(url, examplePath) {
|
|
283
234
|
const [, username, name2, t, _branch, ...file] = url.pathname.split("/");
|
|
284
235
|
const filePath = examplePath ? examplePath.replace(/^\//, "") : file.join("/");
|
|
285
|
-
if (
|
|
236
|
+
if (
|
|
237
|
+
// Support repos whose entire purpose is to be a Next.js example, e.g.
|
|
238
|
+
// https://github.com/:username/:my-cool-nextjs-example-repo-name.
|
|
239
|
+
t === void 0 || // Support GitHub URL that ends with a trailing slash, e.g.
|
|
240
|
+
// https://github.com/:username/:my-cool-nextjs-example-repo-name/
|
|
241
|
+
// In this case "t" will be an empty string while the next part "_branch" will be undefined
|
|
242
|
+
t === "" && _branch === void 0
|
|
243
|
+
) {
|
|
286
244
|
try {
|
|
287
245
|
const infoResponse = await fetch(
|
|
288
246
|
`https://api.github.com/repos/${username}/${name2}`
|
|
@@ -334,6 +292,13 @@ var TEMPLATES = [
|
|
|
334
292
|
isInternal: false,
|
|
335
293
|
gitURL: "https://github.com/tinacms/tina-cloud-starter"
|
|
336
294
|
},
|
|
295
|
+
{
|
|
296
|
+
title: "Astro Starter",
|
|
297
|
+
description: "Get started with Astro - a modern static site generator designed for fast, lightweight, and flexible web projects.",
|
|
298
|
+
value: "tina-astro-starter",
|
|
299
|
+
isInternal: false,
|
|
300
|
+
gitURL: "https://github.com/tinacms/tina-astro-starter"
|
|
301
|
+
},
|
|
337
302
|
{
|
|
338
303
|
title: "Hugo Starter",
|
|
339
304
|
description: "With Hugo, you wield the power of lightning-fast site generation, crafting web experiences at the speed of thought.",
|
|
@@ -372,7 +337,7 @@ async function downloadTemplate(template, root) {
|
|
|
372
337
|
}
|
|
373
338
|
log.info(
|
|
374
339
|
`Downloading files from repo ${TextStyles.link(
|
|
375
|
-
`${repoInfo
|
|
340
|
+
`${repoInfo?.username}/${repoInfo?.name}`
|
|
376
341
|
)}.`
|
|
377
342
|
);
|
|
378
343
|
await downloadAndExtractRepo(root, repoInfo);
|
|
@@ -383,16 +348,20 @@ async function downloadTemplate(template, root) {
|
|
|
383
348
|
}
|
|
384
349
|
|
|
385
350
|
// src/util/preRunChecks.ts
|
|
386
|
-
var
|
|
351
|
+
var SUPPORTED_NODE_VERSION_BOUNDS = { oldest: 18, latest: 22 };
|
|
352
|
+
var SUPPORTED_NODE_VERSION_RANGE = [
|
|
353
|
+
...Array(SUPPORTED_NODE_VERSION_BOUNDS.latest).keys()
|
|
354
|
+
].map((i) => i + SUPPORTED_NODE_VERSION_BOUNDS.oldest);
|
|
355
|
+
var isSupported = SUPPORTED_NODE_VERSION_RANGE.some(
|
|
356
|
+
(version2) => process.version.startsWith(`v${version2}`)
|
|
357
|
+
);
|
|
387
358
|
function preRunChecks() {
|
|
388
359
|
checkSupportedNodeVersion();
|
|
389
360
|
}
|
|
390
361
|
function checkSupportedNodeVersion() {
|
|
391
|
-
if (!
|
|
392
|
-
(version2) => process.version.startsWith(`v${version2}`)
|
|
393
|
-
)) {
|
|
362
|
+
if (!isSupported) {
|
|
394
363
|
log.warn(
|
|
395
|
-
`
|
|
364
|
+
`Node ${process.version} is not supported by create-tina-app. Please update to be within v${SUPPORTED_NODE_VERSION_BOUNDS.oldest}-v${SUPPORTED_NODE_VERSION_BOUNDS.latest}. See https://nodejs.org/en/download/ for more details.`
|
|
396
365
|
);
|
|
397
366
|
}
|
|
398
367
|
}
|
|
@@ -416,9 +385,9 @@ async function checkPackageExists(name2) {
|
|
|
416
385
|
}
|
|
417
386
|
|
|
418
387
|
// src/index.ts
|
|
419
|
-
var import_node_process = require("process");
|
|
388
|
+
var import_node_process = require("node:process");
|
|
420
389
|
var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"));
|
|
421
|
-
var PKG_MANAGERS = ["npm", "yarn", "pnpm"];
|
|
390
|
+
var PKG_MANAGERS = ["npm", "yarn", "pnpm", "bun"];
|
|
422
391
|
async function run() {
|
|
423
392
|
preRunChecks();
|
|
424
393
|
let projectName = "";
|
|
@@ -442,7 +411,7 @@ async function run() {
|
|
|
442
411
|
if (opts.dir) {
|
|
443
412
|
process.chdir(opts.dir);
|
|
444
413
|
}
|
|
445
|
-
const telemetry = new import_metrics.Telemetry({ disabled: opts
|
|
414
|
+
const telemetry = new import_metrics.Telemetry({ disabled: opts?.noTelemetry });
|
|
446
415
|
let template = opts.template;
|
|
447
416
|
if (template) {
|
|
448
417
|
template = TEMPLATES.find((_template) => _template.value === template);
|
|
@@ -485,8 +454,7 @@ async function run() {
|
|
|
485
454
|
return { title: manager, value: manager };
|
|
486
455
|
})
|
|
487
456
|
});
|
|
488
|
-
if (!Object.hasOwn(res, "packageManager"))
|
|
489
|
-
(0, import_node_process.exit)(1);
|
|
457
|
+
if (!Object.hasOwn(res, "packageManager")) (0, import_node_process.exit)(1);
|
|
490
458
|
pkgManager = res.packageManager;
|
|
491
459
|
}
|
|
492
460
|
if (!projectName) {
|
|
@@ -499,13 +467,11 @@ async function run() {
|
|
|
499
467
|
const { validForNewPackages, errors } = (0, import_validate_npm_package_name.default)(
|
|
500
468
|
import_node_path.default.basename(import_node_path.default.resolve(name2))
|
|
501
469
|
);
|
|
502
|
-
if (validForNewPackages)
|
|
503
|
-
|
|
504
|
-
return "Invalid project name: " + errors[0];
|
|
470
|
+
if (validForNewPackages) return true;
|
|
471
|
+
return `Invalid project name: ${errors[0]}`;
|
|
505
472
|
}
|
|
506
473
|
});
|
|
507
|
-
if (!Object.hasOwn(res, "name"))
|
|
508
|
-
(0, import_node_process.exit)(1);
|
|
474
|
+
if (!Object.hasOwn(res, "name")) (0, import_node_process.exit)(1);
|
|
509
475
|
projectName = res.name;
|
|
510
476
|
}
|
|
511
477
|
if (!template) {
|
|
@@ -515,8 +481,7 @@ async function run() {
|
|
|
515
481
|
message: "What starter code would you like to use?",
|
|
516
482
|
choices: TEMPLATES
|
|
517
483
|
});
|
|
518
|
-
if (!Object.hasOwn(res, "template"))
|
|
519
|
-
(0, import_node_process.exit)(1);
|
|
484
|
+
if (!Object.hasOwn(res, "template")) (0, import_node_process.exit)(1);
|
|
520
485
|
template = TEMPLATES.find((_template) => _template.value === res.template);
|
|
521
486
|
}
|
|
522
487
|
await telemetry.submitRecord({
|
|
@@ -543,7 +508,7 @@ async function run() {
|
|
|
543
508
|
(0, import_node_process.exit)(1);
|
|
544
509
|
}
|
|
545
510
|
log.info("Installing packages.");
|
|
546
|
-
await install(
|
|
511
|
+
await install(pkgManager);
|
|
547
512
|
log.info("Initializing git repository.");
|
|
548
513
|
try {
|
|
549
514
|
if (initializeGit()) {
|
|
@@ -554,6 +519,10 @@ async function run() {
|
|
|
554
519
|
log.err("Failed to initialize Git repository, skipping.");
|
|
555
520
|
}
|
|
556
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/")}.`
|
|
525
|
+
);
|
|
557
526
|
log.log(TextStyles.bold("\nTo launch your app, run:\n"));
|
|
558
527
|
log.cmd(`cd ${appName}
|
|
559
528
|
${pkgManager} run dev`);
|
|
@@ -574,6 +543,5 @@ Next steps:
|
|
|
574
543
|
run();
|
|
575
544
|
// Annotate the CommonJS export names for ESM import in node:
|
|
576
545
|
0 && (module.exports = {
|
|
577
|
-
PKG_MANAGERS,
|
|
578
546
|
run
|
|
579
547
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function checkPackageExists(name:
|
|
1
|
+
import { PackageManager } from '..';
|
|
2
|
+
export declare function checkPackageExists(name: PackageManager): Promise<boolean>;
|
package/dist/util/install.d.ts
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* The package manager to use (yarn, npm, pnpm).
|
|
4
|
-
*/
|
|
5
|
-
packageManager: 'yarn' | 'npm' | 'pnpm';
|
|
6
|
-
/**
|
|
7
|
-
* Indicate whether there is an active Internet connection.
|
|
8
|
-
*/
|
|
9
|
-
isOnline: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Indicate whether the given dependencies are devDependencies.
|
|
12
|
-
*/
|
|
13
|
-
devDependencies?: boolean;
|
|
14
|
-
}
|
|
1
|
+
import { PackageManager } from '..';
|
|
15
2
|
/**
|
|
16
|
-
* Spawn a package manager installation
|
|
3
|
+
* Spawn a package manager installation.
|
|
17
4
|
*
|
|
18
5
|
* @returns A Promise that resolves once the installation is finished.
|
|
19
6
|
*/
|
|
20
|
-
export declare function install(
|
|
21
|
-
export {};
|
|
7
|
+
export declare function install(packageManager: PackageManager): Promise<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-e999254-20250610011143",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/cross-spawn": "^6.0.6",
|
|
33
33
|
"@types/fs-extra": "^11.0.4",
|
|
34
|
-
"@types/node": "^22.
|
|
34
|
+
"@types/node": "^22.13.1",
|
|
35
35
|
"@types/prompts": "^2.4.9",
|
|
36
36
|
"@types/tar": "6.1.13",
|
|
37
|
-
"typescript": "^5.
|
|
38
|
-
"@tinacms/scripts": "
|
|
37
|
+
"typescript": "^5.7.3",
|
|
38
|
+
"@tinacms/scripts": "0.0.0-e999254-20250610011143"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"chalk": "4.1.2",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
|
-
"cross-spawn": "^7.0.
|
|
44
|
-
"fs-extra": "^11.
|
|
43
|
+
"cross-spawn": "^7.0.6",
|
|
44
|
+
"fs-extra": "^11.3.0",
|
|
45
45
|
"prompts": "^2.4.2",
|
|
46
46
|
"tar": "7.4.0",
|
|
47
47
|
"validate-npm-package-name": "^5.0.1",
|
|
48
|
-
"@tinacms/metrics": "
|
|
48
|
+
"@tinacms/metrics": "0.0.0-e999254-20250610011143"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"types": "pnpm tsc",
|