create-tina-app 1.1.4 → 1.1.5
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 +21 -10
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -31,11 +31,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
31
|
var import_metrics = require("@tinacms/metrics");
|
|
32
32
|
var import_commander = require("commander");
|
|
33
33
|
var import_prompts = __toESM(require("prompts"));
|
|
34
|
-
var
|
|
34
|
+
var import_node_path = __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.5";
|
|
39
39
|
|
|
40
40
|
// src/util/fileUtil.ts
|
|
41
41
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
@@ -111,7 +111,7 @@ function install(root, dependencies, { packageManager, isOnline, devDependencies
|
|
|
111
111
|
return new Promise((resolve, reject) => {
|
|
112
112
|
let args;
|
|
113
113
|
const command = packageManager;
|
|
114
|
-
if (dependencies
|
|
114
|
+
if (dependencies == null ? void 0 : dependencies.length) {
|
|
115
115
|
switch (packageManager) {
|
|
116
116
|
case "yarn":
|
|
117
117
|
args = ["add", "--exact"];
|
|
@@ -241,7 +241,7 @@ function tryGitInit(root) {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
// src/index.ts
|
|
244
|
-
var
|
|
244
|
+
var import_node_process = require("process");
|
|
245
245
|
|
|
246
246
|
// src/util/examples.ts
|
|
247
247
|
var import_got = __toESM(require("got"));
|
|
@@ -334,9 +334,12 @@ var downloadExample = async (example, root) => {
|
|
|
334
334
|
const repoInfo2 = repoInfo;
|
|
335
335
|
console.log(
|
|
336
336
|
`Downloading files from repo ${import_chalk4.default.cyan(
|
|
337
|
-
repoInfo.username
|
|
337
|
+
`${repoInfo == null ? void 0 : repoInfo.username}/${repoInfo == null ? void 0 : repoInfo.name}`
|
|
338
338
|
)}. This might take a moment.`
|
|
339
339
|
);
|
|
340
|
+
if (!repoInfo2) {
|
|
341
|
+
throw new Error("downloadExample Failed. Repo info not found");
|
|
342
|
+
}
|
|
340
343
|
await downloadAndExtractRepo(root, repoInfo2);
|
|
341
344
|
} else {
|
|
342
345
|
const exampleFile = import_path3.default.join(__dirname, "..", "examples", example.value);
|
|
@@ -403,7 +406,7 @@ var run = async () => {
|
|
|
403
406
|
});
|
|
404
407
|
if (typeof res2.example !== "string") {
|
|
405
408
|
console.error(import_chalk5.default.red("Input must be a string"));
|
|
406
|
-
(0,
|
|
409
|
+
(0, import_node_process.exit)(1);
|
|
407
410
|
}
|
|
408
411
|
example = res2.example;
|
|
409
412
|
}
|
|
@@ -422,8 +425,8 @@ var run = async () => {
|
|
|
422
425
|
useYarn: Boolean(res.packageManager === "yarn")
|
|
423
426
|
}
|
|
424
427
|
});
|
|
425
|
-
const root =
|
|
426
|
-
if (!await isWriteable(
|
|
428
|
+
const root = import_node_path.default.join(process.cwd(), dirName);
|
|
429
|
+
if (!await isWriteable(import_node_path.default.dirname(root))) {
|
|
427
430
|
console.error(
|
|
428
431
|
"The application path is not writable, please check folder permissions and try again."
|
|
429
432
|
);
|
|
@@ -432,12 +435,20 @@ var run = async () => {
|
|
|
432
435
|
);
|
|
433
436
|
process.exit(1);
|
|
434
437
|
}
|
|
435
|
-
const appName =
|
|
438
|
+
const appName = import_node_path.default.basename(root);
|
|
436
439
|
await makeDir(root);
|
|
437
440
|
process.chdir(root);
|
|
438
441
|
if (!isFolderEmpty(root, appName)) {
|
|
439
442
|
process.exit(1);
|
|
440
443
|
}
|
|
444
|
+
if (!chosenExample) {
|
|
445
|
+
console.error(
|
|
446
|
+
`The example provided is not a valid example. Please provide one of the following; ${EXAMPLES.map(
|
|
447
|
+
(x) => x.value
|
|
448
|
+
)}`
|
|
449
|
+
);
|
|
450
|
+
throw new Error("Invalid example");
|
|
451
|
+
}
|
|
441
452
|
await downloadExample(chosenExample, root);
|
|
442
453
|
console.log(
|
|
443
454
|
logText("Installing packages. This might take a couple of minutes.")
|
|
@@ -450,7 +461,7 @@ var run = async () => {
|
|
|
450
461
|
}
|
|
451
462
|
console.log(`${successText("Starter successfully created!")}`);
|
|
452
463
|
console.log(import_chalk5.default.bold("\nTo launch your app, run:\n"));
|
|
453
|
-
console.log(
|
|
464
|
+
console.log(` ${cmdText(`cd ${appName}`)}`);
|
|
454
465
|
console.log(
|
|
455
466
|
` ${cmdText(
|
|
456
467
|
`${displayedCommand} ${packageManager === "npm" ? "run " : ""}dev`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tina-app",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
"@types/node": "^16.11.7",
|
|
31
31
|
"@types/prompts": "^2.0.14",
|
|
32
32
|
"@types/tar": "4.0.3",
|
|
33
|
+
"@types/cross-spawn": "^6.0.6",
|
|
33
34
|
"typescript": "4.6.4",
|
|
34
|
-
"@tinacms/scripts": "1.1.
|
|
35
|
+
"@tinacms/scripts": "1.1.6"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"chalk": "^4.1.2",
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
"fs-extra": "^10.0.0",
|
|
41
42
|
"got": "^11.8.5",
|
|
42
43
|
"prompts": "^2.4.2",
|
|
43
|
-
"tar": "
|
|
44
|
-
"@tinacms/metrics": "1.0.
|
|
44
|
+
"tar": "7.4.0",
|
|
45
|
+
"@tinacms/metrics": "1.0.5"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
47
48
|
"types": "pnpm tsc",
|