create-tina-app 0.1.0 → 0.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/CHANGELOG.md CHANGED
@@ -1,6 +1,38 @@
1
1
  # create-tina-app
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - a05546eb4: Added basic open source telemetry
8
+
9
+ See [this discussion](https://github.com/tinacms/tinacms/discussions/2451) for more information and how to opt out.
10
+
11
+ - Updated dependencies [8bf0ac832]
12
+ - Updated dependencies [a05546eb4]
13
+ - @tinacms/metrics@0.0.2
14
+
15
+ ## 0.1.3
16
+
17
+ ### Patch Changes
18
+
19
+ - d0ac25b73: Update link for bare bones starter
20
+
21
+ ## 0.1.2
22
+
23
+ ### Patch Changes
24
+
25
+ - 371fc73dd: remove tailwind site builder from list of starters
26
+
27
+ ## 0.1.1
28
+
29
+ ### Patch Changes
30
+
31
+ - 127b0ae5d: Use the github URL instead of the local copy
32
+ - 10a36f3a0: Fix issue where startup time was very slow
33
+
3
34
  ## 0.1.0
35
+
4
36
  ### Minor Changes
5
37
 
6
38
  - e792dd0fd: Added basic Create Tina App
package/dist/index.js CHANGED
@@ -1,9 +1,26 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __getProtoOf = Object.getPrototypeOf;
6
9
  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));
