create-tina-app 1.0.4 → 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 CHANGED
@@ -1,12 +1,4 @@
1
- Copyright (c) 2023-present Forestry.io Holdings Inc.
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
- > TODO
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
@@ -3,6 +3,7 @@
3
3
  */
4
4
  declare type BaseExample = {
5
5
  title: string;
6
+ description?: string;
6
7
  value: string;
7
8
  };
8
9
  export declare type InternalExample = BaseExample & {
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 __reExport = (target, module2, desc) => {
31
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
32
- for (let key of __getOwnPropNames(module2))
33
- if (!__hasOwnProp.call(target, key) && key !== "default")
34
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
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 target;
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
- __export(exports, {
26
+ var src_exports = {};
27
+ __export(src_exports, {
44
28
  run: () => run
45
29
  });
46
- var import_metrics = __toModule(require("@tinacms/metrics"));
47
- var import_commander = __toModule(require("commander"));
48
- var import_prompts = __toModule(require("prompts"));
49
- var import_path4 = __toModule(require("path"));
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.4";
38
+ var version = "1.0.5";
54
39
 
55
40
  // src/util/fileUtil.ts
56
- var import_fs_extra = __toModule(require("fs-extra"));
57
- var import_path = __toModule(require("path"));
58
- var import_chalk = __toModule(require("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(`The directory ${import_chalk.default.green(name2)} contains files that could conflict:`);
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("Either try using a new directory name, or remove the files listed above.");
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 = __toModule(require("chalk"));
117
- var import_cross_spawn = __toModule(require("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
- let command = useYarn ? "yarnpkg" : "npm";
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: __spreadProps(__spreadValues({}, process.env), { ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" })
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 = __toModule(require("chalk"));
163
+ var import_chalk5 = __toESM(require("chalk"));
175
164
 
176
165
  // src/util/git.ts
177
- var import_child_process = __toModule(require("child_process"));
178
- var import_path2 = __toModule(require("path"));
179
- var import_rimraf = __toModule(require("rimraf"));
180
- var import_fs_extra2 = __toModule(require("fs-extra"));
181
- var import_chalk3 = __toModule(require("chalk"));
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(import_chalk3.default.yellow("There is no .gitignore file in this repository, creating one..."));
207
- import_fs_extra2.default.writeFileSync(".gitignore", `node_modules
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 = __toModule(require("process"));
230
+ var import_process = require("process");
235
231
 
236
232
  // src/util/examples.ts
237
- var import_got = __toModule(require("got"));
238
- var import_stream = __toModule(require("stream"));
239
- var import_util = __toModule(require("util"));
240
- var import_tar = __toModule(require("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)(`https://api.github.com/repos/${username}/${name2}`).catch((e) => e);
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,40 +254,53 @@ async function getRepoInfo(url, examplePath) {
256
254
  }
257
255
  }
258
256
  function downloadAndExtractRepo(root, { username, name: name2, branch, filePath }) {
259
- return pipeline(import_got.default.stream(`https://codeload.github.com/${username}/${name2}/tar.gz/${branch}`), import_tar.default.extract({ cwd: root, strip: filePath ? filePath.split("/").length + 1 : 1 }, [`${name2}-${branch}${filePath ? `/${filePath}` : ""}`]));
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 = __toModule(require("chalk"));
264
- var import_fs_extra3 = __toModule(require("fs-extra"));
265
- var import_path3 = __toModule(require("path"));
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"
290
300
  },
291
301
  {
292
302
  title: "Docusaurus Starter",
303
+ description: "Docusaurus empowers you to build and evolve documentation like crafting a living, breathing knowledge repository.",
293
304
  value: "tinasaurus",
294
305
  isInternal: false,
295
306
  gitURL: "https://github.com/tinacms/tinasaurus"
@@ -300,7 +311,11 @@ var downloadExample = async (example, root) => {
300
311
  const repoURL = new URL(example.gitURL);
301
312
  const repoInfo = await getRepoInfo(repoURL);
302
313
  const repoInfo2 = repoInfo;
303
- console.log(`Downloading files from repo ${import_chalk4.default.cyan(repoInfo.username + "/" + repoInfo.name)}. This might take a moment.`);
314
+ console.log(
315
+ `Downloading files from repo ${import_chalk4.default.cyan(
316
+ repoInfo.username + "/" + repoInfo.name
317
+ )}. This might take a moment.`
318
+ );
304
319
  await downloadAndExtractRepo(root, repoInfo2);
305
320
  } else {
306
321
  const exampleFile = import_path3.default.join(__dirname, "..", "examples", example.value);
@@ -311,7 +326,9 @@ var downloadExample = async (example, root) => {
311
326
  // src/util/preRunChecks.ts
312
327
  var preRunChecks = () => {
313
328
  if (process.version.startsWith("v15")) {
314
- console.warn("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");
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
+ );
315
332
  }
316
333
  };
317
334
 
@@ -370,7 +387,11 @@ var run = async () => {
370
387
  }
371
388
  const chosenExample = EXAMPLES.find((x) => x.value === example);
372
389
  if (!chosenExample) {
373
- console.error(`The example provided is not a valid example. Please provide one of the following; ${EXAMPLES.map((x) => x.value)}`);
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
+ );
374
395
  }
375
396
  await telemetry.submitRecord({
376
397
  event: {
@@ -381,8 +402,12 @@ var run = async () => {
381
402
  });
382
403
  const root = import_path4.default.join(process.cwd(), dirName);
383
404
  if (!await isWriteable(import_path4.default.dirname(root))) {
384
- console.error("The application path is not writable, please check folder permissions and try again.");
385
- console.error("It is likely you do not have write permissions for this folder.");
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
+ );
386
411
  process.exit(1);
387
412
  }
388
413
  const appName = import_path4.default.basename(root);
@@ -392,7 +417,9 @@ var run = async () => {
392
417
  process.exit(1);
393
418
  }
394
419
  await downloadExample(chosenExample, root);
395
- console.log(logText("Installing packages. This might take a couple of minutes."));
420
+ console.log(
421
+ logText("Installing packages. This might take a couple of minutes.")
422
+ );
396
423
  console.log();
397
424
  await install(root, null, { useYarn, isOnline: true });
398
425
  if (tryGitInit(root)) {
@@ -402,14 +429,28 @@ var run = async () => {
402
429
  console.log(`${successText("Starter successfully created!")}`);
403
430
  console.log(import_chalk5.default.bold("\nTo launch your app, run:\n"));
404
431
  console.log(" " + cmdText(`cd ${appName}`));
405
- console.log(` ${cmdText(`${displayedCommand} ${useYarn ? "" : "run "}dev`)}`);
432
+ console.log(
433
+ ` ${cmdText(`${displayedCommand} ${useYarn ? "" : "run "}dev`)}`
434
+ );
406
435
  console.log();
407
436
  console.log("Next steps:");
408
437
  console.log();
409
- console.log(`\u2022 \u{1F4DD} Edit some content on ${linkText("http://localhost:3000")} (See ${linkText("https://tina.io/docs/using-tina-editor")})`);
410
- console.log(`\u2022 \u{1F4D6} Learn the basics: ${linkText("https://tina.io/docs/schema/")}`);
411
- console.log(`\u2022 \u{1F58C}\uFE0F Extend Tina with custom field components: ${linkText("https://tina.io/docs/advanced/extending-tina/")}`);
412
- console.log(`\u2022 \u{1F680} Deploy to Production: ${linkText("https://tina.io/docs/tina-cloud/")}`);
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
+ );
413
454
  };
414
455
  run();
415
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.4",
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.0.3",
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",