@tinacms/cli 2.2.6 → 2.3.0

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 CHANGED
@@ -2,11 +2,12 @@
2
2
  import { Cli, Builtins } from "clipanion";
3
3
 
4
4
  // package.json
5
- var version = "2.2.6";
5
+ var version = "2.3.0";
6
6
 
7
7
  // src/next/commands/dev-command/index.ts
8
8
  import path9 from "path";
9
9
  import { FilesystemBridge as FilesystemBridge2, buildSchema } from "@tinacms/graphql";
10
+ import { Telemetry } from "@tinacms/metrics";
10
11
  import { LocalSearchIndexClient, SearchIndexer } from "@tinacms/search";
11
12
  import AsyncLock from "async-lock";
12
13
  import chokidar from "chokidar";
@@ -511,14 +512,6 @@ var Codegen = class {
511
512
  );
512
513
  await fs.ensureFile(filePath);
513
514
  await fs.outputFile(filePath, data);
514
- if (this.configManager.hasSeparateContentRoot()) {
515
- const filePath2 = path.join(
516
- this.configManager.generatedFolderPathContentRepo,
517
- fileName
518
- );
519
- await fs.ensureFile(filePath2);
520
- await fs.outputFile(filePath2, data);
521
- }
522
515
  }
523
516
  async removeGeneratedFilesIfExists() {
524
517
  await unlinkIfExists(this.configManager.generatedClientJSFilePath);
@@ -691,7 +684,7 @@ var Codegen = class {
691
684
  import { resolve } from "@tinacms/datalayer";
692
685
  import type { TinaClient } from "tinacms/dist/client";
693
686
 
694
- import { queries } from "${this.configManager.isUsingTs() ? "./types.ts" : "./types.js"}";
687
+ import { queries } from "${this.configManager.isUsingTs() ? "./types" : "./types.js"}";
695
688
  import database from "../database";
696
689
 
697
690
  export async function databaseRequest({ query, variables, user }) {
@@ -757,7 +750,7 @@ export default databaseClient;
757
750
  const errorPolicy = this.configManager.config?.client?.errorPolicy;
758
751
  const apiURL = this.getApiURL();
759
752
  const clientString = `import { createClient } from "tinacms/dist/client";
760
- import { queries } from "${this.configManager.isUsingTs() ? "./types.ts" : "./types.js"}";
753
+ import { queries } from "${this.configManager.isUsingTs() ? "./types" : "./types.js"}";
761
754
  export const client = createClient({ ${this.noClientBuildCache === false ? `cacheDir: '${normalizePath(
762
755
  this.configManager.generatedCachePath
763
756
  )}', ` : ""}url: ${this.localContentBuild ? `process.env.TINA_LOCAL_URL || '${apiURL}'` : `'${apiURL}'`}, token: '${token}', queries, ${errorPolicy ? `errorPolicy: '${errorPolicy}'` : ""} });
@@ -826,7 +819,6 @@ import { pathToFileURL } from "url";
826
819
  import * as esbuild from "esbuild";
827
820
  import * as dotenv from "dotenv";
828
821
  import normalizePath2 from "normalize-path";
829
- import chalk4 from "chalk";
830
822
  import { createRequire } from "module";
831
823
 
832
824
  // src/next/resolve-content-root.ts
@@ -901,7 +893,6 @@ var ConfigManager = class {
901
893
  envFilePath;
902
894
  generatedCachePath;
903
895
  generatedFolderPath;
904
- generatedFolderPathContentRepo;
905
896
  generatedGraphQLGQLPath;
906
897
  generatedGraphQLJSONPath;
907
898
  generatedSchemaJSONPath;
@@ -1087,16 +1078,10 @@ var ConfigManager = class {
1087
1078
  tinaConfigFilePath: this.tinaConfigFilePath,
1088
1079
  localContentPath: this.config.localContentPath
1089
1080
  });
1090
- this.generatedFolderPathContentRepo = path4.join(
1091
- await this.getTinaFolderPath(this.contentRootPath, {
1092
- isContentRoot: this.hasSeparateContentRoot()
1093
- }),
1094
- GENERATED_FOLDER
1095
- );
1096
1081
  this.spaMainPath = require2.resolve("@tinacms/app");
1097
1082
  this.spaRootPath = path4.join(this.spaMainPath, "..", "..");
1098
1083
  }
