create-tina-app 1.1.2 → 1.1.4
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 +0 -3
- package/dist/index.js +61 -43
- package/dist/util/install.d.ts +4 -7
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var import_path4 = __toESM(require("path"));
|
|
|
35
35
|
|
|
36
36
|
// package.json
|
|
37
37
|
var name = "create-tina-app";
|
|
38
|
-
var version = "1.1.
|
|
38
|
+
var version = "1.1.4";
|
|
39
39
|
|
|
40
40
|
// src/util/fileUtil.ts
|
|
41
41
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
@@ -104,46 +104,61 @@ function isFolderEmpty(root, name2) {
|
|
|
104
104
|
// src/util/install.ts
|
|
105
105
|
var import_chalk2 = __toESM(require("chalk"));
|
|
106
106
|
var import_cross_spawn = __toESM(require("cross-spawn"));
|
|
107
|
-
function install(root, dependencies, {
|
|
107
|
+
function install(root, dependencies, { packageManager, isOnline, devDependencies }) {
|
|
108
108
|
const npmFlags = [];
|
|
109
109
|
const yarnFlags = [];
|
|
110
|
+
const pnpmFlags = [];
|
|
110
111
|
return new Promise((resolve, reject) => {
|
|
111
112
|
let args;
|
|
112
|
-
const command =
|
|
113
|
+
const command = packageManager;
|
|
113
114
|
if (dependencies && dependencies.length) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
switch (packageManager) {
|
|
116
|
+
case "yarn":
|
|
117
|
+
args = ["add", "--exact"];
|
|
118
|
+
if (!isOnline)
|
|
119
|
+
args.push("--offline");
|
|
120
|
+
args.push("--cwd", root);
|
|
121
|
+
if (devDependencies)
|
|
122
|
+
args.push("--dev");
|
|
123
|
+
args.push(...dependencies);
|
|
124
|
+
break;
|
|
125
|
+
case "npm":
|
|
126
|
+
args = ["install", "--save-exact"];
|
|
127
|
+
args.push(devDependencies ? "--save-dev" : "--save");
|
|
128
|
+
args.push(...dependencies);
|
|
129
|
+
break;
|
|
130
|
+
case "pnpm":
|
|
131
|
+
args = ["add"];
|
|
132
|
+
if (!isOnline)
|
|
133
|
+
args.push("--offline");
|
|
134
|
+
args.push("--save-exact");
|
|
135
|
+
if (devDependencies)
|
|
136
|
+
args.push("-D");
|
|
137
|
+
args.push(...dependencies);
|
|
138
|
+
break;
|
|
126
139
|
}
|
|
127
140
|
} else {
|
|
128
141
|
args = ["install"];
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
if (!isOnline) {
|
|
143
|
+
console.log(import_chalk2.default.yellow("You appear to be offline."));
|
|
144
|
+
if (packageManager === "yarn") {
|
|
132
145
|
console.log(import_chalk2.default.yellow("Falling back to the local Yarn cache."));
|
|
133
|
-
console.log();
|
|
134
146
|
args.push("--offline");
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
if (!isOnline) {
|
|
138
|
-
console.log(import_chalk2.default.yellow("You appear to be offline."));
|
|
147
|
+
} else {
|
|
139
148
|
console.log();
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
151
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
switch (packageManager) {
|
|
153
|
+
case "yarn":
|
|
154
|
+
args.push(...yarnFlags);
|
|
155
|
+
break;
|
|
156
|
+
case "npm":
|
|
157
|
+
args.push(...npmFlags);
|
|
158
|
+
break;
|
|
159
|
+
case "pnpm":
|
|
160
|
+
args.push(...pnpmFlags);
|
|
161
|
+
break;
|
|
147
162
|
}
|
|
148
163
|
const child = (0, import_cross_spawn.default)(command, args, {
|
|
149
164
|
stdio: "inherit",
|
|
@@ -270,15 +285,8 @@ var import_fs_extra3 = require("fs-extra");
|
|
|
270
285
|
var import_path3 = __toESM(require("path"));
|
|
271
286
|
var EXAMPLES = [
|
|
272
287
|
{
|
|
273
|
-
title: "
|
|
274
|
-
description: "
|
|
275
|
-
value: "basic",
|
|
276
|
-
isInternal: false,
|
|
277
|
-
gitURL: "https://github.com/tinacms/tina-barebones-starter"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
title: "\u2B50 Tailwind Starter",
|
|
281
|
-
description: "Choosing Tailwind makes you feel like you are god with CSS. You can do anything.",
|
|
288
|
+
title: "\u2B50 NextJS starter",
|
|
289
|
+
description: "Kickstart your project with NextJS \u2013 our top recommendation for a seamless, performant, and versatile web experience.",
|
|
282
290
|
value: "tina-cloud-starter",
|
|
283
291
|
isInternal: false,
|
|
284
292
|
gitURL: "https://github.com/tinacms/tina-cloud-starter"
|
|
@@ -310,6 +318,13 @@ var EXAMPLES = [
|
|
|
310
318
|
value: "tinasaurus",
|
|
311
319
|
isInternal: false,
|
|
312
320
|
gitURL: "https://github.com/tinacms/tinasaurus"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
title: "Bare bones starter",
|
|
324
|
+
description: "Stripped down to essentials, this starter is the canvas for pure, unadulterated code creativity.",
|
|
325
|
+
value: "basic",
|
|
326
|
+
isInternal: false,
|
|
327
|
+
gitURL: "https://github.com/tinacms/tina-barebones-starter"
|
|
313
328
|
}
|
|
314
329
|
];
|
|
315
330
|
var downloadExample = async (example, root) => {
|
|
@@ -359,15 +374,16 @@ var run = async () => {
|
|
|
359
374
|
let example = opts.example;
|
|
360
375
|
const res = await (0, import_prompts.default)({
|
|
361
376
|
message: "Which package manager would you like to use?",
|
|
362
|
-
name: "
|
|
377
|
+
name: "packageManager",
|
|
363
378
|
type: "select",
|
|
364
379
|
choices: [
|
|
365
380
|
{ title: "Yarn", value: "yarn" },
|
|
366
|
-
{ title: "NPM", value: "npm" }
|
|
381
|
+
{ title: "NPM", value: "npm" },
|
|
382
|
+
{ title: "pnpm", value: "pnpm" }
|
|
367
383
|
]
|
|
368
384
|
});
|
|
369
|
-
const
|
|
370
|
-
const displayedCommand =
|
|
385
|
+
const packageManager = res.packageManager;
|
|
386
|
+
const displayedCommand = packageManager;
|
|
371
387
|
if (!projectName) {
|
|
372
388
|
const res2 = await (0, import_prompts.default)({
|
|
373
389
|
name: "name",
|
|
@@ -403,7 +419,7 @@ var run = async () => {
|
|
|
403
419
|
event: {
|
|
404
420
|
name: "create-tina-app:invoke",
|
|
405
421
|
example,
|
|
406
|
-
useYarn: Boolean(
|
|
422
|
+
useYarn: Boolean(res.packageManager === "yarn")
|
|
407
423
|
}
|
|
408
424
|
});
|
|
409
425
|
const root = import_path4.default.join(process.cwd(), dirName);
|
|
@@ -427,7 +443,7 @@ var run = async () => {
|
|
|
427
443
|
logText("Installing packages. This might take a couple of minutes.")
|
|
428
444
|
);
|
|
429
445
|
console.log();
|
|
430
|
-
await install(root, null, {
|
|
446
|
+
await install(root, null, { packageManager, isOnline: true });
|
|
431
447
|
if (tryGitInit(root)) {
|
|
432
448
|
console.log(logText("Initializing git repository."));
|
|
433
449
|
console.log();
|
|
@@ -436,7 +452,9 @@ var run = async () => {
|
|
|
436
452
|
console.log(import_chalk5.default.bold("\nTo launch your app, run:\n"));
|
|
437
453
|
console.log(" " + cmdText(`cd ${appName}`));
|
|
438
454
|
console.log(
|
|
439
|
-
` ${cmdText(
|
|
455
|
+
` ${cmdText(
|
|
456
|
+
`${displayedCommand} ${packageManager === "npm" ? "run " : ""}dev`
|
|
457
|
+
)}`
|
|
440
458
|
);
|
|
441
459
|
console.log();
|
|
442
460
|
console.log("Next steps:");
|
package/dist/util/install.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
1
|
interface InstallArgs {
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
3
|
+
* The package manager to use (yarn, npm, pnpm).
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
packageManager: 'yarn' | 'npm' | 'pnpm';
|
|
9
6
|
/**
|
|
10
7
|
* Indicate whether there is an active Internet connection.
|
|
11
8
|
*/
|
|
@@ -16,9 +13,9 @@ interface InstallArgs {
|
|
|
16
13
|
devDependencies?: boolean;
|
|
17
14
|
}
|
|
18
15
|
/**
|
|
19
|
-
* Spawn a package manager installation with
|
|
16
|
+
* Spawn a package manager installation with Yarn, NPM, or PNPM.
|
|
20
17
|
*
|
|
21
18
|
* @returns A Promise that resolves once the installation is finished.
|
|
22
19
|
*/
|
|
23
|
-
export declare function install(root: string, dependencies: string[] | null, {
|
|
20
|
+
export declare function install(root: string, dependencies: string[] | null, { packageManager, isOnline, devDependencies }: InstallArgs): Promise<void>;
|
|
24
21
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tina-app",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"got": "^11.8.5",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "4.4.18",
|
|
44
|
-
"@tinacms/metrics": "1.0.
|
|
44
|
+
"@tinacms/metrics": "1.0.4"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"types": "pnpm tsc",
|