@tinacms/cli 0.0.0-f0adfbf-20250521015212 → 0.0.0-f2577b9-20251119082459

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- The _TinaCloud CLI_ can be used to set up your project with TinaCloud configuration, and run a local version of the TinaCloud content-api (using your file system's content). For a real-world example of how this is being used checkout the [TinaCloud Starter](https://github.com/tinacms/tina-cloud-starter).
1
+ The _TinaCloud CLI_ can be used to set up your project with TinaCloud configuration, and run a local version of the TinaCloud content-api (using your file system's content). For a real-world example of how this is being used checkout the [TinaCloud Starter](https://github.com/tinacms/tina-nextjs-starter).
2
2
 
3
3
  ## Installation
4
4
 
@@ -24,7 +24,7 @@ Usage: @tinacms/cli command [options]
24
24
  Options:
25
25
  -V, --version output the version number
26
26
  -h, --help display help for command
27
- -v, --verbose increase verbosity of console output
27
+ -v, --verbose increase verbosity of console output
28
28
 
29
29
  Commands:
30
30
  server:start [options] Start Filesystem Graphql Server
@@ -137,7 +137,7 @@ The top-level key in the schema is an array of _collections_, a `collection` inf
137
137
 
138
138
  ### `templates`
139
139
 
140
- Templates are responsible for defining the shape of your content, you'll see in the schema for [the starter](https://github.com/tinacms/tina-cloud-starter) that we use `templates` for `collections` as well as `blocks`. One important thing to note is that since a `collection` can have multiple `templates`, each file in your collection must store a `_template` key in it's frontmatter:
140
+ Templates are responsible for defining the shape of your content, you'll see in the schema for [the starter](https://github.com/tinacms/tina-nextjs-starter) that we use `templates` for `collections` as well as `blocks`. One important thing to note is that since a `collection` can have multiple `templates`, each file in your collection must store a `_template` key in it's frontmatter:
141
141
 
142
142
  ```markdown
143
143
  ---
@@ -151,7 +151,7 @@ When you use Tina's GraphQL forms, we know about all of the relationships in you
151
151
 
152
152
  ### `fields`
153
153
 
154
- For the most part, you can think of `fields` as the backend equivalent to [Tina field plugins](https://tina.io/docs/plugins/fields/). You might notice that we're defining a `type` on each field, rather than a `component`. This is because the backend isn't concerned with `component`s, only the shape of your content. By default we use the built-in Tina fields, to customize your `component` read the [field customization](https://tina.io/docs/tina-cloud/client/#field-customization) instructions.
154
+ For the most part, you can think of `fields` as the backend equivalent to [Tina field plugins](https://tina.io/docs/plugins/fields/). You might notice that we're defining a `type` on each field, rather than a `component`. This is because the backend isn't concerned with `component`s, only the shape of your content. By default we use the built-in Tina fields, to customize your `component` read the [field customization](https://tina.io/docs/tinacloud/client/#field-customization) instructions.
155
155
 
156
156
  #### `reference` & `reference-list`
157
157
 
@@ -229,7 +229,7 @@ getPostsDocument(relativePath: "voteForPedro.md") {
229
229
  }
230
230
  ```
231
231
 
232
- To learn how to work with this data on a Tina-enabled site, check out the [client documentation](https://tina.io/docs/tina-cloud/client/)
232
+ To learn how to work with this data on a Tina-enabled site, check out the [client documentation](https://tina.io/docs/tinacloud/client/)
233
233
 
234
234
  > This API is currently somewhat limited. Specifically there's no support for filtering and sorting "list" queries. We have plans to tackle that in upcoming cycles
235
235
 
@@ -1,4 +1,4 @@
1
- import type { Collection, TinaField } from '@tinacms/schema-tools';
1
+ import type { Collection, TinaField, ContentFrontmatterFormat } from '@tinacms/schema-tools';
2
2
  export declare const stringifyLabel: (label: string) => string;
3
3
  export declare const stringifyLabelWithField: (label: string) => string;
4
4
  export declare const generateAllTemplates: ({ pathToForestryConfig, }: {
@@ -8,7 +8,7 @@ export declare const generateAllTemplates: ({ pathToForestryConfig, }: {
8
8
  templateObj: any;
9
9
  }>>;
10
10
  export declare const generateCollections: ({ pathToForestryConfig, usingTypescript, frontMatterFormat, }: {
11
- frontMatterFormat?: "toml" | "yaml" | "json";
11
+ frontMatterFormat?: ContentFrontmatterFormat;
12
12
  pathToForestryConfig: string;
13
13
  usingTypescript: boolean;
14
14
  }) => Promise<{
@@ -1,4 +1,5 @@
1
1
  import { CLICommand } from '../index';
2
+ import { ContentFrontmatterFormat } from '@tinacms/schema-tools';
2
3
  export interface Framework {
3
4
  name: 'next' | 'hugo' | 'jekyll' | 'other';
4
5
  reactive: boolean;
@@ -20,11 +21,10 @@ export type GeneratedFile = {
20
21
  parentPath: string;
21
22
  };
22
23
  };
23
- export type FrontmatterFormat = 'yaml' | 'toml' | 'json';
24
24
  export type InitEnvironment = {
25
25
  hasTinaDeps: boolean;
26
26
  forestryConfigExists: boolean;
27
- frontMatterFormat: FrontmatterFormat;
27
+ frontMatterFormat: ContentFrontmatterFormat;
28
28
  gitIgnoreExists: boolean;
29
29
  gitIgnoreNodeModulesExists: boolean;
30
30
  gitIgnoreTinaEnvExists: boolean;
@@ -1,5 +1,6 @@
1
1
  import { Framework, InitEnvironment } from '../';
2
2
  import { Config, ImportStatement } from './types';
3
+ import { ContentFrontmatterFormat } from '@tinacms/schema-tools';
3
4
  export * from './askTinaCloudSetup';
4
5
  export * from './types';
5
6
  export * from './gitProvider';
@@ -7,14 +8,14 @@ export * from './databaseAdapter';
7
8
  export * from './authProvider';
8
9
  export declare const askCommonSetUp: () => Promise<{
9
10
  framework: Framework;
10
- packageManager: "pnpm" | "yarn" | "npm";
11
+ packageManager: "pnpm" | "yarn" | "npm" | "bun";
11
12
  }>;
12
13
  export declare const askForestryMigrate: ({ framework, env, }: {
13
14
  framework: Framework;
14
15
  env: InitEnvironment;
15
16
  }) => Promise<{
16
17
  forestryMigrate: boolean;
17
- frontMatterFormat?: "yaml" | "toml" | "json";
18
+ frontMatterFormat?: ContentFrontmatterFormat;
18
19
  }>;
19
20
  export declare const askTinaSetupPrompts: (params: {
20
21
  frameworkName: string;
@@ -1,11 +1,12 @@
1
+ import { ContentFrontmatterFormat } from '@tinacms/schema-tools';
1
2
  import { Framework, GeneratedFileType } from '../';
2
3
  export type Config = {
3
4
  typescript: boolean;
4
5
  publicFolder?: string;
5
6
  framework: Framework;
6
- packageManager: 'pnpm' | 'yarn' | 'npm';
7
+ packageManager: 'pnpm' | 'yarn' | 'npm' | 'bun';
7
8
  forestryMigrate: boolean;
8
- frontMatterFormat?: 'yaml' | 'toml' | 'json';
9
+ frontMatterFormat?: ContentFrontmatterFormat;
9
10
  hosting?: 'tina-cloud' | 'self-host';
10
11
  gitProvider?: PromptGitProvider;
11
12
  databaseAdapter?: PromptDatabaseAdapter;
package/dist/index.js CHANGED
@@ -35,10 +35,10 @@ module.exports = __toCommonJS(index_exports);
35
35
  var import_clipanion8 = require("clipanion");
36
36
 
37
37
  // package.json
38
- var version = "1.9.7";
38
+ var version = "1.12.4";
39
39
 
40
40
  // src/next/commands/dev-command/index.ts
41
- var import_path5 = __toESM(require("path"));
41
+ var import_path7 = __toESM(require("path"));
42
42
  var import_graphql10 = require("@tinacms/graphql");
43
43
  var import_search = require("@tinacms/search");
44
44
  var import_async_lock = __toESM(require("async-lock"));
@@ -601,7 +601,7 @@ var Codegen = class {
601
601
  throw new Error(
602
602
  `Client not configured properly. Missing ${missing.join(
603
603
  ", "
604
- )}. Please visit https://tina.io/docs/tina-cloud/overview for more information`
604
+ )}. Please visit https://tina.io/docs/r/what-is-tinacloud for more information`
605
605
  );
606
606
  }
607
607
  let localUrl = `http://localhost:${this.port}/graphql`;
@@ -775,12 +775,25 @@ var unlinkIfExists = async (filepath) => {
775
775
 
776
776
  // src/next/config-manager.ts
777
777
  var import_fs_extra2 = __toESM(require("fs-extra"));
778
- var import_path2 = __toESM(require("path"));
778
+ var import_path3 = __toESM(require("path"));
779
779
  var import_os = __toESM(require("os"));
780
780
  var esbuild = __toESM(require("esbuild"));
781
781
  var dotenv = __toESM(require("dotenv"));
782
782
  var import_normalize_path2 = __toESM(require("normalize-path"));
783
783
  var import_chalk3 = __toESM(require("chalk"));
784
+
785
+ // src/utils/path.ts
786
+ var import_path2 = __toESM(require("path"));
787
+ function stripNativeTrailingSlash(p) {
788
+ const { root } = import_path2.default.parse(p);
789
+ let str = p;
790
+ while (str.length > root.length && str.endsWith(import_path2.default.sep)) {
791
+ str = str.slice(0, -1);
792
+ }
793
+ return str;
794
+ }
795
+
796
+ // src/next/config-manager.ts
784
797
  var TINA_FOLDER = "tina";
785
798
  var LEGACY_TINA_FOLDER = ".tina";
786
799
  var GENERATED_FOLDER = "__generated__";
@@ -799,7 +812,7 @@ var ConfigManager = class {
799
812
  this.legacyNoSDK = legacyNoSDK;
800
813
  }
801
814
  isUsingTs() {
802
- return [".ts", ".tsx"].includes(import_path2.default.extname(this.tinaConfigFilePath));
815
+ return [".ts", ".tsx"].includes(import_path3.default.extname(this.tinaConfigFilePath));
803
816
  }
804
817
  hasSelfHostedConfig() {
805
818
  return !!this.selfHostedDatabaseFilePath;
@@ -815,12 +828,12 @@ var ConfigManager = class {
815
828
  }
816
829
  async processConfig() {
817
830
  this.tinaFolderPath = await this.getTinaFolderPath(this.rootPath);
818
- this.envFilePath = import_path2.default.resolve(
819
- import_path2.default.join(this.tinaFolderPath, "..", ".env")
831
+ this.envFilePath = import_path3.default.resolve(
832
+ import_path3.default.join(this.tinaFolderPath, "..", ".env")
820
833
  );
821
834
  dotenv.config({ path: this.envFilePath });
822
835
  this.tinaConfigFilePath = await this.getPathWithExtension(
823
- import_path2.default.join(this.tinaFolderPath, "config")
836
+ import_path3.default.join(this.tinaFolderPath, "config")
824
837
  );
825
838
  if (!this.tinaConfigFilePath) {
826
839
  throw new Error(
@@ -828,79 +841,79 @@ var ConfigManager = class {
828
841
  );
829
842
  }
830
843
  this.selfHostedDatabaseFilePath = await this.getPathWithExtension(
831
- import_path2.default.join(this.tinaFolderPath, "database")
844
+ import_path3.default.join(this.tinaFolderPath, "database")
832
845
  );
833
- this.generatedFolderPath = import_path2.default.join(this.tinaFolderPath, GENERATED_FOLDER);
834
- this.generatedCachePath = import_path2.default.join(
846
+ this.generatedFolderPath = import_path3.default.join(this.tinaFolderPath, GENERATED_FOLDER);
847
+ this.generatedCachePath = import_path3.default.join(
835
848
  this.generatedFolderPath,
836
849
  ".cache",
837
850
  String((/* @__PURE__ */ new Date()).getTime())
838
851
  );
839
- this.generatedGraphQLGQLPath = import_path2.default.join(
852
+ this.generatedGraphQLGQLPath = import_path3.default.join(
840
853
  this.generatedFolderPath,
841
854
  GRAPHQL_GQL_FILE
842
855
  );
843
- this.generatedGraphQLJSONPath = import_path2.default.join(
856
+ this.generatedGraphQLJSONPath = import_path3.default.join(
844
857
  this.generatedFolderPath,
845
858
  GRAPHQL_JSON_FILE
846
859
  );
847
- this.generatedSchemaJSONPath = import_path2.default.join(
860
+ this.generatedSchemaJSONPath = import_path3.default.join(
848
861
  this.generatedFolderPath,
849
862
  SCHEMA_JSON_FILE
850
863
  );
851
- this.generatedLookupJSONPath = import_path2.default.join(
864
+ this.generatedLookupJSONPath = import_path3.default.join(
852
865
  this.generatedFolderPath,
853
866
  LOOKUP_JSON_FILE
854
867
  );
855
- this.generatedQueriesFilePath = import_path2.default.join(
868
+ this.generatedQueriesFilePath = import_path3.default.join(
856
869
  this.generatedFolderPath,
857
870
  "queries.gql"
858
871
  );
859
- this.generatedFragmentsFilePath = import_path2.default.join(
872
+ this.generatedFragmentsFilePath = import_path3.default.join(
860
873
  this.generatedFolderPath,
861
874
  "frags.gql"
862
875
  );
863
- this.generatedTypesTSFilePath = import_path2.default.join(
876
+ this.generatedTypesTSFilePath = import_path3.default.join(
864
877
  this.generatedFolderPath,
865
878
  "types.ts"
866
879
  );
867
- this.generatedTypesJSFilePath = import_path2.default.join(
880
+ this.generatedTypesJSFilePath = import_path3.default.join(
868
881
  this.generatedFolderPath,
869
882
  "types.js"
870
883
  );
871
- this.generatedTypesDFilePath = import_path2.default.join(
884
+ this.generatedTypesDFilePath = import_path3.default.join(
872
885
  this.generatedFolderPath,
873
886
  "types.d.ts"
874
887
  );
875
- this.userQueriesAndFragmentsGlob = import_path2.default.join(
888
+ this.userQueriesAndFragmentsGlob = import_path3.default.join(
876
889
  this.tinaFolderPath,
877
890
  "queries/**/*.{graphql,gql}"
878
891
  );
879
- this.generatedQueriesAndFragmentsGlob = import_path2.default.join(
892
+ this.generatedQueriesAndFragmentsGlob = import_path3.default.join(
880
893
  this.generatedFolderPath,
881
894
  "*.{graphql,gql}"
882
895
  );
883
- this.generatedClientTSFilePath = import_path2.default.join(
896
+ this.generatedClientTSFilePath = import_path3.default.join(
884
897
  this.generatedFolderPath,
885
898
  "client.ts"
886
899
  );
887
- this.generatedClientJSFilePath = import_path2.default.join(
900
+ this.generatedClientJSFilePath = import_path3.default.join(
888
901
  this.generatedFolderPath,
889
902
  "client.js"
890
903
  );
891
- this.generatedClientDFilePath = import_path2.default.join(
904
+ this.generatedClientDFilePath = import_path3.default.join(
892
905
  this.generatedFolderPath,
893
906
  "client.d.ts"
894
907
  );
895
- this.generatedDatabaseClientDFilePath = import_path2.default.join(
908
+ this.generatedDatabaseClientDFilePath = import_path3.default.join(
896
909
  this.generatedFolderPath,
897
910
  "databaseClient.d.ts"
898
911
  );
899
- this.generatedDatabaseClientTSFilePath = import_path2.default.join(
912
+ this.generatedDatabaseClientTSFilePath = import_path3.default.join(
900
913
  this.generatedFolderPath,
901
914
  "databaseClient.ts"
902
915
  );
903
- this.generatedDatabaseClientJSFilePath = import_path2.default.join(
916
+ this.generatedDatabaseClientJSFilePath = import_path3.default.join(
904
917
  this.generatedFolderPath,
905
918
  "databaseClient.js"
906
919
  );
@@ -920,19 +933,18 @@ var ConfigManager = class {
920
933
  this.watchList = watchList;
921
934
  this.config = config2;
922
935
  this.prebuildFilePath = prebuildPath;
923
- this.publicFolderPath = import_path2.default.join(
936
+ this.publicFolderPath = import_path3.default.join(
924
937
  this.rootPath,
925
938
  this.config.build.publicFolder
926
939
  );
927
- this.outputFolderPath = import_path2.default.join(
940
+ this.outputFolderPath = import_path3.default.join(
928
941
  this.publicFolderPath,
929
942
  this.config.build.outputFolder
930
943
  );
931
- this.outputHTMLFilePath = import_path2.default.join(this.outputFolderPath, "index.html");
932
- this.outputGitignorePath = import_path2.default.join(this.outputFolderPath, ".gitignore");
933
- const fullLocalContentPath = import_path2.default.join(
934
- this.tinaFolderPath,
935
- this.config.localContentPath || ""
944
+ this.outputHTMLFilePath = import_path3.default.join(this.outputFolderPath, "index.html");
945
+ this.outputGitignorePath = import_path3.default.join(this.outputFolderPath, ".gitignore");
946
+ const fullLocalContentPath = stripNativeTrailingSlash(
947
+ import_path3.default.join(this.tinaFolderPath, this.config.localContentPath || "")
936
948
  );
937
949
  if (this.config.localContentPath) {
938
950
  const localContentPathExists = await import_fs_extra2.default.pathExists(fullLocalContentPath);
@@ -952,21 +964,21 @@ var ConfigManager = class {
952
964
  if (!this.contentRootPath) {
953
965
  this.contentRootPath = this.rootPath;
954
966
  }
955
- this.generatedFolderPathContentRepo = import_path2.default.join(
967
+ this.generatedFolderPathContentRepo = import_path3.default.join(
956
968
  await this.getTinaFolderPath(this.contentRootPath),
957
969
  GENERATED_FOLDER
958
970
  );
959
971
  this.spaMainPath = require.resolve("@tinacms/app");
960
- this.spaRootPath = import_path2.default.join(this.spaMainPath, "..", "..");
972
+ this.spaRootPath = import_path3.default.join(this.spaMainPath, "..", "..");
961
973
  }
962
974
  async getTinaFolderPath(rootPath) {
963
- const tinaFolderPath = import_path2.default.join(rootPath, TINA_FOLDER);
975
+ const tinaFolderPath = import_path3.default.join(rootPath, TINA_FOLDER);
964
976
  const tinaFolderExists = await import_fs_extra2.default.pathExists(tinaFolderPath);
965
977
  if (tinaFolderExists) {
966
978
  this.isUsingLegacyFolder = false;
967
979
  return tinaFolderPath;
968
980
  }
969
- const legacyFolderPath = import_path2.default.join(rootPath, LEGACY_TINA_FOLDER);
981
+ const legacyFolderPath = import_path3.default.join(rootPath, LEGACY_TINA_FOLDER);
970
982
  const legacyFolderExists = await import_fs_extra2.default.pathExists(legacyFolderPath);
971
983
  if (legacyFolderExists) {
972
984
  this.isUsingLegacyFolder = true;
@@ -1042,8 +1054,8 @@ var ConfigManager = class {
1042
1054
  return result;
1043
1055
  }
1044
1056
  async loadDatabaseFile() {
1045
- const tmpdir = import_path2.default.join(import_os.default.tmpdir(), Date.now().toString());
1046
- const outfile = import_path2.default.join(tmpdir, "database.build.js");
1057
+ const tmpdir = import_path3.default.join(import_os.default.tmpdir(), Date.now().toString());
1058
+ const outfile = import_path3.default.join(tmpdir, "database.build.js");
1047
1059
  await esbuild.build({
1048
1060
  entryPoints: [this.selfHostedDatabaseFilePath],
1049
1061
  bundle: true,
@@ -1056,14 +1068,14 @@ var ConfigManager = class {
1056
1068
  return result.default;
1057
1069
  }
1058
1070
  async loadConfigFile(generatedFolderPath, configFilePath) {
1059
- const tmpdir = import_path2.default.join(import_os.default.tmpdir(), Date.now().toString());
1060
- const preBuildConfigPath = import_path2.default.join(
1071
+ const tmpdir = import_path3.default.join(import_os.default.tmpdir(), Date.now().toString());
1072
+ const preBuildConfigPath = import_path3.default.join(
1061
1073
  this.generatedFolderPath,
1062
1074
  "config.prebuild.jsx"
1063
1075
  );
1064
- const outfile = import_path2.default.join(tmpdir, "config.build.jsx");
1065
- const outfile2 = import_path2.default.join(tmpdir, "config.build.js");
1066
- const tempTSConfigFile = import_path2.default.join(tmpdir, "tsconfig.json");
1076
+ const outfile = import_path3.default.join(tmpdir, "config.build.jsx");
1077
+ const outfile2 = import_path3.default.join(tmpdir, "config.build.js");
1078
+ const tempTSConfigFile = import_path3.default.join(tmpdir, "tsconfig.json");
1067
1079
  import_fs_extra2.default.outputFileSync(tempTSConfigFile, "{}");
1068
1080
  const result2 = await esbuild.build({
1069
1081
  entryPoints: [configFilePath],
@@ -1350,7 +1362,7 @@ var BaseCommand = class extends import_clipanion.Command {
1350
1362
  pathFilter
1351
1363
  });
1352
1364
  const tinaPathUpdates = modified.filter(
1353
- (path14) => path14.startsWith(".tina/__generated__/_schema.json") || path14.startsWith("tina/tina-lock.json")
1365
+ (path15) => path15.startsWith(".tina/__generated__/_schema.json") || path15.startsWith("tina/tina-lock.json")
1354
1366
  );
1355
1367
  if (tinaPathUpdates.length > 0) {
1356
1368
  res = await database.indexContent({
@@ -1428,7 +1440,7 @@ var errorHTML = `<style type="text/css">
1428
1440
  the assets for this page.
1429
1441
  </p>
1430
1442
  <p>
1431
- Please visit <a href="https://tina.io/docs/tina-cloud/faq/#how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.
1443
+ Please visit <a href="https://tina.io/docs/r/FAQ/#13-how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.
1432
1444
  </p>
1433
1445
  </div>
1434
1446
  </div>`.trim().replace(/[\r\n\s]+/g, " ");
@@ -1681,6 +1693,9 @@ var tinaTailwind = (spaPath, prebuildFilePath) => {
1681
1693
  500: "#EC4815",
1682
1694
  600: "#DC4419"
1683
1695
  },
1696
+ "tina-orange": "#EC4815",
1697
+ "tina-orange-dark": "#C2410C",
1698
+ "tina-orange-light": "#FFF7ED",
1684
1699
  background: "#FFFFFF",
1685
1700
  foreground: "#0A0A0A",
1686
1701
  muted: "#F5F5F5",
@@ -1926,7 +1941,8 @@ var createConfig = async ({
1926
1941
  babel: {
1927
1942
  // Supresses the warning [NOTE] babel The code generator has deoptimised the styling of
1928
1943
  compact: true
1929
- }
1944
+ },
1945
+ fastRefresh: false
1930
1946
  }),
1931
1947
  (0, import_vite.splitVendorChunkPlugin)(),
1932
1948
  tinaTailwind(configManager.spaRootPath, configManager.prebuildFilePath),
@@ -1941,17 +1957,17 @@ var import_pluginutils = require("@rollup/pluginutils");
1941
1957
  var import_fs = __toESM(require("fs"));
1942
1958
  var import_vite2 = require("vite");
1943
1959
  var import_esbuild2 = require("esbuild");
1944
- var import_path4 = __toESM(require("path"));
1960
+ var import_path6 = __toESM(require("path"));
1945
1961
  var import_body_parser = __toESM(require("body-parser"));
1946
1962
  var import_cors = __toESM(require("cors"));
1947
1963
  var import_graphql9 = require("@tinacms/graphql");
1948
1964
 
1949
1965
  // src/next/commands/dev-command/server/media.ts
1950
1966
  var import_fs_extra5 = __toESM(require("fs-extra"));
1951
- var import_path3 = __toESM(require("path"));
1967
+ var import_path5 = __toESM(require("path"));
1952
1968
  var import_busboy = __toESM(require("busboy"));
1953
1969
  var createMediaRouter = (config2) => {
1954
- const mediaFolder = import_path3.default.join(
1970
+ const mediaFolder = import_path5.default.join(
1955
1971
  config2.rootPath,
1956
1972
  config2.publicFolder,
1957
1973
  config2.mediaRoot
@@ -1978,8 +1994,8 @@ var createMediaRouter = (config2) => {
1978
1994
  const bb = (0, import_busboy.default)({ headers: req.headers });
1979
1995
  bb.on("file", async (_name, file, _info) => {
1980
1996
  const fullPath = decodeURI(req.url?.slice("/media/upload/".length));
1981
- const saveTo = import_path3.default.join(mediaFolder, ...fullPath.split("/"));
1982
- await import_fs_extra5.default.ensureDir(import_path3.default.dirname(saveTo));
1997
+ const saveTo = import_path5.default.join(mediaFolder, ...fullPath.split("/"));
1998
+ await import_fs_extra5.default.ensureDir(import_path5.default.dirname(saveTo));
1983
1999
  file.pipe(import_fs_extra5.default.createWriteStream(saveTo));
1984
2000
  });
1985
2001
  bb.on("error", (error) => {
@@ -2013,7 +2029,7 @@ var MediaModel = class {
2013
2029
  }
2014
2030
  async listMedia(args) {
2015
2031
  try {
2016
- const folderPath = (0, import_path3.join)(
2032
+ const folderPath = (0, import_path5.join)(
2017
2033
  this.rootPath,
2018
2034
  this.publicFolder,
2019
2035
  this.mediaRoot,
@@ -2028,7 +2044,7 @@ var MediaModel = class {
2028
2044
  }
2029
2045
  const filesStr = await import_fs_extra5.default.readdir(folderPath);
2030
2046
  const filesProm = filesStr.map(async (file) => {
2031
- const filePath = (0, import_path3.join)(folderPath, file);
2047
+ const filePath = (0, import_path5.join)(folderPath, file);
2032
2048
  const stat = await import_fs_extra5.default.stat(filePath);
2033
2049
  let src = `/${file}`;
2034
2050
  const isFile = stat.isFile();
@@ -2085,7 +2101,7 @@ var MediaModel = class {
2085
2101
  }
2086
2102
  async deleteMedia(args) {
2087
2103
  try {
2088
- const file = (0, import_path3.join)(
2104
+ const file = (0, import_path5.join)(
2089
2105
  this.rootPath,
2090
2106
  this.publicFolder,
2091
2107
  this.mediaRoot,
@@ -2150,7 +2166,7 @@ var transformTsxPlugin = ({
2150
2166
  const plug = {
2151
2167
  name: "transform-tsx",
2152
2168
  async transform(code, id) {
2153
- const extName = import_path4.default.extname(id);
2169
+ const extName = import_path6.default.extname(id);
2154
2170
  if (extName.startsWith(".tsx") || extName.startsWith(".ts")) {
2155
2171
  const result = await (0, import_esbuild2.transform)(code, { loader: "tsx" });
2156
2172
  return {
@@ -2414,14 +2430,14 @@ var DevCommand = class extends BaseCommand {
2414
2430
  graphql: graphqlSchemaObject
2415
2431
  });
2416
2432
  import_fs_extra6.default.writeFileSync(
2417
- import_path5.default.join(configManager.tinaFolderPath, tinaLockFilename),
2433
+ import_path7.default.join(configManager.tinaFolderPath, tinaLockFilename),
2418
2434
  tinaLockContent
2419
2435
  );
2420
2436
  if (configManager.hasSeparateContentRoot()) {
2421
2437
  const rootPath = await configManager.getTinaFolderPath(
2422
2438
  configManager.contentRootPath
2423
2439
  );
2424
- const filePath = import_path5.default.join(rootPath, tinaLockFilename);
2440
+ const filePath = import_path7.default.join(rootPath, tinaLockFilename);
2425
2441
  await import_fs_extra6.default.ensureFile(filePath);
2426
2442
  await import_fs_extra6.default.outputFile(filePath, tinaLockContent);
2427
2443
  }
@@ -2581,11 +2597,11 @@ ${dangerText(e.message)}
2581
2597
  // subItems: [
2582
2598
  // {
2583
2599
  // key: 'Custom queries',
2584
- // value: 'https://tina.io/querying',
2600
+ // value: 'https://tina.io/docs/r/content-api-overview',
2585
2601
  // },
2586
2602
  // {
2587
2603
  // key: 'Visual editing',
2588
- // value: 'https://tina.io/visual-editing',
2604
+ // value: 'https://tina.io/docs/r/visual-editing-setup',
2589
2605
  // },
2590
2606
  // ],
2591
2607
  // },
@@ -2596,7 +2612,7 @@ ${dangerText(e.message)}
2596
2612
  watchContentFiles(configManager, database, databaseLock, searchIndexer) {
2597
2613
  const collectionContentFiles = [];
2598
2614
  configManager.config.schema.collections.forEach((collection) => {
2599
- const collectionGlob = `${import_path5.default.join(
2615
+ const collectionGlob = `${import_path7.default.join(
2600
2616
  configManager.contentRootPath,
2601
2617
  collection.path
2602
2618
  )}/**/*.${collection.format || "md"}`;
@@ -2646,7 +2662,7 @@ ${dangerText(e.message)}
2646
2662
 
2647
2663
  // src/next/commands/build-command/index.ts
2648
2664
  var import_crypto = __toESM(require("crypto"));
2649
- var import_path6 = __toESM(require("path"));
2665
+ var import_path8 = __toESM(require("path"));
2650
2666
  var import_core3 = require("@graphql-inspector/core");
2651
2667
  var import_graphql11 = require("@tinacms/graphql");
2652
2668
  var import_schema_tools2 = require("@tinacms/schema-tools");
@@ -2661,7 +2677,7 @@ var import_core2 = require("@graphql-inspector/core");
2661
2677
  var getFaqLink = (type) => {
2662
2678
  switch (type) {
2663
2679
  case import_core2.ChangeType.FieldRemoved: {
2664
- return "https://tina.io/docs/introduction/faq#how-do-i-resolve-the-local-graphql-schema-doesnt-match-the-remote-graphql-schema-errors";
2680
+ return "https://tina.io/docs/r/FAQ/#2-how-do-i-resolve-the-local-graphql-schema-doesnt-match-the-remote-graphql-schema-error";
2665
2681
  }
2666
2682
  default:
2667
2683
  return null;
@@ -2942,45 +2958,63 @@ ${dangerText(e.message)}
2942
2958
  }
2943
2959
  const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
2944
2960
  if (!skipCloudChecks) {
2945
- const { hasUpstream, timestamp } = await this.checkClientInfo(
2946
- configManager,
2947
- codegen2.productionUrl,
2948
- this.previewBaseBranch
2949
- );
2950
- if (!hasUpstream && this.upstreamBranch) {
2951
- logger.warn(
2952
- `${dangerText(
2953
- `WARN: Upstream branch '${this.upstreamBranch}' specified but no upstream project was found.`
2954
- )}`
2961
+ try {
2962
+ const clientInfo = await this.checkClientInfo(
2963
+ configManager,
2964
+ codegen2.productionUrl,
2965
+ this.previewBaseBranch
2955
2966
  );
2967
+ if (clientInfo.detectedBotBranch) {
2968
+ logger.warn(
2969
+ `${warnText(
2970
+ `WARN: Detected bot branch. Using schema/content from default branch '${clientInfo.defaultBranch}' instead of '${configManager.config.branch}'.`
2971
+ )}`
2972
+ );
2973
+ }
2974
+ if (!clientInfo.hasUpstream && this.upstreamBranch) {
2975
+ logger.warn(
2976
+ `${dangerText(
2977
+ `WARN: Upstream branch '${this.upstreamBranch}' specified but no upstream project was found.`
2978
+ )}`
2979
+ );
2980
+ }
2981
+ if (clientInfo.hasUpstream || this.previewBaseBranch && this.previewName) {
2982
+ await this.syncProject(configManager, codegen2.productionUrl, {
2983
+ upstreamBranch: this.upstreamBranch,
2984
+ previewBaseBranch: this.previewBaseBranch,
2985
+ previewName: this.previewName
2986
+ });
2987
+ }
2988
+ await waitForDB(
2989
+ configManager.config,
2990
+ codegen2.productionUrl,
2991
+ this.previewName,
2992
+ false
2993
+ );
2994
+ await this.checkGraphqlSchema(
2995
+ configManager,
2996
+ database,
2997
+ codegen2.productionUrl,
2998
+ clientInfo.timestamp
2999
+ );
3000
+ await this.checkTinaSchema(
3001
+ configManager,
3002
+ database,
3003
+ codegen2.productionUrl,
3004
+ this.previewName,
3005
+ this.verbose,
3006
+ clientInfo.timestamp
3007
+ );
3008
+ } catch (e) {
3009
+ logger.error(`
3010
+
3011
+ ${dangerText(e.message)}
3012
+ `);
3013
+ if (this.verbose) {
3014
+ console.error(e);
3015
+ }
3016
+ process.exit(1);
2956
3017
  }
2957
- if (hasUpstream || this.previewBaseBranch && this.previewName) {
2958
- await this.syncProject(configManager, codegen2.productionUrl, {
2959
- upstreamBranch: this.upstreamBranch,
2960
- previewBaseBranch: this.previewBaseBranch,
2961
- previewName: this.previewName
2962
- });
2963
- }
2964
- await waitForDB(
2965
- configManager.config,
2966
- codegen2.productionUrl,
2967
- this.previewName,
2968
- false
2969
- );
2970
- await this.checkGraphqlSchema(
2971
- configManager,
2972
- database,
2973
- codegen2.productionUrl,
2974
- timestamp
2975
- );
2976
- await this.checkTinaSchema(
2977
- configManager,
2978
- database,
2979
- codegen2.productionUrl,
2980
- this.previewName,
2981
- this.verbose,
2982
- timestamp
2983
- );
2984
3018
  }
2985
3019
  await buildProductionSpa(configManager, database, codegen2.productionUrl);
2986
3020
  await import_fs_extra7.default.outputFile(
@@ -3093,86 +3127,88 @@ ${dangerText(e.message)}
3093
3127
  }
3094
3128
  }
3095
3129
  async checkClientInfo(configManager, apiURL, previewBaseBranch) {
3130
+ const MAX_RETRIES = 5;
3096
3131
  const { config: config2 } = configManager;
3097
3132
  const token = config2.token;
3098
3133
  const { clientId, branch, host } = (0, import_schema_tools2.parseURL)(apiURL);
3099
- const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
3100
3134
  const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
3101
- let branchKnown = false;
3102
- let hasUpstream = false;
3103
- let timestamp;
3104
- try {
3105
- const res = await request({
3106
- token,
3107
- url
3108
- });
3109
- timestamp = res.timestamp || 0;
3110
- bar2.tick({
3111
- prog: "\u2705"
3112
- });
3113
- if (!(res.status === "unknown")) {
3114
- branchKnown = true;
3115
- }
3116
- if (res.hasUpstream) {
3117
- hasUpstream = true;
3135
+ const getBranchInfo = async () => {
3136
+ const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
3137
+ const branchInfo2 = {
3138
+ status: "unknown",
3139
+ branchKnown: false,
3140
+ hasUpstream: false,
3141
+ timestamp: 0,
3142
+ detectedBotBranch: false,
3143
+ defaultBranch: void 0
3144
+ };
3145
+ try {
3146
+ const res = await request({
3147
+ token,
3148
+ url
3149
+ });
3150
+ branchInfo2.status = res.status;
3151
+ branchInfo2.branchKnown = res.status !== "unknown";
3152
+ branchInfo2.timestamp = res.timestamp || 0;
3153
+ branchInfo2.hasUpstream = res.hasUpstream;
3154
+ branchInfo2.detectedBotBranch = res.json.detectedBotBranch;
3155
+ branchInfo2.defaultBranch = res.json.defaultBranch;
3156
+ } catch (e) {
3157
+ summary({
3158
+ heading: "Error when checking client information",
3159
+ items: [
3160
+ {
3161
+ emoji: "\u274C",
3162
+ heading: "You provided",
3163
+ subItems: [
3164
+ {
3165
+ key: "clientId",
3166
+ value: config2.clientId
3167
+ },
3168
+ {
3169
+ key: "branch",
3170
+ value: config2.branch
3171
+ },
3172
+ {
3173
+ key: "token",
3174
+ value: config2.token
3175
+ }
3176
+ ]
3177
+ }
3178
+ ]
3179
+ });
3180
+ throw e;
3118
3181
  }
3119
- } catch (e) {
3120
- summary({
3121
- heading: "Error when checking client information",
3122
- items: [
3123
- {
3124
- emoji: "\u274C",
3125
- heading: "You provided",
3126
- subItems: [
3127
- {
3128
- key: "clientId",
3129
- value: config2.clientId
3130
- },
3131
- {
3132
- key: "branch",
3133
- value: config2.branch
3134
- },
3135
- {
3136
- key: "token",
3137
- value: config2.token
3138
- }
3139
- ]
3140
- }
3141
- ]
3142
- });
3143
- throw e;
3144
- }
3145
- const branchBar = new import_progress2.default("Checking branch is on TinaCloud. :prog", 1);
3146
- if (branchKnown) {
3182
+ return branchInfo2;
3183
+ };
3184
+ const branchInfo = await getBranchInfo();
3185
+ bar2.tick({
3186
+ prog: "\u2705"
3187
+ });
3188
+ const branchBar = new import_progress2.default(
3189
+ `Checking branch '${config2.branch}' is on TinaCloud. :prog`,
3190
+ 1
3191
+ );
3192
+ if (branchInfo.branchKnown) {
3147
3193
  branchBar.tick({
3148
3194
  prog: "\u2705"
3149
3195
  });
3150
- return {
3151
- hasUpstream,
3152
- timestamp
3153
- };
3196
+ return branchInfo;
3154
3197
  }
3155
- for (let i = 0; i <= 5; i++) {
3156
- await sleepAndCallFunc({
3157
- fn: async () => {
3158
- const res = await request({
3159
- token,
3160
- url
3161
- });
3162
- if (this.verbose) {
3163
- logger.info(
3164
- `Branch status: ${res.status}. Attempt: ${i + 1}. Trying again in 5 seconds.`
3165
- );
3166
- }
3167
- if (!(res.status === "unknown")) {
3168
- branchBar.tick({
3169
- prog: "\u2705"
3170
- });
3171
- return;
3172
- }
3173
- },
3174
- ms: 5e3
3175
- });
3198
+ for (let i = 1; i <= MAX_RETRIES; i++) {
3199
+ await timeout(5e3);
3200
+ const branchInfo2 = await getBranchInfo();
3201
+ if (this.verbose) {
3202
+ logger.info(
3203
+ `Branch status: ${branchInfo2.status}. Attempt: ${i}. Trying again in 5 seconds.`
3204
+ );
3205
+ }
3206
+ if (branchInfo2.branchKnown) {
3207
+ branchBar.tick({
3208
+ prog: "\u2705"
3209
+ });
3210
+ return branchInfo2;
3211
+ }
3176
3212
  }
3177
3213
  branchBar.tick({
3178
3214
  prog: "\u274C"
@@ -3180,7 +3216,7 @@ ${dangerText(e.message)}
3180
3216
  logger.error(
3181
3217
  `${dangerText(
3182
3218
  `ERROR: Branch '${branch}' is not on TinaCloud.`
3183
- )} Please make sure that branch '${branch}' exists in your repository and that you have pushed your all changes to the remote. View all all branches and there current status here: ${linkText(
3219
+ )} Please make sure that branch '${branch}' exists in your repository and that you have pushed your all changes to the remote. View all branches and their current status here: ${linkText(
3184
3220
  `https://app.tina.io/projects/${clientId}/configuration`
3185
3221
  )}`
3186
3222
  );
@@ -3348,7 +3384,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
3348
3384
  }
3349
3385
  const localTinaSchema = JSON.parse(
3350
3386
  await database.bridge.get(
3351
- import_path6.default.join(database.tinaDirectory, "__generated__", "_schema.json")
3387
+ import_path8.default.join(database.tinaDirectory, "__generated__", "_schema.json")
3352
3388
  )
3353
3389
  );
3354
3390
  localTinaSchema.version = void 0;
@@ -3403,12 +3439,12 @@ async function request(args) {
3403
3439
  Message from server: ${json.message}`;
3404
3440
  }
3405
3441
  throw new Error(
3406
- `Server responded with status code ${res.status}, ${res.statusText}. ${additionalInfo ? additionalInfo : ""} Please see our FAQ for more information: https://tina.io/docs/errors/faq/`
3442
+ `Server responded with status code ${res.status}, ${res.statusText}. ${additionalInfo ? additionalInfo : ""} Please see our FAQ for more information: https://tina.io/docs/r/FAQ/`
3407
3443
  );
3408
3444
  }
3409
3445
  if (json.errors) {
3410
3446
  throw new Error(
3411
- `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/
3447
+ `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/r/FAQ/
3412
3448
 
3413
3449
  Errors:
3414
3450
  ${json.errors.map((error) => error.message).join("\n")}`
@@ -3417,7 +3453,8 @@ Message from server: ${json.message}`;
3417
3453
  return {
3418
3454
  status: json?.status,
3419
3455
  timestamp: json?.timestamp,
3420
- hasUpstream: json?.hasUpstream || false
3456
+ hasUpstream: json?.hasUpstream || false,
3457
+ json
3421
3458
  };
3422
3459
  }
3423
3460
  var fetchRemoteGraphqlSchema = async ({
@@ -3718,25 +3755,25 @@ var import_clipanion6 = require("clipanion");
3718
3755
 
3719
3756
  // src/cmds/init/detectEnvironment.ts
3720
3757
  var import_fs_extra8 = __toESM(require("fs-extra"));
3721
- var import_path7 = __toESM(require("path"));
3758
+ var import_path9 = __toESM(require("path"));
3722
3759
  var checkGitignoreForItem = async ({
3723
3760
  baseDir,
3724
3761
  line
3725
3762
  }) => {
3726
- const gitignoreContent = import_fs_extra8.default.readFileSync(import_path7.default.join(baseDir, ".gitignore")).toString();
3763
+ const gitignoreContent = import_fs_extra8.default.readFileSync(import_path9.default.join(baseDir, ".gitignore")).toString();
3727
3764
  return gitignoreContent.split("\n").some((item) => item === line);
3728
3765
  };
3729
3766
  var makeGeneratedFile = async (name2, generatedFileType, parentPath, opts) => {
3730
3767
  const result = {
3731
- fullPathTS: import_path7.default.join(
3768
+ fullPathTS: import_path9.default.join(
3732
3769
  parentPath,
3733
3770
  `${name2}.${opts?.typescriptSuffix || opts?.extensionOverride || "ts"}`
3734
3771
  ),
3735
- fullPathJS: import_path7.default.join(
3772
+ fullPathJS: import_path9.default.join(
3736
3773
  parentPath,
3737
3774
  `${name2}.${opts?.extensionOverride || "js"}`
3738
3775
  ),
3739
- fullPathOverride: opts?.extensionOverride ? import_path7.default.join(parentPath, `${name2}.${opts?.extensionOverride}`) : "",
3776
+ fullPathOverride: opts?.extensionOverride ? import_path9.default.join(parentPath, `${name2}.${opts?.extensionOverride}`) : "",
3740
3777
  generatedFileType,
3741
3778
  name: name2,
3742
3779
  parentPath,
@@ -3765,16 +3802,16 @@ var detectEnvironment = async ({
3765
3802
  debug = false
3766
3803
  }) => {
3767
3804
  const hasForestryConfig = await import_fs_extra8.default.pathExists(
3768
- import_path7.default.join(pathToForestryConfig, ".forestry", "settings.yml")
3805
+ import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
3769
3806
  );
3770
- const sampleContentPath = import_path7.default.join(
3807
+ const sampleContentPath = import_path9.default.join(
3771
3808
  baseDir,
3772
3809
  "content",
3773
3810
  "posts",
3774
3811
  "hello-world.md"
3775
3812
  );
3776
- const usingSrc = import_fs_extra8.default.pathExistsSync(import_path7.default.join(baseDir, "src")) && (import_fs_extra8.default.pathExistsSync(import_path7.default.join(baseDir, "src", "app")) || import_fs_extra8.default.pathExistsSync(import_path7.default.join(baseDir, "src", "pages")));
3777
- const tinaFolder = import_path7.default.join(baseDir, "tina");
3813
+ const usingSrc = import_fs_extra8.default.pathExistsSync(import_path9.default.join(baseDir, "src")) && (import_fs_extra8.default.pathExistsSync(import_path9.default.join(baseDir, "src", "app")) || import_fs_extra8.default.pathExistsSync(import_path9.default.join(baseDir, "src", "pages")));
3814
+ const tinaFolder = import_path9.default.join(baseDir, "tina");
3778
3815
  const tinaConfigExists = Boolean(
3779
3816
  // Does the tina folder exist?
3780
3817
  await import_fs_extra8.default.pathExists(tinaFolder) && // Does the tina folder contain a config file?
@@ -3790,12 +3827,12 @@ var detectEnvironment = async ({
3790
3827
  "next-api-handler": await makeGeneratedFile(
3791
3828
  "[...routes]",
3792
3829
  "next-api-handler",
3793
- import_path7.default.join(...pagesDir, "api", "tina")
3830
+ import_path9.default.join(...pagesDir, "api", "tina")
3794
3831
  ),
3795
3832
  "reactive-example": await makeGeneratedFile(
3796
3833
  "[filename]",
3797
3834
  "reactive-example",
3798
- import_path7.default.join(...pagesDir, "demo", "blog"),
3835
+ import_path9.default.join(...pagesDir, "demo", "blog"),
3799
3836
  {
3800
3837
  typescriptSuffix: "tsx"
3801
3838
  }
@@ -3803,13 +3840,13 @@ var detectEnvironment = async ({
3803
3840
  "users-json": await makeGeneratedFile(
3804
3841
  "index",
3805
3842
  "users-json",
3806
- import_path7.default.join(baseDir, "content", "users"),
3843
+ import_path9.default.join(baseDir, "content", "users"),
3807
3844
  { extensionOverride: "json" }
3808
3845
  ),
3809
3846
  "sample-content": await makeGeneratedFile(
3810
3847
  "hello-world",
3811
3848
  "sample-content",
3812
- import_path7.default.join(baseDir, "content", "posts"),
3849
+ import_path9.default.join(baseDir, "content", "posts"),
3813
3850
  { extensionOverride: "md" }
3814
3851
  )
3815
3852
  };
@@ -3835,13 +3872,13 @@ var detectEnvironment = async ({
3835
3872
  );
3836
3873
  }
3837
3874
  }
3838
- const hasGitIgnore = await import_fs_extra8.default.pathExists(import_path7.default.join(".gitignore"));
3875
+ const hasGitIgnore = await import_fs_extra8.default.pathExists(import_path9.default.join(".gitignore"));
3839
3876
  const hasGitIgnoreNodeModules = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: "node_modules" });
3840
3877
  const hasEnvTina = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env.tina" });
3841
3878
  const hasGitIgnoreEnv = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env" });
3842
3879
  let frontMatterFormat;
3843
3880
  if (hasForestryConfig) {
3844
- const hugoConfigPath = import_path7.default.join(rootPath, "config.toml");
3881
+ const hugoConfigPath = import_path9.default.join(rootPath, "config.toml");
3845
3882
  if (await import_fs_extra8.default.pathExists(hugoConfigPath)) {
3846
3883
  const hugoConfig = await import_fs_extra8.default.readFile(hugoConfigPath, "utf8");
3847
3884
  const metaDataFormat = hugoConfig.toString().match(/metaDataFormat = "(.*)"/)?.[1];
@@ -3943,7 +3980,7 @@ var chooseGitProvider = async ({ config: config2 }) => {
3943
3980
  ${logText(
3944
3981
  "Learn more here: "
3945
3982
  )}${linkText(
3946
- "https://tina.io/docs/self-hosted/existing-site/#github-personal-access-token"
3983
+ "https://tina.io/docs/r/self-hosting-nextjs/#github-personal-access-token"
3947
3984
  )}`,
3948
3985
  initial: process.env.GITHUB_PERSONAL_ACCESS_TOKEN
3949
3986
  },
@@ -4204,7 +4241,8 @@ var askCommonSetUp = async () => {
4204
4241
  choices: [
4205
4242
  { title: "PNPM", value: "pnpm" },
4206
4243
  { title: "Yarn", value: "yarn" },
4207
- { title: "NPM", value: "npm" }
4244
+ { title: "NPM", value: "npm" },
4245
+ { title: "Bun", value: "bun" }
4208
4246
  ]
4209
4247
  }
4210
4248
  ]);
@@ -4265,7 +4303,7 @@ var askTinaSetupPrompts = async (params) => {
4265
4303
  message: `Where are public assets stored? (default: "public")
4266
4304
  ` + logText(
4267
4305
  `Not sure what value to use? Refer to our "Frameworks" doc: ${linkText(
4268
- "https://tina.io/docs/integration/frameworks/#configuring-tina-with-each-framework"
4306
+ "https://tina.io/docs/r/framework-guides-overview"
4269
4307
  )}`
4270
4308
  )
4271
4309
  });
@@ -4455,18 +4493,19 @@ var CLICommand = class {
4455
4493
  };
4456
4494
 
4457
4495
  // src/cmds/init/apply.ts
4458
- var import_path11 = __toESM(require("path"));
4496
+ var import_path13 = __toESM(require("path"));
4459
4497
 
4460
4498
  // src/cmds/forestry-migrate/index.ts
4461
4499
  var import_fs_extra10 = __toESM(require("fs-extra"));
4462
- var import_path9 = __toESM(require("path"));
4500
+ var import_path11 = __toESM(require("path"));
4463
4501
  var import_js_yaml2 = __toESM(require("js-yaml"));
4464
- var import_minimatch = __toESM(require("minimatch"));
4502
+ var import_minimatch = require("minimatch");
4465
4503
  var import_graphql16 = require("@tinacms/graphql");
4504
+ var import_schema_tools3 = require("@tinacms/schema-tools");
4466
4505
 
4467
4506
  // src/cmds/forestry-migrate/util/index.ts
4468
4507
  var import_fs_extra9 = __toESM(require("fs-extra"));
4469
- var import_path8 = __toESM(require("path"));
4508
+ var import_path10 = __toESM(require("path"));
4470
4509
  var import_js_yaml = __toESM(require("js-yaml"));
4471
4510
  var import_zod = __toESM(require("zod"));
4472
4511
 
@@ -4891,7 +4930,7 @@ var transformForestryFieldsToTinaFields = ({
4891
4930
  return tinaFields;
4892
4931
  };
4893
4932
  var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false }) => {
4894
- const templatePath = import_path8.default.join(
4933
+ const templatePath = import_path10.default.join(
4895
4934
  pathToForestryConfig,
4896
4935
  ".forestry",
4897
4936
  "front_matter",
@@ -4956,7 +4995,7 @@ var transformForestryMatchToTinaMatch = (match) => {
4956
4995
  };
4957
4996
  function checkExt(ext) {
4958
4997
  const extReal = ext.replace(".", "");
4959
- if (["mdx", "md", "json", "yaml", "yml", "toml"].includes(extReal)) {
4998
+ if (import_schema_tools3.CONTENT_FORMATS.includes(extReal)) {
4960
4999
  return extReal;
4961
5000
  } else {
4962
5001
  return false;
@@ -4966,8 +5005,8 @@ var generateAllTemplates = async ({
4966
5005
  pathToForestryConfig
4967
5006
  }) => {
4968
5007
  const allTemplates = (await import_fs_extra10.default.readdir(
4969
- import_path9.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
4970
- )).map((tem) => import_path9.default.basename(tem, ".yml"));
5008
+ import_path11.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
5009
+ )).map((tem) => import_path11.default.basename(tem, ".yml"));
4971
5010
  const templateMap = /* @__PURE__ */ new Map();
4972
5011
  const proms = allTemplates.map(async (tem) => {
4973
5012
  try {
@@ -5042,7 +5081,7 @@ var generateCollectionFromForestrySection = (args) => {
5042
5081
  glob = section.path + "/" + section.match;
5043
5082
  }
5044
5083
  if (pages.some((page) => {
5045
- return (0, import_minimatch.default)(page, glob);
5084
+ return (0, import_minimatch.minimatch)(page, glob);
5046
5085
  })) {
5047
5086
  forestryTemplates.push(templateKey);
5048
5087
  }
@@ -5112,9 +5151,9 @@ var generateCollectionFromForestrySection = (args) => {
5112
5151
  return c;
5113
5152
  } else if (section.type === "document") {
5114
5153
  const filePath = section.path;
5115
- const extname = import_path9.default.extname(filePath);
5116
- const fileName = import_path9.default.basename(filePath, extname);
5117
- const dir = import_path9.default.dirname(filePath);
5154
+ const extname = import_path11.default.extname(filePath);
5155
+ const fileName = import_path11.default.basename(filePath, extname);
5156
+ const dir = import_path11.default.dirname(filePath);
5118
5157
  const ext = checkExt(extname);
5119
5158
  if (ext) {
5120
5159
  const fields = [];
@@ -5134,7 +5173,7 @@ var generateCollectionFromForestrySection = (args) => {
5134
5173
  name: "dummy",
5135
5174
  label: "Dummy field",
5136
5175
  type: "string",
5137
- description: "This is a dummy field, please replace it with the fields you want to edit. See https://tina.io/docs/schema/ for more info"
5176
+ description: "This is a dummy field, please replace it with the fields you want to edit. See https://tina.io/docs/r/content-modelling-collections/ for more info"
5138
5177
  });
5139
5178
  logger.warn(
5140
5179
  warnText(
@@ -5177,7 +5216,7 @@ var generateCollections = async ({
5177
5216
  usingTypescript
5178
5217
  });
5179
5218
  const forestryConfig = await import_fs_extra10.default.readFile(
5180
- import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
5219
+ import_path11.default.join(pathToForestryConfig, ".forestry", "settings.yml")
5181
5220
  );
5182
5221
  rewriteTemplateKeysInDocs({
5183
5222
  templateMap,
@@ -5207,11 +5246,11 @@ var rewriteTemplateKeysInDocs = (args) => {
5207
5246
  const { templateObj } = templateMap.get(templateKey);
5208
5247
  templateObj?.pages?.forEach((page) => {
5209
5248
  try {
5210
- const filePath = import_path9.default.join(page);
5249
+ const filePath = import_path11.default.join(page);
5211
5250
  if (import_fs_extra10.default.lstatSync(filePath).isDirectory()) {
5212
5251
  return;
5213
5252
  }
5214
- const extname = import_path9.default.extname(filePath);
5253
+ const extname = import_path11.default.extname(filePath);
5215
5254
  const fileContent = import_fs_extra10.default.readFileSync(filePath).toString();
5216
5255
  const content = (0, import_graphql16.parseFile)(
5217
5256
  fileContent,
@@ -5243,7 +5282,7 @@ var import_fs_extra13 = __toESM(require("fs-extra"));
5243
5282
  // src/next/commands/codemod-command/index.ts
5244
5283
  var import_clipanion5 = require("clipanion");
5245
5284
  var import_fs_extra11 = __toESM(require("fs-extra"));
5246
- var import_path10 = __toESM(require("path"));
5285
+ var import_path12 = __toESM(require("path"));
5247
5286
  var CodemodCommand = class extends import_clipanion5.Command {
5248
5287
  constructor() {
5249
5288
  super(...arguments);
@@ -5291,7 +5330,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
5291
5330
  logger.error(e.message);
5292
5331
  process.exit(1);
5293
5332
  }
5294
- const tinaDestination = import_path10.default.join(configManager.rootPath, "tina");
5333
+ const tinaDestination = import_path12.default.join(configManager.rootPath, "tina");
5295
5334
  if (await import_fs_extra11.default.existsSync(tinaDestination)) {
5296
5335
  logger.info(
5297
5336
  `Folder already exists at ${tinaDestination}. Either delete this folder to complete the codemod, or ensure you have properly copied your config from the ".tina" folder.`
@@ -5306,7 +5345,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
5306
5345
  };
5307
5346
  var writeGitignore = async (rootPath) => {
5308
5347
  await import_fs_extra11.default.outputFileSync(
5309
- import_path10.default.join(rootPath, "tina", ".gitignore"),
5348
+ import_path12.default.join(rootPath, "tina", ".gitignore"),
5310
5349
  "__generated__"
5311
5350
  );
5312
5351
  };
@@ -5359,7 +5398,7 @@ const BlogPage = (props) => {
5359
5398
  <div className='bg-green-100 text-center'>
5360
5399
  Lost and looking for a place to start?
5361
5400
  <a
5362
- href='https://tina.io/guides/tina-cloud/getting-started/overview/'
5401
+ href='https://tina.io/docs/r/beginner-series'
5363
5402
  className='text-blue-500 underline'
5364
5403
  >
5365
5404
  {' '}
@@ -5641,7 +5680,7 @@ import { LocalAuthProvider } from "tinacms";`;
5641
5680
  publicFolder: "${args.publicFolder}",
5642
5681
  },
5643
5682
  },
5644
- // See docs on content modeling for more info on how to setup new content models: https://tina.io/docs/schema/
5683
+ // See docs on content modeling for more info on how to setup new content models: https://tina.io/docs/r/content-modelling-collections/
5645
5684
  schema: {
5646
5685
  collections: ${generateCollectionString(args)},
5647
5686
  },
@@ -6142,8 +6181,8 @@ async function apply({
6142
6181
  await addConfigFile({
6143
6182
  configArgs: {
6144
6183
  config: config2,
6145
- publicFolder: import_path11.default.join(
6146
- import_path11.default.relative(process.cwd(), pathToForestryConfig),
6184
+ publicFolder: import_path13.default.join(
6185
+ import_path13.default.relative(process.cwd(), pathToForestryConfig),
6147
6186
  config2.publicFolder
6148
6187
  ),
6149
6188
  collections,
@@ -6216,18 +6255,18 @@ var createPackageJSON = async () => {
6216
6255
  };
6217
6256
  var createGitignore = async ({ baseDir }) => {
6218
6257
  logger.info(logText("No .gitignore found, creating one"));
6219
- import_fs_extra13.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
6258
+ import_fs_extra13.default.outputFileSync(import_path13.default.join(baseDir, ".gitignore"), "node_modules");
6220
6259
  };
6221
6260
  var updateGitIgnore = async ({
6222
6261
  baseDir,
6223
6262
  items
6224
6263
  }) => {
6225
6264
  logger.info(logText(`Adding ${items.join(",")} to .gitignore`));
6226
- const gitignoreContent = import_fs_extra13.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
6265
+ const gitignoreContent = import_fs_extra13.default.readFileSync(import_path13.default.join(baseDir, ".gitignore")).toString();
6227
6266
  const newGitignoreContent = [...gitignoreContent.split("\n"), ...items].join(
6228
6267
  "\n"
6229
6268
  );
6230
- await import_fs_extra13.default.writeFile(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
6269
+ await import_fs_extra13.default.writeFile(import_path13.default.join(baseDir, ".gitignore"), newGitignoreContent);
6231
6270
  };
6232
6271
  var addDependencies = async (config2, env, params) => {
6233
6272
  const { packageManager } = config2;
@@ -6268,7 +6307,8 @@ var addDependencies = async (config2, env, params) => {
6268
6307
  let packageManagers = {
6269
6308
  pnpm: process.env.USE_WORKSPACE ? `pnpm add ${deps.join(" ")} --workspace` : `pnpm add ${deps.join(" ")}`,
6270
6309
  npm: `npm install ${deps.join(" ")}`,
6271
- yarn: `yarn add ${deps.join(" ")}`
6310
+ yarn: `yarn add ${deps.join(" ")}`,
6311
+ bun: `bun add ${deps.join(" ")}`
6272
6312
  };
6273
6313
  if (packageManagers[packageManager] && deps.length > 0) {
6274
6314
  logger.info(logText("Adding dependencies, this might take a moment..."));
@@ -6279,7 +6319,8 @@ var addDependencies = async (config2, env, params) => {
6279
6319
  packageManagers = {
6280
6320
  pnpm: process.env.USE_WORKSPACE ? `pnpm add -D ${devDeps.join(" ")} --workspace` : `pnpm add -D ${devDeps.join(" ")}`,
6281
6321
  npm: `npm install -D ${devDeps.join(" ")}`,
6282
- yarn: `yarn add -D ${devDeps.join(" ")}`
6322
+ yarn: `yarn add -D ${devDeps.join(" ")}`,
6323
+ bun: `bun add -D ${devDeps.join(" ")}`
6283
6324
  };
6284
6325
  if (packageManagers[packageManager]) {
6285
6326
  logger.info(
@@ -6296,22 +6337,22 @@ var writeGeneratedFile = async ({
6296
6337
  content,
6297
6338
  typescript
6298
6339
  }) => {
6299
- const { exists, path: path14, parentPath } = generatedFile.resolve(typescript);
6340
+ const { exists, path: path15, parentPath } = generatedFile.resolve(typescript);
6300
6341
  if (exists) {
6301
6342
  if (overwrite) {
6302
- logger.info(`Overwriting file at ${path14}... \u2705`);
6303
- import_fs_extra13.default.outputFileSync(path14, content);
6343
+ logger.info(`Overwriting file at ${path15}... \u2705`);
6344
+ import_fs_extra13.default.outputFileSync(path15, content);
6304
6345
  } else {
6305
- logger.info(`Not overwriting file at ${path14}.`);
6346
+ logger.info(`Not overwriting file at ${path15}.`);
6306
6347
  logger.info(
6307
- logText(`Please add the following to ${path14}:
6348
+ logText(`Please add the following to ${path15}:
6308
6349
  ${indentText(content)}}`)
6309
6350
  );
6310
6351
  }
6311
6352
  } else {
6312
- logger.info(`Adding file at ${path14}... \u2705`);
6353
+ logger.info(`Adding file at ${path15}... \u2705`);
6313
6354
  await import_fs_extra13.default.ensureDir(parentPath);
6314
- import_fs_extra13.default.outputFileSync(path14, content);
6355
+ import_fs_extra13.default.outputFileSync(path15, content);
6315
6356
  }
6316
6357
  };
6317
6358
  var addConfigFile = async ({
@@ -6389,7 +6430,7 @@ var addContentFile = async ({
6389
6430
  return () => ({
6390
6431
  exists: env.sampleContentExists,
6391
6432
  path: env.sampleContentPath,
6392
- parentPath: import_path11.default.dirname(env.sampleContentPath)
6433
+ parentPath: import_path13.default.dirname(env.sampleContentPath)
6393
6434
  });
6394
6435
  }
6395
6436
  },
@@ -6412,7 +6453,7 @@ ${titleText(" TinaCMS ")} backend initialized!`));
6412
6453
  return `${x.key}=${x.value || "***"}`;
6413
6454
  }).join("\n") + `
6414
6455
  TINA_PUBLIC_IS_LOCAL=true`;
6415
- const envFile = import_path11.default.join(process.cwd(), ".env");
6456
+ const envFile = import_path13.default.join(process.cwd(), ".env");
6416
6457
  if (!import_fs_extra13.default.existsSync(envFile)) {
6417
6458
  logger.info(`Adding .env file to your project... \u2705`);
6418
6459
  import_fs_extra13.default.writeFileSync(envFile, envFileText);
@@ -6458,7 +6499,8 @@ var other = ({ packageManager }) => {
6458
6499
  pnpm: `pnpm`,
6459
6500
  npm: `npx`,
6460
6501
  // npx is the way to run executables that aren't in your "scripts"
6461
- yarn: `yarn`
6502
+ yarn: `yarn`,
6503
+ bun: `bun run`
6462
6504
  };
6463
6505
  return `${packageManagers[packageManager]} tinacms dev -c "<your dev command>"`;
6464
6506
  };
@@ -6471,7 +6513,8 @@ var frameworkDevCmds = {
6471
6513
  pnpm: `pnpm`,
6472
6514
  npm: `npm run`,
6473
6515
  // npx is the way to run executables that aren't in your "scripts"
6474
- yarn: `yarn`
6516
+ yarn: `yarn`,
6517
+ bun: `bun run`
6475
6518
  };
6476
6519
  return `${packageManagers[packageManager]} dev`;
6477
6520
  }
@@ -6484,7 +6527,7 @@ var addReactiveFile = {
6484
6527
  baseDir,
6485
6528
  dataLayer
6486
6529
  }) => {
6487
- const packageJsonPath = import_path11.default.join(baseDir, "package.json");
6530
+ const packageJsonPath = import_path13.default.join(baseDir, "package.json");
6488
6531
  await writeGeneratedFile({
6489
6532
  generatedFile,
6490
6533
  typescript: config2.typescript,
@@ -20,8 +20,11 @@ export declare class BuildCommand extends BaseCommand {
20
20
  catch(error: any): Promise<void>;
21
21
  execute(): Promise<number | void>;
22
22
  checkClientInfo(configManager: ConfigManager, apiURL: string, previewBaseBranch?: string): Promise<{
23
+ branchKnown: boolean;
23
24
  hasUpstream: boolean;
24
25
  timestamp: number;
26
+ detectedBotBranch: boolean;
27
+ defaultBranch: string | undefined;
25
28
  }>;
26
29
  syncProject(configManager: ConfigManager, apiURL: string, options?: {
27
30
  upstreamBranch?: string;
@@ -2,4 +2,4 @@
2
2
 
3
3
  */
4
4
  import http from 'node:http';
5
- export declare const gqlServer: (database: any, verbose: boolean) => Promise<http.Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>>;
5
+ export declare const gqlServer: (database: any, verbose: boolean) => Promise<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>>;
@@ -0,0 +1,3 @@
1
+ /** Removes trailing slash from path. Separator to remove is chosen based on
2
+ * operating system. */
3
+ export declare function stripNativeTrailingSlash(p: string): string;
@@ -1,3 +1,4 @@
1
+ export declare function timeout(ms: any): Promise<void>;
1
2
  export declare function sleepAndCallFunc<T>({ fn, ms, }: {
2
3
  fn: () => Promise<T>;
3
4
  ms: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
- "version": "0.0.0-f0adfbf-20250521015212",
3
+ "version": "0.0.0-f2577b9-20251119082459",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -37,11 +37,12 @@
37
37
  "@types/listr": "0.14.2",
38
38
  "@types/log4js": "^2.3.5",
39
39
  "@types/multer": "^1.4.12",
40
+ "@types/node": "^22.13.1",
40
41
  "@types/progress": "^2.0.7",
41
42
  "@types/prompts": "^2.4.9",
42
43
  "@types/yup": "^0.32.0",
43
44
  "jest": "^29.7.0",
44
- "@tinacms/scripts": "0.0.0-f0adfbf-20250521015212"
45
+ "@tinacms/scripts": "0.0.0-f2577b9-20251119082459"
45
46
  },
46
47
  "dependencies": {
47
48
  "@graphql-codegen/core": "^2.6.8",
@@ -89,12 +90,12 @@
89
90
  "vite": "^4.5.9",
90
91
  "yup": "^1.6.1",
91
92
  "zod": "^3.24.2",
92
- "@tinacms/app": "0.0.0-f0adfbf-20250521015212",
93
- "@tinacms/graphql": "1.5.17",
94
- "@tinacms/schema-tools": "1.7.3",
95
- "@tinacms/search": "1.0.44",
96
- "@tinacms/metrics": "1.0.9",
97
- "tinacms": "0.0.0-f0adfbf-20250521015212"
93
+ "@tinacms/metrics": "1.1.0",
94
+ "@tinacms/app": "0.0.0-f2577b9-20251119082459",
95
+ "@tinacms/schema-tools": "0.0.0-f2577b9-20251119082459",
96
+ "@tinacms/search": "0.0.0-f2577b9-20251119082459",
97
+ "@tinacms/graphql": "0.0.0-f2577b9-20251119082459",
98
+ "tinacms": "0.0.0-f2577b9-20251119082459"
98
99
  },
99
100
  "publishConfig": {
100
101
  "registry": "https://registry.npmjs.org"