@tinacms/cli 2.2.6 → 2.3.1

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.1";
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);
@@ -572,6 +565,11 @@ var Codegen = class {
572
565
  this.configManager.generatedTypesTSFilePath,
573
566
  codeString
574
567
  );
568
+ const jsTypes = await transform(codeString, { loader: "ts" });
569
+ await fs.outputFile(
570
+ this.configManager.generatedTypesJSFilePath,
571
+ jsTypes.code
572
+ );
575
573
  await fs.outputFile(
576
574
  this.configManager.generatedClientTSFilePath,
577
575
  clientString
@@ -584,7 +582,6 @@ var Codegen = class {
584
582
  }
585
583
  await unlinkIfExists(this.configManager.generatedClientJSFilePath);
586
584
  await unlinkIfExists(this.configManager.generatedTypesDFilePath);
587
- await unlinkIfExists(this.configManager.generatedTypesJSFilePath);
588
585
  } else {
589
586
  await fs.outputFile(
590
587
  this.configManager.generatedTypesDFilePath,
@@ -691,7 +688,7 @@ var Codegen = class {
691
688
  import { resolve } from "@tinacms/datalayer";
692
689
  import type { TinaClient } from "tinacms/dist/client";
693
690
 
694
- import { queries } from "${this.configManager.isUsingTs() ? "./types.ts" : "./types.js"}";
691
+ import { queries } from "./types.js";
695
692
  import database from "../database";
696
693
 
697
694
  export async function databaseRequest({ query, variables, user }) {
@@ -757,7 +754,7 @@ export default databaseClient;
757
754
  const errorPolicy = this.configManager.config?.client?.errorPolicy;
758
755
  const apiURL = this.getApiURL();
759
756
  const clientString = `import { createClient } from "tinacms/dist/client";
760
- import { queries } from "${this.configManager.isUsingTs() ? "./types.ts" : "./types.js"}";
757
+ import { queries } from "./types.js";
761
758
  export const client = createClient({ ${this.noClientBuildCache === false ? `cacheDir: '${normalizePath(
762
759
  this.configManager.generatedCachePath
763
760
  )}', ` : ""}url: ${this.localContentBuild ? `process.env.TINA_LOCAL_URL || '${apiURL}'` : `'${apiURL}'`}, token: '${token}', queries, ${errorPolicy ? `errorPolicy: '${errorPolicy}'` : ""} });
@@ -826,7 +823,6 @@ import { pathToFileURL } from "url";
826
823
  import * as esbuild from "esbuild";
827
824
  import * as dotenv from "dotenv";
828
825
  import normalizePath2 from "normalize-path";
829
- import chalk4 from "chalk";
830
826
  import { createRequire } from "module";
831
827
 
832
828
  // src/next/resolve-content-root.ts
@@ -901,7 +897,6 @@ var ConfigManager = class {
901
897
  envFilePath;
902
898
  generatedCachePath;
903
899
  generatedFolderPath;
904
- generatedFolderPathContentRepo;
905
900
  generatedGraphQLGQLPath;
906
901
  generatedGraphQLJSONPath;
907
902
  generatedSchemaJSONPath;
@@ -1087,16 +1082,10 @@ var ConfigManager = class {
1087
1082
  tinaConfigFilePath: this.tinaConfigFilePath,
1088
1083
  localContentPath: this.config.localContentPath
1089
1084
  });
1090
- this.generatedFolderPathContentRepo = path4.join(
1091
- await this.getTinaFolderPath(this.contentRootPath, {
1092
- isContentRoot: this.hasSeparateContentRoot()
1093
- }),
1094
- GENERATED_FOLDER
1095
- );
1096
1085
  this.spaMainPath = require2.resolve("@tinacms/app");
1097
1086
  this.spaRootPath = path4.join(this.spaMainPath, "..", "..");
1098
1087
  }
1099
- async getTinaFolderPath(rootPath, { isContentRoot } = {}) {
1088
+ async getTinaFolderPath(rootPath) {
1100
1089
  const tinaFolderPath = path4.join(rootPath, TINA_FOLDER);
1101
1090
  const tinaFolderExists = await fs3.pathExists(tinaFolderPath);
1102
1091
  if (tinaFolderExists) {
@@ -1109,11 +1098,6 @@ var ConfigManager = class {
1109
1098
  this.isUsingLegacyFolder = true;
1110
1099
  return legacyFolderPath;
1111
1100
  }
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
1101
  throw new Error(
1118
1102
  `Unable to find Tina folder, if you're working in folder outside of the Tina config be sure to specify --rootPath`
1119
1103
  );
@@ -1373,7 +1357,7 @@ async function createAndInitializeDatabase(configManager, datalayerPort, bridgeO
1373
1357
 
1374
1358
  // src/next/commands/baseCommands.ts
1375
1359
  import { Command, Option } from "clipanion";
1376
- import chalk5 from "chalk";
1360
+ import chalk4 from "chalk";
1377
1361
 
1378
1362
  // src/utils/start-subprocess.ts
1379
1363
  import childProcess from "child_process";
@@ -1441,7 +1425,7 @@ var BaseCommand = class extends Command {
1441
1425
  if (this.subCommand) {
1442
1426
  subProc = await startSubprocess2({ command: this.subCommand });
1443
1427
  logger.info(
1444
- `Running web application with command: ${chalk5.cyan(this.subCommand)}`
1428
+ `Running web application with command: ${chalk4.cyan(this.subCommand)}`
1445
1429
  );
1446
1430
  }
1447
1431
  function exitHandler(options, exitCode) {
@@ -2752,6 +2736,15 @@ var DevCommand = class extends BaseCommand {
2752
2736
  try {
2753
2737
  await configManager.processConfig();
2754
2738
  if (firstTime) {
2739
+ const telemetry = new Telemetry({ disabled: this.noTelemetry });
2740
+ await telemetry.submitRecord({
2741
+ event: {
2742
+ name: "tinacms:cli:dev:invoke",
2743
+ hasLocalContentPath: Boolean(
2744
+ configManager.config.localContentPath
2745
+ )
2746
+ }
2747
+ });
2755
2748
  database = await createAndInitializeDatabase(
2756
2749
  configManager,
2757
2750
  Number(this.datalayerPort)
@@ -2792,15 +2785,6 @@ var DevCommand = class extends BaseCommand {
2792
2785
  path9.join(configManager.tinaFolderPath, tinaLockFilename),
2793
2786
  tinaLockContent
2794
2787
  );
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
2788
  }
2805
2789
  await this.indexContentWithSpinner({
2806
2790
  database,
@@ -3041,6 +3025,7 @@ import crypto from "crypto";
3041
3025
  import path10 from "path";
3042
3026
  import { diff } from "@graphql-inspector/core";
3043
3027
  import { FilesystemBridge as FilesystemBridge3, buildSchema as buildSchema2 } from "@tinacms/graphql";
3028
+ import { Telemetry as Telemetry2 } from "@tinacms/metrics";
3044
3029
  import { parseURL as parseURL2 } from "@tinacms/schema-tools";
3045
3030
  import {
3046
3031
  SearchIndexer as SearchIndexer2,
@@ -3274,6 +3259,13 @@ ${dangerText(e.message)}`);
3274
3259
  );
3275
3260
  process.exit(1);
3276
3261
  }
3262
+ const telemetry = new Telemetry2({ disabled: this.noTelemetry });
3263
+ await telemetry.submitRecord({
3264
+ event: {
3265
+ name: "tinacms:cli:build:invoke",
3266
+ hasLocalContentPath: Boolean(configManager.config.localContentPath)
3267
+ }
3268
+ });
3277
3269
  if (localContentOnly && !this.localOption) {
3278
3270
  const config2 = configManager.config;
3279
3271
  const missing = [];
@@ -3904,9 +3896,9 @@ import { buildSchema as buildSchema3 } from "@tinacms/graphql";
3904
3896
 
3905
3897
  // src/next/commands/audit-command/audit.ts
3906
3898
  import prompts from "prompts";
3907
- import { Telemetry } from "@tinacms/metrics";
3899
+ import { Telemetry as Telemetry3 } from "@tinacms/metrics";
3908
3900
  import { resolve } from "@tinacms/graphql";
3909
- import chalk6 from "chalk";
3901
+ import chalk5 from "chalk";
3910
3902
  var audit = async ({
3911
3903
  database,
3912
3904
  clean,
@@ -3914,7 +3906,7 @@ var audit = async ({
3914
3906
  noTelemetry,
3915
3907
  verbose
3916
3908
  }) => {
3917
- const telemetry = new Telemetry({ disabled: noTelemetry });
3909
+ const telemetry = new Telemetry3({ disabled: noTelemetry });
3918
3910
  await telemetry.submitRecord({
3919
3911
  event: {
3920
3912
  name: "tinacms:cli:audit:invoke",
@@ -3924,7 +3916,7 @@ var audit = async ({
3924
3916
  });
3925
3917
  if (clean) {
3926
3918
  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(
3919
+ `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
3920
  "clean git tree"
3929
3921
  )} so unwanted changes can be undone.
3930
3922
 
@@ -3936,13 +3928,13 @@ var audit = async ({
3936
3928
  message: `Do you want to continue?`
3937
3929
  });
3938
3930
  if (!res.useClean) {
3939
- logger.warn(chalk6.yellowBright("\u26A0\uFE0F Audit not complete"));
3931
+ logger.warn(chalk5.yellowBright("\u26A0\uFE0F Audit not complete"));
3940
3932
  process.exit(0);
3941
3933
  }
3942
3934
  }
3943
3935
  if (useDefaultValues && !clean) {
3944
3936
  logger.warn(
3945
- chalk6.yellowBright(
3937
+ chalk5.yellowBright(
3946
3938
  "WARNING: using the `--useDefaultValues` without the `--clean` flag has no effect. Please re-run audit and add the `--clean` flag"
3947
3939
  )
3948
3940
  );
@@ -3970,10 +3962,10 @@ var audit = async ({
3970
3962
  }
3971
3963
  if (error) {
3972
3964
  logger.error(
3973
- chalk6.redBright(`\u203C\uFE0F Audit ${chalk6.bold("failed")} with errors`)
3965
+ chalk5.redBright(`\u203C\uFE0F Audit ${chalk5.bold("failed")} with errors`)
3974
3966
  );
3975
3967
  } else {
3976
- logger.info(chalk6.greenBright("\u2705 Audit passed"));
3968
+ logger.info(chalk5.greenBright("\u2705 Audit passed"));
3977
3969
  }
3978
3970
  };
3979
3971
  var auditDocuments = async (args) => {
@@ -4001,11 +3993,11 @@ var auditDocuments = async (args) => {
4001
3993
  if (docResult.errors) {
4002
3994
  error = true;
4003
3995
  docResult.errors.forEach((err) => {
4004
- logger.error(chalk6.red(err.message));
3996
+ logger.error(chalk5.red(err.message));
4005
3997
  if (err.originalError.originalError) {
4006
3998
  logger.error(
4007
3999
  // @ts-ignore FIXME: this doesn't seem right
4008
- chalk6.red(` ${err.originalError.originalError.message}`)
4000
+ chalk5.red(` ${err.originalError.originalError.message}`)
4009
4001
  );
4010
4002
  }
4011
4003
  });
@@ -4047,7 +4039,7 @@ var auditDocuments = async (args) => {
4047
4039
  if (mutationRes.errors) {
4048
4040
  mutationRes.errors.forEach((err) => {
4049
4041
  error = true;
4050
- logger.error(chalk6.red(err.message));
4042
+ logger.error(chalk5.red(err.message));
4051
4043
  });
4052
4044
  }
4053
4045
  }
@@ -5672,7 +5664,7 @@ var rewriteTemplateKeysInDocs = (args) => {
5672
5664
  };
5673
5665
 
5674
5666
  // src/cmds/init/apply.ts
5675
- import { Telemetry as Telemetry2 } from "@tinacms/metrics";
5667
+ import { Telemetry as Telemetry4 } from "@tinacms/metrics";
5676
5668
  import fs15 from "fs-extra";
5677
5669
 
5678
5670
  // src/next/commands/codemod-command/index.ts
@@ -6635,7 +6627,7 @@ var reportTelemetry = async ({
6635
6627
  if (noTelemetry) {
6636
6628
  logger.info(logText("Telemetry disabled"));
6637
6629
  }
6638
- const telemetry = new Telemetry2({ disabled: noTelemetry });
6630
+ const telemetry = new Telemetry4({ disabled: noTelemetry });
6639
6631
  const schemaFileType = usingTypescript ? "ts" : "js";
6640
6632
  await telemetry.submitRecord({
6641
6633
  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.1",
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/app": "2.4.8",
92
+ "@tinacms/metrics": "2.1.0",
93
+ "@tinacms/graphql": "2.4.1",
94
+ "@tinacms/search": "1.2.15",
95
+ "@tinacms/schema-tools": "2.7.4",
96
+ "tinacms": "3.8.1"
97
97
  },
98
98
  "publishConfig": {
99
99
  "registry": "https://registry.npmjs.org"