create-tina-app 1.0.3 → 1.0.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/LICENSE +1 -9
- package/README.md +9 -1
- package/dist/examples.d.ts +1 -0
- package/dist/index.js +121 -74
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Portions of the TinaCMS software are licensed as follows:
|
|
4
|
-
|
|
5
|
-
* All software that resides under the "packages/@tinacms/datalayer/" and the "packages/@tinacms/graphql/" directories (the "Tina Data Layer"), is licensed under the license defined in "packages/@tinacms/datalayer/LICENSE".
|
|
6
|
-
|
|
7
|
-
* All software outside of the above-mentioned directories is available under the "Apache 2.0" license as set forth below.
|
|
8
|
-
|
|
9
|
-
Apache License
|
|
1
|
+
Apache License
|
|
10
2
|
Version 2.0, January 2004
|
|
11
3
|
http://www.apache.org/licenses/
|
|
12
4
|
|
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
# Create Tina App
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Create Tina App is a powerful command-line interface (CLI) tool designed to kickstart your Tina project. It sets up a new Tina project with a simple command, saving you the hassle of manual configuration. This tool provides a solid foundation, allowing you to focus on building your unique content management system. With Create Tina App, starting a new Tina project has never been easier.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
To get started, you need to first build the code - see [contributing](https://github.com/tinacms/tinacms/blob/main/CONTRIBUTING.md).
|
|
8
|
+
|
|
9
|
+
1. run `pnpm link create-tina-app`
|
|
10
|
+
1. Test your changes by running `npx create-tina-app`
|
|
11
|
+
1. Run `pnpm unlink` when done to unlink the local build
|
package/dist/examples.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,61 +1,46 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
7
|
var __export = (target, all) => {
|
|
26
|
-
__markAsModule(target);
|
|
27
8
|
for (var name2 in all)
|
|
28
9
|
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
29
10
|
};
|
|
30
|
-
var
|
|
31
|
-
if (
|
|
32
|
-
for (let key of __getOwnPropNames(
|
|
33
|
-
if (!__hasOwnProp.call(
|
|
34
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
35
16
|
}
|
|
36
|
-
return
|
|
37
|
-
};
|
|
38
|
-
var __toModule = (module2) => {
|
|
39
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
17
|
+
return to;
|
|
40
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
24
|
|
|
42
25
|
// src/index.ts
|
|
43
|
-
|
|
26
|
+
var src_exports = {};
|
|
27
|
+
__export(src_exports, {
|
|
44
28
|
run: () => run
|
|
45
29
|
});
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
var import_metrics = require("@tinacms/metrics");
|
|
32
|
+
var import_commander = require("commander");
|
|
33
|
+
var import_prompts = __toESM(require("prompts"));
|
|
34
|
+
var import_path4 = __toESM(require("path"));
|
|
50
35
|
|
|
51
36
|
// package.json
|
|
52
37
|
var name = "create-tina-app";
|
|
53
|
-
var version = "1.0.
|
|
38
|
+
var version = "1.0.5";
|
|
54
39
|
|
|
55
40
|
// src/util/fileUtil.ts
|
|
56
|
-
var import_fs_extra =
|
|
57
|
-
var import_path =
|
|
58
|
-
var import_chalk =
|
|
41
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
42
|
+
var import_path = __toESM(require("path"));
|
|
43
|
+
var import_chalk = __toESM(require("chalk"));
|
|
59
44
|
async function isWriteable(directory) {
|
|
60
45
|
try {
|
|
61
46
|
await import_fs_extra.default.promises.access(directory, (import_fs_extra.default.constants || import_fs_extra.default).W_OK);
|
|
@@ -90,7 +75,9 @@ function isFolderEmpty(root, name2) {
|
|
|
90
75
|
];
|
|
91
76
|
const conflicts = import_fs_extra.default.readdirSync(root).filter((file) => !validFiles.includes(file)).filter((file) => !/\.iml$/.test(file));
|
|
92
77
|
if (conflicts.length > 0) {
|
|
93
|
-
console.log(
|
|
78
|
+
console.log(
|
|
79
|
+
`The directory ${import_chalk.default.green(name2)} contains files that could conflict:`
|
|
80
|
+
);
|
|
94
81
|
console.log();
|
|
95
82
|
for (const file of conflicts) {
|
|
96
83
|
try {
|
|
@@ -105,7 +92,9 @@ function isFolderEmpty(root, name2) {
|
|
|
105
92
|
}
|
|
106
93
|
}
|
|
107
94
|
console.log();
|
|
108
|
-
console.log(
|
|
95
|
+
console.log(
|
|
96
|
+
"Either try using a new directory name, or remove the files listed above."
|
|
97
|
+
);
|
|
109
98
|
console.log();
|
|
110
99
|
return false;
|
|
111
100
|
}
|
|
@@ -113,14 +102,14 @@ function isFolderEmpty(root, name2) {
|
|
|
113
102
|
}
|
|
114
103
|
|
|
115
104
|
// src/util/install.ts
|
|
116
|
-
var import_chalk2 =
|
|
117
|
-
var import_cross_spawn =
|
|
105
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
106
|
+
var import_cross_spawn = __toESM(require("cross-spawn"));
|
|
118
107
|
function install(root, dependencies, { useYarn, isOnline, devDependencies }) {
|
|
119
108
|
const npmFlags = [];
|
|
120
109
|
const yarnFlags = [];
|
|
121
110
|
return new Promise((resolve, reject) => {
|
|
122
111
|
let args;
|
|
123
|
-
|
|
112
|
+
const command = useYarn ? "yarnpkg" : "npm";
|
|
124
113
|
if (dependencies && dependencies.length) {
|
|
125
114
|
if (useYarn) {
|
|
126
115
|
args = ["add", "--exact"];
|
|
@@ -158,7 +147,7 @@ function install(root, dependencies, { useYarn, isOnline, devDependencies }) {
|
|
|
158
147
|
}
|
|
159
148
|
const child = (0, import_cross_spawn.default)(command, args, {
|
|
160
149
|
stdio: "inherit",
|
|
161
|
-
env:
|
|
150
|
+
env: { ...process.env, ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" }
|
|
162
151
|
});
|
|
163
152
|
child.on("close", (code) => {
|
|
164
153
|
if (code !== 0) {
|
|
@@ -171,14 +160,14 @@ function install(root, dependencies, { useYarn, isOnline, devDependencies }) {
|
|
|
171
160
|
}
|
|
172
161
|
|
|
173
162
|
// src/index.ts
|
|
174
|
-
var import_chalk5 =
|
|
163
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
175
164
|
|
|
176
165
|
// src/util/git.ts
|
|
177
|
-
var import_child_process =
|
|
178
|
-
var import_path2 =
|
|
179
|
-
var import_rimraf =
|
|
180
|
-
var import_fs_extra2 =
|
|
181
|
-
var import_chalk3 =
|
|
166
|
+
var import_child_process = require("child_process");
|
|
167
|
+
var import_path2 = __toESM(require("path"));
|
|
168
|
+
var import_rimraf = __toESM(require("rimraf"));
|
|
169
|
+
var import_fs_extra2 = __toESM(require("fs-extra"));
|
|
170
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
182
171
|
function isInGitRepository() {
|
|
183
172
|
try {
|
|
184
173
|
(0, import_child_process.execSync)("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
|
|
@@ -203,13 +192,20 @@ function tryGitInit(root) {
|
|
|
203
192
|
return false;
|
|
204
193
|
}
|
|
205
194
|
if (!import_fs_extra2.default.existsSync(".gitignore")) {
|
|
206
|
-
console.warn(
|
|
207
|
-
|
|
195
|
+
console.warn(
|
|
196
|
+
import_chalk3.default.yellow(
|
|
197
|
+
"There is no .gitignore file in this repository, creating one..."
|
|
198
|
+
)
|
|
199
|
+
);
|
|
200
|
+
import_fs_extra2.default.writeFileSync(
|
|
201
|
+
".gitignore",
|
|
202
|
+
`node_modules
|
|
208
203
|
.yarn/*
|
|
209
204
|
.DS_Store
|
|
210
205
|
.cache
|
|
211
206
|
.next/
|
|
212
|
-
`
|
|
207
|
+
`
|
|
208
|
+
);
|
|
213
209
|
}
|
|
214
210
|
(0, import_child_process.execSync)("git init", { stdio: "ignore" });
|
|
215
211
|
didInit = true;
|
|
@@ -231,19 +227,21 @@ function tryGitInit(root) {
|
|
|
231
227
|
}
|
|
232
228
|
|
|
233
229
|
// src/index.ts
|
|
234
|
-
var import_process =
|
|
230
|
+
var import_process = require("process");
|
|
235
231
|
|
|
236
232
|
// src/util/examples.ts
|
|
237
|
-
var import_got =
|
|
238
|
-
var import_stream =
|
|
239
|
-
var import_util =
|
|
240
|
-
var import_tar =
|
|
233
|
+
var import_got = __toESM(require("got"));
|
|
234
|
+
var import_stream = require("stream");
|
|
235
|
+
var import_util = require("util");
|
|
236
|
+
var import_tar = __toESM(require("tar"));
|
|
241
237
|
var pipeline = (0, import_util.promisify)(import_stream.Stream.pipeline);
|
|
242
238
|
async function getRepoInfo(url, examplePath) {
|
|
243
239
|
const [, username, name2, t, _branch, ...file] = url.pathname.split("/");
|
|
244
240
|
const filePath = examplePath ? examplePath.replace(/^\//, "") : file.join("/");
|
|
245
241
|
if (t === void 0) {
|
|
246
|
-
const infoResponse = await (0, import_got.default)(
|
|
242
|
+
const infoResponse = await (0, import_got.default)(
|
|
243
|
+
`https://api.github.com/repos/${username}/${name2}`
|
|
244
|
+
).catch((e) => e);
|
|
247
245
|
if (infoResponse.statusCode !== 200) {
|
|
248
246
|
return;
|
|
249
247
|
}
|
|
@@ -256,37 +254,56 @@ async function getRepoInfo(url, examplePath) {
|
|
|
256
254
|
}
|
|
257
255
|
}
|
|
258
256
|
function downloadAndExtractRepo(root, { username, name: name2, branch, filePath }) {
|
|
259
|
-
return pipeline(
|
|
257
|
+
return pipeline(
|
|
258
|
+
import_got.default.stream(
|
|
259
|
+
`https://codeload.github.com/${username}/${name2}/tar.gz/${branch}`
|
|
260
|
+
),
|
|
261
|
+
import_tar.default.extract(
|
|
262
|
+
{ cwd: root, strip: filePath ? filePath.split("/").length + 1 : 1 },
|
|
263
|
+
[`${name2}-${branch}${filePath ? `/${filePath}` : ""}`]
|
|
264
|
+
)
|
|
265
|
+
);
|
|
260
266
|
}
|
|
261
267
|
|
|
262
268
|
// src/examples.ts
|
|
263
|
-
var import_chalk4 =
|
|
264
|
-
var import_fs_extra3 =
|
|
265
|
-
var import_path3 =
|
|
269
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
270
|
+
var import_fs_extra3 = require("fs-extra");
|
|
271
|
+
var import_path3 = __toESM(require("path"));
|
|
266
272
|
var EXAMPLES = [
|
|
267
273
|
{
|
|
268
274
|
title: "Bare bones starter",
|
|
275
|
+
description: "Stripped down to essentials, this starter is the canvas for pure, unadulterated code creativity.",
|
|
269
276
|
value: "basic",
|
|
270
277
|
isInternal: false,
|
|
271
278
|
gitURL: "https://github.com/tinacms/tina-barebones-starter"
|
|
272
279
|
},
|
|
273
280
|
{
|
|
274
|
-
title: "Tailwind Starter",
|
|
281
|
+
title: "\u2B50 Tailwind Starter",
|
|
282
|
+
description: "Choosing Tailwind makes you feel like you are god with CSS. You can do anything.",
|
|
275
283
|
value: "tina-cloud-starter",
|
|
276
284
|
isInternal: false,
|
|
277
285
|
gitURL: "https://github.com/tinacms/tina-cloud-starter"
|
|
278
286
|
},
|
|
279
287
|
{
|
|
280
288
|
title: "Hugo Starter",
|
|
289
|
+
description: "With Hugo, you wield the power of lightning-fast site generation, crafting web experiences at the speed of thought.",
|
|
281
290
|
value: "tina-hugo-starter",
|
|
282
291
|
isInternal: false,
|
|
283
292
|
gitURL: "https://github.com/tinacms/tina-hugo-starter"
|
|
284
293
|
},
|
|
285
294
|
{
|
|
286
295
|
title: "Remix Starter",
|
|
296
|
+
description: "Dive into Remix to orchestrate seamless, interactive user journeys like a maestro of the web.",
|
|
287
297
|
value: "tina-remix-starter",
|
|
288
298
|
isInternal: false,
|
|
289
299
|
gitURL: "https://github.com/tinacms/tina-remix-starter"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
title: "Docusaurus Starter",
|
|
303
|
+
description: "Docusaurus empowers you to build and evolve documentation like crafting a living, breathing knowledge repository.",
|
|
304
|
+
value: "tinasaurus",
|
|
305
|
+
isInternal: false,
|
|
306
|
+
gitURL: "https://github.com/tinacms/tinasaurus"
|
|
290
307
|
}
|
|
291
308
|
];
|
|
292
309
|
var downloadExample = async (example, root) => {
|
|
@@ -294,7 +311,11 @@ var downloadExample = async (example, root) => {
|
|
|
294
311
|
const repoURL = new URL(example.gitURL);
|
|
295
312
|
const repoInfo = await getRepoInfo(repoURL);
|
|
296
313
|
const repoInfo2 = repoInfo;
|
|
297
|
-
console.log(
|
|
314
|
+
console.log(
|
|
315
|
+
`Downloading files from repo ${import_chalk4.default.cyan(
|
|
316
|
+
repoInfo.username + "/" + repoInfo.name
|
|
317
|
+
)}. This might take a moment.`
|
|
318
|
+
);
|
|
298
319
|
await downloadAndExtractRepo(root, repoInfo2);
|
|
299
320
|
} else {
|
|
300
321
|
const exampleFile = import_path3.default.join(__dirname, "..", "examples", example.value);
|
|
@@ -305,7 +326,9 @@ var downloadExample = async (example, root) => {
|
|
|
305
326
|
// src/util/preRunChecks.ts
|
|
306
327
|
var preRunChecks = () => {
|
|
307
328
|
if (process.version.startsWith("v15")) {
|
|
308
|
-
console.warn(
|
|
329
|
+
console.warn(
|
|
330
|
+
"WARNING: Version 15 of Node.js is not supported in create-tina-app, please update to the latest LTS version. See https://nodejs.org/en/download/ for more details"
|
|
331
|
+
);
|
|
309
332
|
}
|
|
310
333
|
};
|
|
311
334
|
|
|
@@ -364,7 +387,11 @@ var run = async () => {
|
|
|
364
387
|
}
|
|
365
388
|
const chosenExample = EXAMPLES.find((x) => x.value === example);
|
|
366
389
|
if (!chosenExample) {
|
|
367
|
-
console.error(
|
|
390
|
+
console.error(
|
|
391
|
+
`The example provided is not a valid example. Please provide one of the following; ${EXAMPLES.map(
|
|
392
|
+
(x) => x.value
|
|
393
|
+
)}`
|
|
394
|
+
);
|
|
368
395
|
}
|
|
369
396
|
await telemetry.submitRecord({
|
|
370
397
|
event: {
|
|
@@ -375,8 +402,12 @@ var run = async () => {
|
|
|
375
402
|
});
|
|
376
403
|
const root = import_path4.default.join(process.cwd(), dirName);
|
|
377
404
|
if (!await isWriteable(import_path4.default.dirname(root))) {
|
|
378
|
-
console.error(
|
|
379
|
-
|
|
405
|
+
console.error(
|
|
406
|
+
"The application path is not writable, please check folder permissions and try again."
|
|
407
|
+
);
|
|
408
|
+
console.error(
|
|
409
|
+
"It is likely you do not have write permissions for this folder."
|
|
410
|
+
);
|
|
380
411
|
process.exit(1);
|
|
381
412
|
}
|
|
382
413
|
const appName = import_path4.default.basename(root);
|
|
@@ -386,7 +417,9 @@ var run = async () => {
|
|
|
386
417
|
process.exit(1);
|
|
387
418
|
}
|
|
388
419
|
await downloadExample(chosenExample, root);
|
|
389
|
-
console.log(
|
|
420
|
+
console.log(
|
|
421
|
+
logText("Installing packages. This might take a couple of minutes.")
|
|
422
|
+
);
|
|
390
423
|
console.log();
|
|
391
424
|
await install(root, null, { useYarn, isOnline: true });
|
|
392
425
|
if (tryGitInit(root)) {
|
|
@@ -396,14 +429,28 @@ var run = async () => {
|
|
|
396
429
|
console.log(`${successText("Starter successfully created!")}`);
|
|
397
430
|
console.log(import_chalk5.default.bold("\nTo launch your app, run:\n"));
|
|
398
431
|
console.log(" " + cmdText(`cd ${appName}`));
|
|
399
|
-
console.log(
|
|
432
|
+
console.log(
|
|
433
|
+
` ${cmdText(`${displayedCommand} ${useYarn ? "" : "run "}dev`)}`
|
|
434
|
+
);
|
|
400
435
|
console.log();
|
|
401
436
|
console.log("Next steps:");
|
|
402
437
|
console.log();
|
|
403
|
-
console.log(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
438
|
+
console.log(
|
|
439
|
+
`\u2022 \u{1F4DD} Edit some content on ${linkText(
|
|
440
|
+
"http://localhost:3000"
|
|
441
|
+
)} (See ${linkText("https://tina.io/docs/using-tina-editor")})`
|
|
442
|
+
);
|
|
443
|
+
console.log(
|
|
444
|
+
`\u2022 \u{1F4D6} Learn the basics: ${linkText("https://tina.io/docs/schema/")}`
|
|
445
|
+
);
|
|
446
|
+
console.log(
|
|
447
|
+
`\u2022 \u{1F58C}\uFE0F Extend Tina with custom field components: ${linkText(
|
|
448
|
+
"https://tina.io/docs/advanced/extending-tina/"
|
|
449
|
+
)}`
|
|
450
|
+
);
|
|
451
|
+
console.log(
|
|
452
|
+
`\u2022 \u{1F680} Deploy to Production: ${linkText("https://tina.io/docs/tina-cloud/")}`
|
|
453
|
+
);
|
|
407
454
|
};
|
|
408
455
|
run();
|
|
409
456
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tina-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "packages/create-tina-app"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@tinacms/scripts": "1.
|
|
29
|
+
"@tinacms/scripts": "1.1.3",
|
|
30
30
|
"@types/fs-extra": "^9.0.13",
|
|
31
31
|
"@types/node": "^16.11.7",
|
|
32
32
|
"@types/prompts": "^2.0.14",
|