1099
- async getTinaFolderPath(rootPath, { isContentRoot } = {}) {
1084
+ async getTinaFolderPath(rootPath) {
1100
1085
  const tinaFolderPath = path4.join(rootPath, TINA_FOLDER);
1101
1086
  const tinaFolderExists = await fs3.pathExists(tinaFolderPath);
1102
1087
  if (tinaFolderExists) {
@@ -1109,11 +1094,6 @@ var ConfigManager = class {
1109
1094
  this.isUsingLegacyFolder = true;
1110
1095
  return legacyFolderPath;
1111
1096
  }
1112
- if (isContentRoot) {
1113
- throw new Error(
1114
- `Unable to find a ${chalk4.cyan("tina/")} folder in your content root at ${chalk4.cyan(rootPath)}. When using localContentPath, the content directory must contain a ${chalk4.cyan("tina/")} folder for generated files. Create one with: mkdir ${path4.join(rootPath, TINA_FOLDER)}`
1115
- );
1116
- }
1117
1097
  throw new Error(
1118
1098
  `Unable to find Tina folder, if you're working in folder outside of the Tina config be sure to specify --rootPath`
1119
1099
  );
@@ -1373,7 +1353,7 @@ async function createAndInitializeDatabase(configManager, datalayerPort, bridgeO
1373
1353
 
1374
1354
  // src/next/commands/baseCommands.ts
1375
1355
  import { Command, Option } from "clipanion";
1376
- import chalk5 from "chalk";
1356
+ import chalk4 from "chalk";
1377
1357
 
1378
1358
  // src/utils/start-subprocess.ts
1379
1359
  import childProcess from "child_process";
@@ -1441,7 +1421,7 @@ var BaseCommand = class extends Command {
1441
1421
  if (this.subCommand) {
1442
1422
  subProc = await startSubprocess2({ command: this.subCommand });
1443
1423
  logger.info(
1444
- `Running web application with command: ${chalk5.cyan(this.subCommand)}`
1424
+ `Running web application with command: ${chalk4.cyan(this.subCommand)}`
1445
1425
  );
1446
1426
  }
1447
1427
  function exitHandler(options, exitCode) {
@@ -2752,6 +2732,15 @@ var DevCommand = class extends BaseCommand {
2752
2732
  try {
2753
2733
  await configManager.processConfig();
2754
2734
  if (firstTime) {
2735
+ const telemetry = new Telemetry({ disabled: this.noTelemetry });
2736
+ await telemetry.submitRecord({
2737
+ event: {
2738
+ name: "tinacms:cli:dev:invoke",
2739
+ hasLocalContentPath: Boolean(
2740
+ configManager.config.localContentPath
2741
+ )
2742
+ }
2743
+ });
2755
2744
  database = await createAndInitializeDatabase(
2756
2745
  configManager,
2757
2746
  Number(this.datalayerPort)
@@ -2792,15 +2781,6 @@ var DevCommand = class extends BaseCommand {
2792
2781
  path9.join(configManager.tinaFolderPath, tinaLockFilename),
2793
2782
  tinaLockContent
2794
2783
  );
2795
- if (configManager.hasSeparateContentRoot()) {
2796
- const rootPath = await configManager.getTinaFolderPath(
2797
- configManager.contentRootPath,
2798
- { isContentRoot: true }
2799
- );
2800
- const filePath = path9.join(rootPath, tinaLockFilename);
2801
- await fs8.ensureFile(filePath);
2802
- await fs8.outputFile(filePath, tinaLockContent);
2803
- }
2804
2784
  }
2805
2785
  await this.indexContentWithSpinner({
2806
2786
  database,
@@ -3041,6 +3021,7 @@ import crypto from "crypto";
3041
3021
  import path10 from "path";
3042
3022
  import { diff } from "@graphql-inspector/core";
3043
3023
  import { FilesystemBridge as FilesystemBridge3, buildSchema as buildSchema2 } from "@tinacms/graphql";
3024
+ import { Telemetry as Telemetry2 } from "@tinacms/metrics";
3044
3025
  import { parseURL as parseURL2 } from "@tinacms/schema-tools";
3045
3026
  import {
3046
3027
  SearchIndexer as SearchIndexer2,
@@ -3274,6 +3255,13 @@ ${dangerText(e.message)}`);
3274
3255
  );
3275
3256
  process.exit(1);
3276
3257
  }
3258
+ const telemetry = new Telemetry2({ disabled: this.noTelemetry });
3259
+ await telemetry.submitRecord({
3260
+ event: {
3261
+ name: "tinacms:cli:build:invoke",
3262
+ hasLocalContentPath: Boolean(configManager.config.localContentPath)
3263
+ }
3264
+ });
3277
3265
  if (localContentOnly && !this.localOption) {
3278
3266
  const config2 = configManager.config;
3279
3267
  const missing = [];
@@ -3904,9 +3892,9 @@ import { buildSchema as buildSchema3 } from "@tinacms/graphql";
3904
3892
 
3905
3893
  // src/next/commands/audit-command/audit.ts
3906
3894
  import prompts from "prompts";
3907
- import { Telemetry } from "@tinacms/metrics";
3895
+ import { Telemetry as Telemetry3 } from "@tinacms/metrics";
3908
3896
  import { resolve } from "@tinacms/graphql";
3909
- import chalk6 from "chalk";
3897
+ import chalk5 from "chalk";
3910
3898
  var audit = async ({
3911
3899
  database,
3912
3900
  clean,
@@ -3914,7 +3902,7 @@ var audit = async ({
3914
3902
  noTelemetry,
3915
3903
  verbose
3916
3904
  }) => {
3917
- const telemetry = new Telemetry({ disabled: noTelemetry });
3905
+ const telemetry = new Telemetry3({ disabled: noTelemetry });
3918
3906
  await telemetry.submitRecord({
3919
3907
  event: {
3920
3908
  name: "tinacms:cli:audit:invoke",
@@ -3924,7 +3912,7 @@ var audit = async ({
3924
3912
  });
3925
3913
  if (clean) {
3926
3914
  logger.info(
3927
- `You are using the \`--clean\` option. This will modify your content as if a user is submitting a form. Before running this you should have a ${chalk6.bold(
3915
+ `You are using the \`--clean\` option. This will modify your content as if a user is submitting a form. Before running this you should have a ${chalk5.bold(
3928
3916
  "clean git tree"
3929
3917
  )} so unwanted changes can be undone.
3930
3918
 
@@ -3936,13 +3924,13 @@ var audit = async ({
3936
3924
  message: `Do you want to continue?`
3937
3925
  });
3938
3926
  if (!res.useClean) {
3939
- logger.warn(chalk6.yellowBright("\u26A0\uFE0F Audit not complete"));
3927
+ logger.warn(chalk5.yellowBright("\u26A0\uFE0F Audit not complete"));
3940
3928
  process.exit(0);
3941
3929
  }
3942
3930
  }
3943
3931
  if (useDefaultValues && !clean) {
3944
3932
  logger.warn(
3945
- chalk6.yellowBright(
3933
+ chalk5.yellowBright(
3946
3934
  "WARNING: using the `--useDefaultValues` without the `--clean` flag has no effect. Please re-run audit and add the `--clean` flag"
3947
3935
  )
3948
3936
  );
@@ -3970,10 +3958,10 @@ var audit = async ({
3970
3958
  }
3971
3959
  if (error) {
3972
3960
  logger.error(
3973
- chalk6.redBright(`\u203C\uFE0F Audit ${chalk6.bold("failed")} with errors`)
3961
+ chalk5.redBright(`\u203C\uFE0F Audit ${chalk5.bold("failed")} with errors`)
3974
3962
  );
3975
3963
  } else {
3976
- logger.info(chalk6.greenBright("\u2705 Audit passed"));
3964
+ logger.info(chalk5.greenBright("\u2705 Audit passed"));
3977
3965
  }
3978
3966
  };
3979
3967
  var auditDocuments = async (args) => {
@@ -4001,11 +3989,11 @@ var auditDocuments = async (args) => {
4001
3989
  if (docResult.errors) {
4002
3990
  error = true;
4003
3991
  docResult.errors.forEach((err) => {
4004
- logger.error(chalk6.red(err.message));
3992
+ logger.error(chalk5.red(err.message));
4005
3993
  if (err.originalError.originalError) {
4006
3994
  logger.error(
4007
3995
  // @ts-ignore FIXME: this doesn't seem right
4008
- chalk6.red(` ${err.originalError.originalError.message}`)
3996
+ chalk5.red(` ${err.originalError.originalError.message}`)
4009
3997
  );
4010
3998
  }
4011
3999
  });
@@ -4047,7 +4035,7 @@ var auditDocuments = async (args) => {
4047
4035
  if (mutationRes.errors) {
4048
4036
  mutationRes.errors.forEach((err) => {
4049
4037
  error = true;
4050
- logger.error(chalk6.red(err.message));
4038
+ logger.error(chalk5.red(err.message));
4051
4039
  });
4052
4040
  }
4053
4041
  }
@@ -5672,7 +5660,7 @@ var rewriteTemplateKeysInDocs = (args) => {
5672
5660
  };
5673
5661
 
5674
5662
  // src/cmds/init/apply.ts
5675
- import { Telemetry as Telemetry2 } from "@tinacms/metrics";
5663
+ import { Telemetry as Telemetry4 } from "@tinacms/metrics";
5676
5664
  import fs15 from "fs-extra";
5677
5665
 
5678
5666
  // src/next/commands/codemod-command/index.ts
@@ -6635,7 +6623,7 @@ var reportTelemetry = async ({
6635
6623
  if (noTelemetry) {
6636
6624
  logger.info(logText("Telemetry disabled"));
6637
6625
  }
6638
- const telemetry = new Telemetry2({ disabled: noTelemetry });
6626
+ const telemetry = new Telemetry4({ disabled: noTelemetry });
6639
6627
  const schemaFileType = usingTypescript ? "ts" : "js";
6640
6628
  await telemetry.submitRecord({
6641
6629
  event: {
@@ -15,7 +15,6 @@ export declare class ConfigManager {
15
15
  envFilePath: string;
16
16
  generatedCachePath: string;
17
17
  generatedFolderPath: string;
18
- generatedFolderPathContentRepo: string;
19
18
  generatedGraphQLGQLPath: string;
20
19
  generatedGraphQLJSONPath: string;
21
20
  generatedSchemaJSONPath: string;
@@ -55,9 +54,7 @@ export declare class ConfigManager {
55
54
  hasSeparateContentRoot(): boolean;
56
55
  shouldSkipSDK(): boolean;
57
56
  processConfig(): Promise<void>;
58
- getTinaFolderPath(rootPath: string, { isContentRoot }?: {
59
- isContentRoot?: boolean;
60
- }): Promise<string>;
57
+ getTinaFolderPath(rootPath: string): Promise<string>;
61
58
  getTinaGraphQLVersion(): {
62
59
  fullVersion: string;
63
60
  major: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
3
  "type": "module",
4
- "version": "2.2.6",
4
+ "version": "2.3.0",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "files": [
@@ -88,12 +88,12 @@
88
88
  "vite": "^4.5.9",
89
89
  "yup": "^1.6.1",
90
90
  "zod": "^3.24.2",
91
- "@tinacms/app": "2.4.6",
92
- "@tinacms/graphql": "2.3.1",
93
- "@tinacms/metrics": "2.0.1",
94
- "@tinacms/search": "1.2.13",
95
- "tinacms": "3.7.6",
96
- "@tinacms/schema-tools": "2.7.4"
91
+ "@tinacms/graphql": "2.4.0",
92
+ "@tinacms/schema-tools": "2.7.4",
93
+ "@tinacms/metrics": "2.1.0",
94
+ "@tinacms/search": "1.2.14",
95
+ "@tinacms/app": "2.4.7",
96
+ "tinacms": "3.8.0"
97
97
  },
98
98
  "publishConfig": {
99
99
  "registry": "https://registry.npmjs.org"