7
24
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
25
  var __export = (target, all) => {
9
26
  __markAsModule(target);
@@ -26,13 +43,14 @@ var __toModule = (module2) => {
26
43
  __export(exports, {
27
44
  run: () => run
28
45
  });
46
+ var import_metrics = __toModule(require("@tinacms/metrics"));
29
47
  var import_commander = __toModule(require("commander"));
30
48
  var import_prompts = __toModule(require("prompts"));
31
49
  var import_path4 = __toModule(require("path"));
32
50
 
33
51
  // pnp:/home/runner/work/tinacms/tinacms/packages/create-tina-app/package.json
34
52
  var name = "create-tina-app";
35
- var version = "0.1.0";
53
+ var version = "0.1.4";
36
54
 
37
55
  // pnp:/home/runner/work/tinacms/tinacms/packages/create-tina-app/src/util/fileUtil.ts
38
56
  var import_fs = __toModule(require("fs"));
@@ -140,7 +158,7 @@ function install(root, dependencies, { useYarn, isOnline, devDependencies }) {
140
158
  }
141
159
  const child = (0, import_cross_spawn.default)(command, args, {
142
160
  stdio: "inherit",
143
- env: { ...process.env, ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" }
161
+ env: __spreadProps(__spreadValues({}, process.env), { ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" })
144
162
  });
145
163
  child.on("close", (code) => {
146
164
  if (code !== 0) {
@@ -153,12 +171,14 @@ function install(root, dependencies, { useYarn, isOnline, devDependencies }) {
153
171
  }
154
172
 
155
173
  // pnp:/home/runner/work/tinacms/tinacms/packages/create-tina-app/src/index.ts
156
- var import_chalk4 = __toModule(require("chalk"));
174
+ var import_chalk5 = __toModule(require("chalk"));
157
175
 
158
176
  // pnp:/home/runner/work/tinacms/tinacms/packages/create-tina-app/src/util/git.ts
159
177
  var import_child_process = __toModule(require("child_process"));
160
178
  var import_path2 = __toModule(require("path"));
161
179
  var import_rimraf = __toModule(require("rimraf"));
180
+ var import_fs_extra = __toModule(require("fs-extra"));
181
+ var import_chalk3 = __toModule(require("chalk"));
162
182
  function isInGitRepository() {
163
183
  try {
164
184
  (0, import_child_process.execSync)("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
@@ -182,6 +202,15 @@ function tryGitInit(root) {
182
202
  if (isInGitRepository() || isInMercurialRepository()) {
183
203
  return false;
184
204
  }
205
+ if (!import_fs_extra.default.existsSync(".gitignore")) {
206
+ console.warn(import_chalk3.default.yellow("There is no .gitignore file in this repository, creating one..."));
207
+ import_fs_extra.default.writeFileSync(".gitignore", `node_modules
208
+ .yarn/*
209
+ .DS_Store
210
+ .cache
211
+ .next/
212
+ `);
213
+ }
185
214
  (0, import_child_process.execSync)("git init", { stdio: "ignore" });
186
215
  didInit = true;
187
216
  (0, import_child_process.execSync)("git checkout -b main", { stdio: "ignore" });
@@ -231,11 +260,16 @@ function downloadAndExtractRepo(root, { username, name: name2, branch, filePath
231
260
  }
232
261
 
233
262
  // pnp:/home/runner/work/tinacms/tinacms/packages/create-tina-app/src/examples.ts
234
- var import_chalk3 = __toModule(require("chalk"));
235
- var import_fs_extra = __toModule(require("fs-extra"));
263
+ var import_chalk4 = __toModule(require("chalk"));
264
+ var import_fs_extra2 = __toModule(require("fs-extra"));
236
265
  var import_path3 = __toModule(require("path"));
237
266
  var EXAMPLES = [
238
- { title: "Basic", value: "basic", isInternal: true },
267
+ {
268
+ title: "Bare bones starter",
269
+ value: "basic",
270
+ isInternal: false,
271
+ gitURL: "https://github.com/tinacms/tina-barebones-starter"
272
+ },
239
273
  {
240
274
  title: "Tailwind Starter",
241
275
  value: "tina-cloud-starter",
@@ -247,11 +281,6 @@ var EXAMPLES = [
247
281
  value: "tina-docs-starter",
248
282
  isInternal: false,
249
283
  gitURL: "https://github.com/tinacms/tina-docs-starter"
250
- },
251
- {
252
- title: "Tailwind Site Builder",
253
- value: "tina-tailwind-sidebar-demo",
254
- isInternal: true
255
284
  }
256
285
  ];
257
286
  var downloadExample = async (example, root) => {
@@ -259,18 +288,18 @@ var downloadExample = async (example, root) => {
259
288
  const repoURL = new URL(example.gitURL);
260
289
  const repoInfo = await getRepoInfo(repoURL);
261
290
  const repoInfo2 = repoInfo;
262
- console.log(`Downloading files from repo ${import_chalk3.default.cyan(repoInfo.username + "/" + repoInfo.name)}. This might take a moment.`);
291
+ console.log(`Downloading files from repo ${import_chalk4.default.cyan(repoInfo.username + "/" + repoInfo.name)}. This might take a moment.`);
263
292
  await downloadAndExtractRepo(root, repoInfo2);
264
293
  } else {
265
294
  const exampleFile = import_path3.default.join(__dirname, "..", "examples", example.value);
266
- await (0, import_fs_extra.copy)(`${exampleFile}/`, "./");
295
+ await (0, import_fs_extra2.copy)(`${exampleFile}/`, "./");
267
296
  }
268
297
  };
269
298
 
270
299
  // pnp:/home/runner/work/tinacms/tinacms/packages/create-tina-app/src/index.ts
271
300
  var program = new import_commander.Command(name);
272
301
  var projectName = "";
273
- program.version(version).option("-e, --example <example>", "Choose which example to start from").option("-d, --dir <dir>", "Choose which directory to run this script from").arguments("[project-directory]").usage(`${import_chalk4.default.green("<project-directory>")} [options]`).action((name2) => {
302
+ program.version(version).option("-e, --example <example>", "Choose which example to start from").option("-d, --dir <dir>", "Choose which directory to run this script from").option("--noTelemetry", "Disable anonymous telemetry that is collected").arguments("[project-directory]").usage(`${import_chalk5.default.green("<project-directory>")} [options]`).action((name2) => {
274
303
  projectName = name2;
275
304
  });
276
305
  var run = async () => {
@@ -279,6 +308,7 @@ var run = async () => {
279
308
  if (opts.dir) {
280
309
  process.chdir(opts.dir);
281
310
  }
311
+ const telemetry = new import_metrics.Telemetry({ disabled: opts == null ? void 0 : opts.noTelemetry });
282
312
  let example = opts.example;
283
313
  const res = await (0, import_prompts.default)({
284
314
  message: "Which package manager would you like to use?",
@@ -301,7 +331,6 @@ var run = async () => {
301
331
  projectName = res2.name;
302
332
  }
303
333
  const dirName = projectName;
304
- let isInternalExample = false;
305
334
  if (!example) {
306
335
  const res2 = await (0, import_prompts.default)({
307
336
  name: "example",
@@ -310,7 +339,7 @@ var run = async () => {
310
339
  choices: EXAMPLES
311
340
  });
312
341
  if (typeof res2.example !== "string") {
313
- console.error(import_chalk4.default.red("Input must be a string"));
342
+ console.error(import_chalk5.default.red("Input must be a string"));
314
343
  (0, import_process.exit)(1);
315
344
  }
316
345
  example = res2.example;
@@ -319,6 +348,13 @@ var run = async () => {
319
348
  if (!chosenExample) {
320
349
  console.error(`The example provided is not a valid example. Please provide one of the following; ${EXAMPLES.map((x) => x.value)}`);
321
350
  }
351
+ await telemetry.submitRecord({
352
+ event: {
353
+ name: "create-tina-app:invoke",
354
+ example,
355
+ useYarn: Boolean(useYarn)
356
+ }
357
+ });
322
358
  const root = import_path4.default.join(process.cwd(), dirName);
323
359
  if (!await isWriteable(import_path4.default.dirname(root))) {
324
360
  console.error("The application path is not writable, please check folder permissions and try again.");
@@ -335,29 +371,25 @@ var run = async () => {
335
371
  console.log("Installing packages. This might take a couple of minutes.");
336
372
  console.log();
337
373
  await install(root, null, { useYarn, isOnline: true });
338
- console.log(import_chalk4.default.green("Finished installing all packages"));
374
+ console.log(import_chalk5.default.green("Finished installing all packages"));
339
375
  console.log();
340
376
  if (tryGitInit(root)) {
341
377
  console.log("Initialized a git repository.");
342
378
  console.log();
343
379
  }
344
- console.log(`${import_chalk4.default.green("Success!")} Created ${appName} at ${root}`);
345
- console.log("Inside that directory, you can run several commands:");
346
- console.log();
347
- console.log(import_chalk4.default.cyan(` ${displayedCommand} ${useYarn ? "" : "run "}dev`));
348
- console.log(" Starts the development server.");
349
- console.log();
350
- console.log(import_chalk4.default.cyan(` ${displayedCommand} ${useYarn ? "" : "run "}build`));
351
- console.log(" Builds the app for production.");
352
- console.log();
353
- console.log(import_chalk4.default.cyan(` ${displayedCommand} start`));
354
- console.log(" Runs the built app in production mode.");
380
+ console.log(`${import_chalk5.default.green("Success!")} Created ${appName} at ${root}`);
381
+ console.log(import_chalk5.default.bold(" To launch your app, run:"));
355
382
  console.log();
356
- console.log("We suggest that you begin by typing:");
383
+ console.log(import_chalk5.default.cyan(" cd"), appName);
384
+ console.log(` ${import_chalk5.default.cyan(`${displayedCommand} ${useYarn ? "" : "run "}dev`)}`);
357
385
  console.log();
358
- console.log(import_chalk4.default.cyan(" cd"), appName);
359
- console.log(` ${import_chalk4.default.cyan(`${displayedCommand} ${useYarn ? "" : "run "}dev`)}`);
386
+ console.log(import_chalk5.default.bold(" Next steps:"));
360
387
  console.log();
388
+ console.log("- Go to http://localhost:3000/admin to enter edit-mode");
389
+ console.log("- Edit some content on http://localhost:3000 (See https://tina.io/docs/using-tina-editor )");
390
+ console.log("- Check out our concept docs, to learn how Tina powers the starters under the hood. (See https://tina.io/docs/schema/)");
391
+ console.log("- Learn how Tina can be extended to create new field components. (See https://tina.io/docs/advanced/extending-tina/) ");
392
+ console.log("- Make your site editable with Tina on production. (See https://tina.io/docs/tina-cloud/)");
361
393
  };
362
394
  run();
363
395
  // Annotate the CommonJS export names for ESM import in node:
@@ -22,8 +22,7 @@
22
22
  "react-dom": "^16.14.0",
23
23
  "react-icons": "^4.2.0",
24
24
  "react-is": "^17.0.2",
25
- "react-tinacms-editor": "^0.52.5",
26
- "react-tinacms-inline": "^0.53.5",
25
+ "react-tinacms-editor": "^0.52.8",
27
26
  "styled-components": "^5.3.0",
28
27
  "tinacms": "latest"
29
28
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tina-app",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",
@@ -38,6 +38,7 @@
38
38
  "typescript": "^4.3.5"
39
39
  },
40
40
  "dependencies": {
41
+ "@tinacms/metrics": "0.0.2",
41
42
  "chalk": "^4.1.2",
42
43
  "commander": "^8.3.0",
43
44
  "cross-spawn": "^7.0.3",