@tinacms/cli 1.9.7 → 1.9.8

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
@@ -35,7 +35,7 @@ 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.9.8";
39
39
 
40
40
  // src/next/commands/dev-command/index.ts
41
41
  var import_path5 = __toESM(require("path"));
@@ -587,13 +587,12 @@ var Codegen = class {
587
587
  return apiURL;
588
588
  }
589
589
  _createApiUrl() {
590
- var _a, _b, _c, _d;
591
- const branch = (_a = this.configManager.config) == null ? void 0 : _a.branch;
592
- const clientId = (_b = this.configManager.config) == null ? void 0 : _b.clientId;
593
- const token = (_c = this.configManager.config) == null ? void 0 : _c.token;
590
+ const branch = this.configManager.config?.branch;
591
+ const clientId = this.configManager.config?.clientId;
592
+ const token = this.configManager.config?.token;
594
593
  const fullVersion = this.configManager.getTinaGraphQLVersion();
595
594
  const version2 = `${fullVersion.major}.${fullVersion.minor}`;
596
- const baseUrl = ((_d = this.configManager.config.tinaioConfig) == null ? void 0 : _d.contentApiUrlOverride) || `https://${TINA_HOST}`;
595
+ const baseUrl = this.configManager.config.tinaioConfig?.contentApiUrlOverride || `https://${TINA_HOST}`;
597
596
  if ((!branch || !clientId || !token) && !this.port && !this.configManager.config.contentApiUrlOverride) {
598
597
  const missing = [];
599
598
  if (!branch) missing.push("branch");
@@ -621,7 +620,6 @@ var Codegen = class {
621
620
  return this.apiURL;
622
621
  }
623
622
  async genDatabaseClient() {
624
- var _a, _b;
625
623
  const authCollection = this.tinaSchema.getCollections().find((c) => c.isAuthCollection);
626
624
  let authFields = [];
627
625
  if (authCollection) {
@@ -632,7 +630,7 @@ var Codegen = class {
632
630
  if (usersFields.length > 1) {
633
631
  throw new Error("Only one user field is allowed");
634
632
  }
635
- authFields = (_b = (_a = usersFields[0]) == null ? void 0 : _a.collectable) == null ? void 0 : _b.fields.map((f) => {
633
+ authFields = usersFields[0]?.collectable?.fields.map((f) => {
636
634
  if (f.type !== "password" && f.type !== "object") {
637
635
  if (f.uid) {
638
636
  return `id:${f.name}`;
@@ -710,9 +708,8 @@ export default databaseClient;
710
708
  `;
711
709
  }
712
710
  async genClient() {
713
- var _a, _b, _c;
714
- const token = (_a = this.configManager.config) == null ? void 0 : _a.token;
715
- const errorPolicy = (_c = (_b = this.configManager.config) == null ? void 0 : _b.client) == null ? void 0 : _c.errorPolicy;
711
+ const token = this.configManager.config?.token;
712
+ const errorPolicy = this.configManager.config?.client?.errorPolicy;
716
713
  const apiURL = this.getApiURL();
717
714
  const clientString = `import { createClient } from "tinacms/dist/client";
718
715
  import { queries } from "./types";
@@ -811,11 +808,10 @@ var ConfigManager = class {
811
808
  return this.rootPath !== this.contentRootPath;
812
809
  }
813
810
  shouldSkipSDK() {
814
- var _a;
815
811
  if (this.legacyNoSDK) {
816
812
  return this.legacyNoSDK;
817
813
  }
818
- return ((_a = this.config.client) == null ? void 0 : _a.skip) || false;
814
+ return this.config.client?.skip || false;
819
815
  }
820
816
  async processConfig() {
821
817
  this.tinaFolderPath = await this.getTinaFolderPath(this.rootPath);
@@ -991,7 +987,7 @@ var ConfigManager = class {
991
987
  };
992
988
  }
993
989
  const generatedSchema = import_fs_extra2.default.readJSONSync(this.generatedSchemaJSONPath);
994
- if (!generatedSchema || !(typeof (generatedSchema == null ? void 0 : generatedSchema.version) !== "undefined")) {
990
+ if (!generatedSchema || !(typeof generatedSchema?.version !== "undefined")) {
995
991
  throw new Error(
996
992
  `Can not find Tina GraphQL version in ${this.generatedSchemaJSONPath}`
997
993
  );
@@ -1168,7 +1164,7 @@ var createDBServer = (port) => {
1168
1164
  });
1169
1165
  });
1170
1166
  dbServer.once("error", (err) => {
1171
- if ((err == null ? void 0 : err.code) === "EADDRINUSE") {
1167
+ if (err?.code === "EADDRINUSE") {
1172
1168
  throw new Error(
1173
1169
  `Tina Dev server is already in use. Datalayer server is busy on port ${port}`
1174
1170
  );
@@ -1319,7 +1315,6 @@ var BaseCommand = class extends import_clipanion.Command {
1319
1315
  const warnings = [];
1320
1316
  await spin({
1321
1317
  waitFor: async () => {
1322
- var _a, _b;
1323
1318
  const rootPath = configManager.rootPath;
1324
1319
  let sha;
1325
1320
  try {
@@ -1344,7 +1339,7 @@ var BaseCommand = class extends import_clipanion.Command {
1344
1339
  }
1345
1340
  for (const collection of tinaSchema.getCollections()) {
1346
1341
  pathFilter[collection.path] = {
1347
- matches: ((_a = collection.match) == null ? void 0 : _a.exclude) || ((_b = collection.match) == null ? void 0 : _b.include) ? tinaSchema.getMatches({ collection }) : void 0
1342
+ matches: collection.match?.exclude || collection.match?.include ? tinaSchema.getMatches({ collection }) : void 0
1348
1343
  };
1349
1344
  }
1350
1345
  const { added, modified, deleted } = await (0, import_graphql8.getChangedFiles)({
@@ -1379,7 +1374,7 @@ var BaseCommand = class extends import_clipanion.Command {
1379
1374
  if (sha) {
1380
1375
  await database.setMetadata("lastSha", sha);
1381
1376
  }
1382
- if (res == null ? void 0 : res.warnings) {
1377
+ if (res?.warnings) {
1383
1378
  warnings.push(...res.warnings);
1384
1379
  }
1385
1380
  },
@@ -1474,14 +1469,14 @@ var devHTML = (port) => `<!DOCTYPE html>
1474
1469
  var import_vite3 = require("vite");
1475
1470
 
1476
1471
  // src/next/vite/index.ts
1477
- var import_node_path2 = __toESM(require("path"));
1472
+ var import_node_path2 = __toESM(require("node:path"));
1478
1473
  var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
1479
1474
  var import_fs_extra4 = __toESM(require("fs-extra"));
1480
1475
  var import_normalize_path3 = __toESM(require("normalize-path"));
1481
1476
  var import_vite = require("vite");
1482
1477
 
1483
1478
  // src/next/vite/tailwind.ts
1484
- var import_node_path = __toESM(require("path"));
1479
+ var import_node_path = __toESM(require("node:path"));
1485
1480
  var import_aspect_ratio = __toESM(require("@tailwindcss/aspect-ratio"));
1486
1481
  var import_container_queries = __toESM(require("@tailwindcss/container-queries"));
1487
1482
  var import_typography = __toESM(require("@tailwindcss/typography"));
@@ -1807,7 +1802,6 @@ var createConfig = async ({
1807
1802
  noWatch,
1808
1803
  rollupOptions
1809
1804
  }) => {
1810
- var _a, _b, _c, _d, _e, _f, _g, _h;
1811
1805
  const publicEnv = {};
1812
1806
  Object.keys(process.env).forEach((key) => {
1813
1807
  if (key.startsWith("TINA_PUBLIC_") || key.startsWith("NEXT_PUBLIC_") || key === "NODE_ENV" || key === "HEAD") {
@@ -1829,9 +1823,9 @@ var createConfig = async ({
1829
1823
  configManager.generatedFolderPath,
1830
1824
  "static-media.json"
1831
1825
  );
1832
- if ((_b = (_a = configManager.config.media) == null ? void 0 : _a.tina) == null ? void 0 : _b.static) {
1826
+ if (configManager.config.media?.tina?.static) {
1833
1827
  const staticMedia = await listFilesRecursively({
1834
- directoryPath: ((_c = configManager.config.media.tina) == null ? void 0 : _c.mediaRoot) || "",
1828
+ directoryPath: configManager.config.media.tina?.mediaRoot || "",
1835
1829
  config: configManager.config.media.tina,
1836
1830
  roothPath: configManager.rootPath
1837
1831
  });
@@ -1892,7 +1886,7 @@ var createConfig = async ({
1892
1886
  // Used by picomatch https://github.com/micromatch/picomatch/blob/master/lib/utils.js#L4
1893
1887
  "process.platform": `"${process.platform}"`,
1894
1888
  __API_URL__: `"${apiURL}"`,
1895
- __BASE_PATH__: `"${((_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.basePath) || ""}"`,
1889
+ __BASE_PATH__: `"${configManager.config?.build?.basePath || ""}"`,
1896
1890
  __TINA_GRAPHQL_VERSION__: version2
1897
1891
  },
1898
1892
  logLevel: "error",
@@ -1904,7 +1898,7 @@ var createConfig = async ({
1904
1898
  include: ["react/jsx-runtime", "react/jsx-dev-runtime"]
1905
1899
  },
1906
1900
  server: {
1907
- host: (_h = (_g = (_f = configManager.config) == null ? void 0 : _f.build) == null ? void 0 : _g.host) != null ? _h : false,
1901
+ host: configManager.config?.build?.host ?? false,
1908
1902
  watch: noWatch ? {
1909
1903
  ignored: ["**/*"]
1910
1904
  } : {
@@ -1918,7 +1912,7 @@ var createConfig = async ({
1918
1912
  }
1919
1913
  },
1920
1914
  build: {
1921
- sourcemap: true,
1915
+ sourcemap: false,
1922
1916
  outDir: configManager.outputFolderPath,
1923
1917
  emptyOutDir: true,
1924
1918
  rollupOptions
@@ -1983,8 +1977,7 @@ var createMediaRouter = (config2) => {
1983
1977
  const handlePost = async function(req, res) {
1984
1978
  const bb = (0, import_busboy.default)({ headers: req.headers });
1985
1979
  bb.on("file", async (_name, file, _info) => {
1986
- var _a;
1987
- const fullPath = decodeURI((_a = req.url) == null ? void 0 : _a.slice("/media/upload/".length));
1980
+ const fullPath = decodeURI(req.url?.slice("/media/upload/".length));
1988
1981
  const saveTo = import_path3.default.join(mediaFolder, ...fullPath.split("/"));
1989
1982
  await import_fs_extra5.default.ensureDir(import_path3.default.dirname(saveTo));
1990
1983
  file.pipe(import_fs_extra5.default.createWriteStream(saveTo));
@@ -2086,7 +2079,7 @@ var MediaModel = class {
2086
2079
  return {
2087
2080
  files: [],
2088
2081
  directories: [],
2089
- error: error == null ? void 0 : error.toString()
2082
+ error: error?.toString()
2090
2083
  };
2091
2084
  }
2092
2085
  }
@@ -2103,7 +2096,7 @@ var MediaModel = class {
2103
2096
  return { ok: true };
2104
2097
  } catch (error) {
2105
2098
  console.error(error);
2106
- return { ok: false, message: error == null ? void 0 : error.toString() };
2099
+ return { ok: false, message: error?.toString() };
2107
2100
  }
2108
2101
  }
2109
2102
  };
@@ -2181,13 +2174,12 @@ var devServerEndPointsPlugin = ({
2181
2174
  server.middlewares.use((0, import_cors.default)());
2182
2175
  server.middlewares.use(import_body_parser.default.json({ limit: "5mb" }));
2183
2176
  server.middlewares.use(async (req, res, next) => {
2184
- var _a;
2185
- const mediaPaths = (_a = configManager.config.media) == null ? void 0 : _a.tina;
2177
+ const mediaPaths = configManager.config.media?.tina;
2186
2178
  const mediaRouter = createMediaRouter({
2187
2179
  rootPath: configManager.rootPath,
2188
2180
  apiURL,
2189
- publicFolder: parseMediaFolder((mediaPaths == null ? void 0 : mediaPaths.publicFolder) || ""),
2190
- mediaRoot: parseMediaFolder((mediaPaths == null ? void 0 : mediaPaths.mediaRoot) || "")
2181
+ publicFolder: parseMediaFolder(mediaPaths?.publicFolder || ""),
2182
+ mediaRoot: parseMediaFolder(mediaPaths?.mediaRoot || "")
2191
2183
  });
2192
2184
  const searchIndexRouter = createSearchIndexRouter({
2193
2185
  config: { apiURL, searchPath: "searchIndex" },
@@ -2260,7 +2252,7 @@ function viteTransformExtension({
2260
2252
  name: "vite-plugin-svgr",
2261
2253
  async transform(code, id) {
2262
2254
  if (filter(id)) {
2263
- const { transform: transform2 } = await Promise.resolve().then(() => __toESM(require("@svgr/core")));
2255
+ const { transform: transform2 } = await import("@svgr/core");
2264
2256
  const svgCode = await import_fs.default.promises.readFile(
2265
2257
  id.replace(/\?.*$/, ""),
2266
2258
  "utf8"
@@ -2345,6 +2337,20 @@ var DevCommand = class extends BaseCommand {
2345
2337
  });
2346
2338
  this.indexingLock = new import_async_lock.default();
2347
2339
  }
2340
+ static {
2341
+ this.paths = [["dev"], ["server:start"]];
2342
+ }
2343
+ static {
2344
+ // Prevent indexes and reads occurring at once
2345
+ this.usage = import_clipanion2.Command.Usage({
2346
+ category: `Commands`,
2347
+ description: `Builds Tina and starts the dev server`,
2348
+ examples: [
2349
+ [`A basic example`, `$0 dev`],
2350
+ [`A second example`, `$0 dev --rootPath`]
2351
+ ]
2352
+ });
2353
+ }
2348
2354
  async catch(error) {
2349
2355
  logger.error("Error occured during tinacms dev");
2350
2356
  console.error(error);
@@ -2359,7 +2365,6 @@ var DevCommand = class extends BaseCommand {
2359
2365
  }
2360
2366
  }
2361
2367
  async execute() {
2362
- var _a, _b, _c, _d, _e, _f;
2363
2368
  const configManager = new ConfigManager({
2364
2369
  rootPath: this.rootPath,
2365
2370
  legacyNoSDK: this.noSDK
@@ -2467,19 +2472,19 @@ ${dangerText(e.message)}
2467
2472
  "index.html\nassets/"
2468
2473
  );
2469
2474
  const searchIndexClient = new import_search.LocalSearchIndexClient({
2470
- stopwordLanguages: (_b = (_a = configManager.config.search) == null ? void 0 : _a.tina) == null ? void 0 : _b.stopwordLanguages,
2471
- tokenSplitRegex: (_d = (_c = configManager.config.search) == null ? void 0 : _c.tina) == null ? void 0 : _d.tokenSplitRegex
2475
+ stopwordLanguages: configManager.config.search?.tina?.stopwordLanguages,
2476
+ tokenSplitRegex: configManager.config.search?.tina?.tokenSplitRegex
2472
2477
  });
2473
2478
  await searchIndexClient.onStartIndexing();
2474
2479
  const searchIndexer = new import_search.SearchIndexer({
2475
- batchSize: ((_e = configManager.config.search) == null ? void 0 : _e.indexBatchSize) || 100,
2480
+ batchSize: configManager.config.search?.indexBatchSize || 100,
2476
2481
  bridge: new import_graphql10.FilesystemBridge(
2477
2482
  configManager.rootPath,
2478
2483
  configManager.contentRootPath
2479
2484
  ),
2480
2485
  schema: tinaSchema,
2481
2486
  client: searchIndexClient,
2482
- textIndexLength: ((_f = configManager.config.search) == null ? void 0 : _f.maxSearchIndexFieldLength) || 100
2487
+ textIndexLength: configManager.config.search?.maxSearchIndexFieldLength || 100
2483
2488
  });
2484
2489
  if (configManager.config.search) {
2485
2490
  await spin({
@@ -2638,16 +2643,6 @@ ${dangerText(e.message)}
2638
2643
  import_chokidar.default.watch(configManager.userQueriesAndFragmentsGlob).on("add", executeCallback).on("change", executeCallback).on("unlink", executeCallback);
2639
2644
  }
2640
2645
  };
2641
- DevCommand.paths = [["dev"], ["server:start"]];
2642
- // Prevent indexes and reads occurring at once
2643
- DevCommand.usage = import_clipanion2.Command.Usage({
2644
- category: `Commands`,
2645
- description: `Builds Tina and starts the dev server`,
2646
- examples: [
2647
- [`A basic example`, `$0 dev`],
2648
- [`A second example`, `$0 dev --rootPath`]
2649
- ]
2650
- });
2651
2646
 
2652
2647
  // src/next/commands/build-command/index.ts
2653
2648
  var import_crypto = __toESM(require("crypto"));
@@ -2845,12 +2840,20 @@ var BuildCommand = class extends BaseCommand {
2845
2840
  description: "Disables the client build cache"
2846
2841
  });
2847
2842
  }
2843
+ static {
2844
+ this.paths = [["build"]];
2845
+ }
2846
+ static {
2847
+ this.usage = import_clipanion3.Command.Usage({
2848
+ category: `Commands`,
2849
+ description: `Build the CMS and autogenerated modules for usage with TinaCloud`
2850
+ });
2851
+ }
2848
2852
  async catch(error) {
2849
2853
  console.error(error);
2850
2854
  process.exit(1);
2851
2855
  }
2852
2856
  async execute() {
2853
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
2854
2857
  logger.info("Starting Tina build");
2855
2858
  this.logDeprecationWarnings();
2856
2859
  const configManager = new ConfigManager({
@@ -2939,45 +2942,63 @@ ${dangerText(e.message)}
2939
2942
  }
2940
2943
  const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
2941
2944
  if (!skipCloudChecks) {
2942
- const { hasUpstream, timestamp } = await this.checkClientInfo(
2943
- configManager,
2944
- codegen2.productionUrl,
2945
- this.previewBaseBranch
2946
- );
2947
- if (!hasUpstream && this.upstreamBranch) {
2948
- logger.warn(
2949
- `${dangerText(
2950
- `WARN: Upstream branch '${this.upstreamBranch}' specified but no upstream project was found.`
2951
- )}`
2945
+ try {
2946
+ const clientInfo = await this.checkClientInfo(
2947
+ configManager,
2948
+ codegen2.productionUrl,
2949
+ this.previewBaseBranch
2952
2950
  );
2951
+ if (clientInfo.detectedBotBranch) {
2952
+ logger.warn(
2953
+ `${warnText(
2954
+ `WARN: Detected bot branch. Using schema/content from default branch '${clientInfo.defaultBranch}' instead of '${configManager.config.branch}'.`
2955
+ )}`
2956
+ );
2957
+ }
2958
+ if (!clientInfo.hasUpstream && this.upstreamBranch) {
2959
+ logger.warn(
2960
+ `${dangerText(
2961
+ `WARN: Upstream branch '${this.upstreamBranch}' specified but no upstream project was found.`
2962
+ )}`
2963
+ );
2964
+ }
2965
+ if (clientInfo.hasUpstream || this.previewBaseBranch && this.previewName) {
2966
+ await this.syncProject(configManager, codegen2.productionUrl, {
2967
+ upstreamBranch: this.upstreamBranch,
2968
+ previewBaseBranch: this.previewBaseBranch,
2969
+ previewName: this.previewName
2970
+ });
2971
+ }
2972
+ await waitForDB(
2973
+ configManager.config,
2974
+ codegen2.productionUrl,
2975
+ this.previewName,
2976
+ false
2977
+ );
2978
+ await this.checkGraphqlSchema(
2979
+ configManager,
2980
+ database,
2981
+ codegen2.productionUrl,
2982
+ clientInfo.timestamp
2983
+ );
2984
+ await this.checkTinaSchema(
2985
+ configManager,
2986
+ database,
2987
+ codegen2.productionUrl,
2988
+ this.previewName,
2989
+ this.verbose,
2990
+ clientInfo.timestamp
2991
+ );
2992
+ } catch (e) {
2993
+ logger.error(`
2994
+
2995
+ ${dangerText(e.message)}
2996
+ `);
2997
+ if (this.verbose) {
2998
+ console.error(e);
2999
+ }
3000
+ process.exit(1);
2953
3001
  }
2954
- if (hasUpstream || this.previewBaseBranch && this.previewName) {
2955
- await this.syncProject(configManager, codegen2.productionUrl, {
2956
- upstreamBranch: this.upstreamBranch,
2957
- previewBaseBranch: this.previewBaseBranch,
2958
- previewName: this.previewName
2959
- });
2960
- }
2961
- await waitForDB(
2962
- configManager.config,
2963
- codegen2.productionUrl,
2964
- this.previewName,
2965
- false
2966
- );
2967
- await this.checkGraphqlSchema(
2968
- configManager,
2969
- database,
2970
- codegen2.productionUrl,
2971
- timestamp
2972
- );
2973
- await this.checkTinaSchema(
2974
- configManager,
2975
- database,
2976
- codegen2.productionUrl,
2977
- this.previewName,
2978
- this.verbose,
2979
- timestamp
2980
- );
2981
3002
  }
2982
3003
  await buildProductionSpa(configManager, database, codegen2.productionUrl);
2983
3004
  await import_fs_extra7.default.outputFile(
@@ -2986,9 +3007,9 @@ ${dangerText(e.message)}
2986
3007
  );
2987
3008
  if (configManager.config.search && !this.skipSearchIndex && !this.localOption) {
2988
3009
  let client;
2989
- const hasTinaSearch = Boolean((_b = (_a = configManager.config) == null ? void 0 : _a.search) == null ? void 0 : _b.tina);
3010
+ const hasTinaSearch = Boolean(configManager.config?.search?.tina);
2990
3011
  if (hasTinaSearch) {
2991
- if (!((_c = configManager.config) == null ? void 0 : _c.branch)) {
3012
+ if (!configManager.config?.branch) {
2992
3013
  logger.error(
2993
3014
  `${dangerText(
2994
3015
  `ERROR: Branch not configured in tina search configuration.`
@@ -2998,11 +3019,11 @@ ${dangerText(e.message)}
2998
3019
  "Branch not configured in tina search configuration."
2999
3020
  );
3000
3021
  }
3001
- if (!((_d = configManager.config) == null ? void 0 : _d.clientId)) {
3022
+ if (!configManager.config?.clientId) {
3002
3023
  logger.error(`${dangerText(`ERROR: clientId not configured.`)}`);
3003
3024
  throw new Error("clientId not configured.");
3004
3025
  }
3005
- if (!((_g = (_f = (_e = configManager.config) == null ? void 0 : _e.search) == null ? void 0 : _f.tina) == null ? void 0 : _g.indexerToken)) {
3026
+ if (!configManager.config?.search?.tina?.indexerToken) {
3006
3027
  logger.error(
3007
3028
  `${dangerText(
3008
3029
  `ERROR: indexerToken not configured in tina search configuration.`
@@ -3013,16 +3034,16 @@ ${dangerText(e.message)}
3013
3034
  );
3014
3035
  }
3015
3036
  client = new import_search2.TinaCMSSearchIndexClient({
3016
- apiUrl: `${((_h = configManager.config.tinaioConfig) == null ? void 0 : _h.contentApiUrlOverride) || "https://content.tinajs.io"}/searchIndex/${(_i = configManager.config) == null ? void 0 : _i.clientId}`,
3017
- branch: (_j = configManager.config) == null ? void 0 : _j.branch,
3018
- indexerToken: (_m = (_l = (_k = configManager.config) == null ? void 0 : _k.search) == null ? void 0 : _l.tina) == null ? void 0 : _m.indexerToken,
3019
- stopwordLanguages: (_p = (_o = (_n = configManager.config) == null ? void 0 : _n.search) == null ? void 0 : _o.tina) == null ? void 0 : _p.stopwordLanguages
3037
+ apiUrl: `${configManager.config.tinaioConfig?.contentApiUrlOverride || "https://content.tinajs.io"}/searchIndex/${configManager.config?.clientId}`,
3038
+ branch: configManager.config?.branch,
3039
+ indexerToken: configManager.config?.search?.tina?.indexerToken,
3040
+ stopwordLanguages: configManager.config?.search?.tina?.stopwordLanguages
3020
3041
  });
3021
3042
  } else {
3022
- client = (_r = (_q = configManager.config) == null ? void 0 : _q.search) == null ? void 0 : _r.searchClient;
3043
+ client = configManager.config?.search?.searchClient;
3023
3044
  }
3024
3045
  const searchIndexer = new import_search2.SearchIndexer({
3025
- batchSize: ((_s = configManager.config.search) == null ? void 0 : _s.indexBatchSize) || 100,
3046
+ batchSize: configManager.config.search?.indexBatchSize || 100,
3026
3047
  bridge: new import_graphql11.FilesystemBridge(
3027
3048
  configManager.rootPath,
3028
3049
  configManager.contentRootPath
@@ -3090,86 +3111,88 @@ ${dangerText(e.message)}
3090
3111
  }
3091
3112
  }
3092
3113
  async checkClientInfo(configManager, apiURL, previewBaseBranch) {
3114
+ const MAX_RETRIES = 5;
3093
3115
  const { config: config2 } = configManager;
3094
3116
  const token = config2.token;
3095
3117
  const { clientId, branch, host } = (0, import_schema_tools2.parseURL)(apiURL);
3096
- const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
3097
3118
  const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
3098
- let branchKnown = false;
3099
- let hasUpstream = false;
3100
- let timestamp;
3101
- try {
3102
- const res = await request({
3103
- token,
3104
- url
3105
- });
3106
- timestamp = res.timestamp || 0;
3107
- bar2.tick({
3108
- prog: "\u2705"
3109
- });
3110
- if (!(res.status === "unknown")) {
3111
- branchKnown = true;
3112
- }
3113
- if (res.hasUpstream) {
3114
- hasUpstream = true;
3119
+ const getBranchInfo = async () => {
3120
+ const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
3121
+ const branchInfo2 = {
3122
+ status: "unknown",
3123
+ branchKnown: false,
3124
+ hasUpstream: false,
3125
+ timestamp: 0,
3126
+ detectedBotBranch: false,
3127
+ defaultBranch: void 0
3128
+ };
3129
+ try {
3130
+ const res = await request({
3131
+ token,
3132
+ url
3133
+ });
3134
+ branchInfo2.status = res.status;
3135
+ branchInfo2.branchKnown = res.status !== "unknown";
3136
+ branchInfo2.timestamp = res.timestamp || 0;
3137
+ branchInfo2.hasUpstream = res.hasUpstream;
3138
+ branchInfo2.detectedBotBranch = res.json.detectedBotBranch;
3139
+ branchInfo2.defaultBranch = res.json.defaultBranch;
3140
+ } catch (e) {
3141
+ summary({
3142
+ heading: "Error when checking client information",
3143
+ items: [
3144
+ {
3145
+ emoji: "\u274C",
3146
+ heading: "You provided",
3147
+ subItems: [
3148
+ {
3149
+ key: "clientId",
3150
+ value: config2.clientId
3151
+ },
3152
+ {
3153
+ key: "branch",
3154
+ value: config2.branch
3155
+ },
3156
+ {
3157
+ key: "token",
3158
+ value: config2.token
3159
+ }
3160
+ ]
3161
+ }
3162
+ ]
3163
+ });
3164
+ throw e;
3115
3165
  }
3116
- } catch (e) {
3117
- summary({
3118
- heading: "Error when checking client information",
3119
- items: [
3120
- {
3121
- emoji: "\u274C",
3122
- heading: "You provided",
3123
- subItems: [
3124
- {
3125
- key: "clientId",
3126
- value: config2.clientId
3127
- },
3128
- {
3129
- key: "branch",
3130
- value: config2.branch
3131
- },
3132
- {
3133
- key: "token",
3134
- value: config2.token
3135
- }
3136
- ]
3137
- }
3138
- ]
3139
- });
3140
- throw e;
3141
- }
3142
- const branchBar = new import_progress2.default("Checking branch is on TinaCloud. :prog", 1);
3143
- if (branchKnown) {
3166
+ return branchInfo2;
3167
+ };
3168
+ const branchInfo = await getBranchInfo();
3169
+ bar2.tick({
3170
+ prog: "\u2705"
3171
+ });
3172
+ const branchBar = new import_progress2.default(
3173
+ `Checking branch '${config2.branch}' is on TinaCloud. :prog`,
3174
+ 1
3175
+ );
3176
+ if (branchInfo.branchKnown) {
3144
3177
  branchBar.tick({
3145
3178
  prog: "\u2705"
3146
3179
  });
3147
- return {
3148
- hasUpstream,
3149
- timestamp
3150
- };
3180
+ return branchInfo;
3151
3181
  }
3152
- for (let i = 0; i <= 5; i++) {
3153
- await sleepAndCallFunc({
3154
- fn: async () => {
3155
- const res = await request({
3156
- token,
3157
- url
3158
- });
3159
- if (this.verbose) {
3160
- logger.info(
3161
- `Branch status: ${res.status}. Attempt: ${i + 1}. Trying again in 5 seconds.`
3162
- );
3163
- }
3164
- if (!(res.status === "unknown")) {
3165
- branchBar.tick({
3166
- prog: "\u2705"
3167
- });
3168
- return;
3169
- }
3170
- },
3171
- ms: 5e3
3172
- });
3182
+ for (let i = 1; i <= MAX_RETRIES; i++) {
3183
+ await timeout(5e3);
3184
+ const branchInfo2 = await getBranchInfo();
3185
+ if (this.verbose) {
3186
+ logger.info(
3187
+ `Branch status: ${branchInfo2.status}. Attempt: ${i}. Trying again in 5 seconds.`
3188
+ );
3189
+ }
3190
+ if (branchInfo2.branchKnown) {
3191
+ branchBar.tick({
3192
+ prog: "\u2705"
3193
+ });
3194
+ return branchInfo2;
3195
+ }
3173
3196
  }
3174
3197
  branchBar.tick({
3175
3198
  prog: "\u274C"
@@ -3177,7 +3200,7 @@ ${dangerText(e.message)}
3177
3200
  logger.error(
3178
3201
  `${dangerText(
3179
3202
  `ERROR: Branch '${branch}' is not on TinaCloud.`
3180
- )} 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(
3203
+ )} 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(
3181
3204
  `https://app.tina.io/projects/${clientId}/configuration`
3182
3205
  )}`
3183
3206
  );
@@ -3252,7 +3275,7 @@ ${dangerText(e.message)}
3252
3275
  prog: "\u274C"
3253
3276
  });
3254
3277
  let errorMessage = `The remote GraphQL schema does not exist. Check indexing for this branch.`;
3255
- if (config2 == null ? void 0 : config2.branch) {
3278
+ if (config2?.branch) {
3256
3279
  errorMessage += `
3257
3280
 
3258
3281
  Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
@@ -3284,7 +3307,7 @@ Check out '${faqLink}' for possible solutions.`}`;
3284
3307
  Additional info:
3285
3308
 
3286
3309
  `;
3287
- if (config2 == null ? void 0 : config2.branch) {
3310
+ if (config2?.branch) {
3288
3311
  errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
3289
3312
  `;
3290
3313
  }
@@ -3333,7 +3356,7 @@ Additional info:
3333
3356
  prog: "\u274C"
3334
3357
  });
3335
3358
  let errorMessage = `The remote Tina schema does not exist. Check indexing for this branch.`;
3336
- if (config2 == null ? void 0 : config2.branch) {
3359
+ if (config2?.branch) {
3337
3360
  errorMessage += `
3338
3361
 
3339
3362
  Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
@@ -3364,7 +3387,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
3364
3387
  Additional info:
3365
3388
 
3366
3389
  `;
3367
- if (config2 == null ? void 0 : config2.branch) {
3390
+ if (config2?.branch) {
3368
3391
  errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
3369
3392
  `;
3370
3393
  }
@@ -3376,18 +3399,13 @@ Additional info:
3376
3399
  }
3377
3400
  }
3378
3401
  };
3379
- BuildCommand.paths = [["build"]];
3380
- BuildCommand.usage = import_clipanion3.Command.Usage({
3381
- category: `Commands`,
3382
- description: `Build the CMS and autogenerated modules for usage with TinaCloud`
3383
- });
3384
3402
  async function request(args) {
3385
3403
  const headers = new Headers();
3386
3404
  if (args.token) {
3387
3405
  headers.append("X-API-KEY", args.token);
3388
3406
  }
3389
3407
  headers.append("Content-Type", "application/json");
3390
- const url = args == null ? void 0 : args.url;
3408
+ const url = args?.url;
3391
3409
  const res = await fetch(url, {
3392
3410
  method: args.method || "GET",
3393
3411
  headers,
@@ -3417,9 +3435,10 @@ Message from server: ${json.message}`;
3417
3435
  );
3418
3436
  }
3419
3437
  return {
3420
- status: json == null ? void 0 : json.status,
3421
- timestamp: json == null ? void 0 : json.timestamp,
3422
- hasUpstream: (json == null ? void 0 : json.hasUpstream) || false
3438
+ status: json?.status,
3439
+ timestamp: json?.timestamp,
3440
+ hasUpstream: json?.hasUpstream || false,
3441
+ json
3423
3442
  };
3424
3443
  }
3425
3444
  var fetchRemoteGraphqlSchema = async ({
@@ -3442,7 +3461,7 @@ var fetchRemoteGraphqlSchema = async ({
3442
3461
  });
3443
3462
  const data = await res.json();
3444
3463
  return {
3445
- remoteSchema: data == null ? void 0 : data.data,
3464
+ remoteSchema: data?.data,
3446
3465
  remoteRuntimeVersion: res.headers.get("tinacms-grapqhl-version"),
3447
3466
  remoteProjectVersion: res.headers.get("tinacms-graphql-project-version")
3448
3467
  };
@@ -3652,6 +3671,15 @@ var AuditCommand = class extends import_clipanion4.Command {
3652
3671
  description: "Specify a port to run the datalayer server on. (default 9000)"
3653
3672
  });
3654
3673
  }
3674
+ static {
3675
+ this.paths = [["audit"]];
3676
+ }
3677
+ static {
3678
+ this.usage = import_clipanion4.Command.Usage({
3679
+ category: `Commands`,
3680
+ description: `Audit config and content files`
3681
+ });
3682
+ }
3655
3683
  async catch(error) {
3656
3684
  logger.error("Error occured during tinacms audit");
3657
3685
  if (this.verbose) {
@@ -3705,11 +3733,6 @@ var AuditCommand = class extends import_clipanion4.Command {
3705
3733
  process.exit();
3706
3734
  }
3707
3735
  };
3708
- AuditCommand.paths = [["audit"]];
3709
- AuditCommand.usage = import_clipanion4.Command.Usage({
3710
- category: `Commands`,
3711
- description: `Audit config and content files`
3712
- });
3713
3736
 
3714
3737
  // src/next/commands/init-command/index.ts
3715
3738
  var import_clipanion6 = require("clipanion");
@@ -3728,13 +3751,13 @@ var makeGeneratedFile = async (name2, generatedFileType, parentPath, opts) => {
3728
3751
  const result = {
3729
3752
  fullPathTS: import_path7.default.join(
3730
3753
  parentPath,
3731
- `${name2}.${(opts == null ? void 0 : opts.typescriptSuffix) || (opts == null ? void 0 : opts.extensionOverride) || "ts"}`
3754
+ `${name2}.${opts?.typescriptSuffix || opts?.extensionOverride || "ts"}`
3732
3755
  ),
3733
3756
  fullPathJS: import_path7.default.join(
3734
3757
  parentPath,
3735
- `${name2}.${(opts == null ? void 0 : opts.extensionOverride) || "js"}`
3758
+ `${name2}.${opts?.extensionOverride || "js"}`
3736
3759
  ),
3737
- fullPathOverride: (opts == null ? void 0 : opts.extensionOverride) ? import_path7.default.join(parentPath, `${name2}.${opts == null ? void 0 : opts.extensionOverride}`) : "",
3760
+ fullPathOverride: opts?.extensionOverride ? import_path7.default.join(parentPath, `${name2}.${opts?.extensionOverride}`) : "",
3738
3761
  generatedFileType,
3739
3762
  name: name2,
3740
3763
  parentPath,
@@ -3762,7 +3785,6 @@ var detectEnvironment = async ({
3762
3785
  rootPath,
3763
3786
  debug = false
3764
3787
  }) => {
3765
- var _a;
3766
3788
  const hasForestryConfig = await import_fs_extra8.default.pathExists(
3767
3789
  import_path7.default.join(pathToForestryConfig, ".forestry", "settings.yml")
3768
3790
  );
@@ -3819,10 +3841,10 @@ var detectEnvironment = async ({
3819
3841
  try {
3820
3842
  const packageJSON = await import_fs_extra8.default.readJSON("package.json");
3821
3843
  const deps = [];
3822
- if (packageJSON == null ? void 0 : packageJSON.dependencies) {
3844
+ if (packageJSON?.dependencies) {
3823
3845
  deps.push(...Object.keys(packageJSON.dependencies));
3824
3846
  }
3825
- if (packageJSON == null ? void 0 : packageJSON.devDependencies) {
3847
+ if (packageJSON?.devDependencies) {
3826
3848
  deps.push(...Object.keys(packageJSON.devDependencies));
3827
3849
  }
3828
3850
  if (deps.includes("@tinacms/cli") && deps.includes("tinacms")) {
@@ -3843,7 +3865,7 @@ var detectEnvironment = async ({
3843
3865
  const hugoConfigPath = import_path7.default.join(rootPath, "config.toml");
3844
3866
  if (await import_fs_extra8.default.pathExists(hugoConfigPath)) {
3845
3867
  const hugoConfig = await import_fs_extra8.default.readFile(hugoConfigPath, "utf8");
3846
- const metaDataFormat = (_a = hugoConfig.match(/metaDataFormat = "(.*)"/)) == null ? void 0 : _a[1];
3868
+ const metaDataFormat = hugoConfig.toString().match(/metaDataFormat = "(.*)"/)?.[1];
3847
3869
  if (metaDataFormat && (metaDataFormat === "yaml" || metaDataFormat === "toml" || metaDataFormat === "json")) {
3848
3870
  frontMatterFormat = metaDataFormat;
3849
3871
  }
@@ -4462,6 +4484,7 @@ var import_path9 = __toESM(require("path"));
4462
4484
  var import_js_yaml2 = __toESM(require("js-yaml"));
4463
4485
  var import_minimatch = __toESM(require("minimatch"));
4464
4486
  var import_graphql16 = require("@tinacms/graphql");
4487
+ var import_schema_tools3 = require("@tinacms/schema-tools");
4465
4488
 
4466
4489
  // src/cmds/forestry-migrate/util/index.ts
4467
4490
  var import_fs_extra9 = __toESM(require("fs-extra"));
@@ -4494,8 +4517,7 @@ var ErrorSingleton = class _ErrorSingleton {
4494
4517
  this.collectionNameErrors.push(error);
4495
4518
  }
4496
4519
  printCollectionNameErrors() {
4497
- var _a;
4498
- if ((_a = this.collectionNameErrors) == null ? void 0 : _a.length) {
4520
+ if (this.collectionNameErrors?.length) {
4499
4521
  logger.error(
4500
4522
  dangerText("ERROR: TinaCMS only supports alphanumeric template names")
4501
4523
  );
@@ -4677,8 +4699,7 @@ var transformForestryFieldsToTinaFields = ({
4677
4699
  skipBlocks = false
4678
4700
  }) => {
4679
4701
  const tinaFields = [];
4680
- fields == null ? void 0 : fields.forEach((forestryField2) => {
4681
- var _a, _b, _c, _d;
4702
+ fields?.forEach((forestryField2) => {
4682
4703
  if (forestryField2.name === "menu") {
4683
4704
  logger.info(
4684
4705
  warnText(
@@ -4754,12 +4775,12 @@ var transformForestryFieldsToTinaFields = ({
4754
4775
  };
4755
4776
  break;
4756
4777
  case "select":
4757
- if ((_a = forestryField2.config) == null ? void 0 : _a.options) {
4778
+ if (forestryField2.config?.options) {
4758
4779
  field = {
4759
4780
  type: "string",
4760
4781
  ...getTinaFieldsFromName(forestryField2.name),
4761
4782
  label: forestryField2.label,
4762
- options: ((_b = forestryField2.config) == null ? void 0 : _b.options) || []
4783
+ options: forestryField2.config?.options || []
4763
4784
  };
4764
4785
  } else {
4765
4786
  logger.info(
@@ -4777,7 +4798,7 @@ var transformForestryFieldsToTinaFields = ({
4777
4798
  label: forestryField2.label,
4778
4799
  list: true
4779
4800
  };
4780
- if ((_c = forestryField2.config) == null ? void 0 : _c.options) {
4801
+ if (forestryField2.config?.options) {
4781
4802
  field.options = forestryField2.config.options;
4782
4803
  }
4783
4804
  break;
@@ -4825,7 +4846,7 @@ var transformForestryFieldsToTinaFields = ({
4825
4846
  break;
4826
4847
  }
4827
4848
  const templates2 = [];
4828
- forestryField2 == null ? void 0 : forestryField2.template_types.forEach((tem) => {
4849
+ forestryField2?.template_types.forEach((tem) => {
4829
4850
  const { template: template2 } = getFieldsFromTemplates({
4830
4851
  tem,
4831
4852
  skipBlocks: true,
@@ -4883,7 +4904,7 @@ var transformForestryFieldsToTinaFields = ({
4883
4904
  );
4884
4905
  }
4885
4906
  if (field) {
4886
- if ((_d = forestryField2.config) == null ? void 0 : _d.required) {
4907
+ if (forestryField2.config?.required) {
4887
4908
  field = { ...field, required: true };
4888
4909
  }
4889
4910
  tinaFields.push(field);
@@ -4945,8 +4966,7 @@ var stringifyLabelWithField = (label) => {
4945
4966
  return `${labelString}Fields`;
4946
4967
  };
4947
4968
  var transformForestryMatchToTinaMatch = (match) => {
4948
- var _a, _b;
4949
- const newMatch = (_b = (_a = match.replace(" ", "").replace(/\.?(mdx|md|json|yaml|yml|toml)/g, "")) == null ? void 0 : _a.replace(/\..*$/g, "")) == null ? void 0 : _b.replace("{}", "");
4969
+ const newMatch = match.replace(" ", "").replace(/\.?(mdx|md|json|yaml|yml|toml)/g, "")?.replace(/\..*$/g, "")?.replace("{}", "");
4950
4970
  if (match !== newMatch) {
4951
4971
  logger.info(
4952
4972
  `Info: Match ${match} was transformed to ${newMatch}. See ${linkText(
@@ -4958,7 +4978,7 @@ var transformForestryMatchToTinaMatch = (match) => {
4958
4978
  };
4959
4979
  function checkExt(ext) {
4960
4980
  const extReal = ext.replace(".", "");
4961
- if (["mdx", "md", "json", "yaml", "yml", "toml"].includes(extReal)) {
4981
+ if (import_schema_tools3.CONTENT_FORMATS.includes(extReal)) {
4962
4982
  return extReal;
4963
4983
  } else {
4964
4984
  return false;
@@ -5011,18 +5031,18 @@ var generateCollectionFromForestrySection = (args) => {
5011
5031
  }
5012
5032
  if (section.match) {
5013
5033
  baseCollection.match = {
5014
- ...(baseCollection == null ? void 0 : baseCollection.match) || {},
5034
+ ...baseCollection?.match || {},
5015
5035
  include: transformForestryMatchToTinaMatch(section.match)
5016
5036
  };
5017
5037
  }
5018
5038
  if (section.exclude) {
5019
5039
  baseCollection.match = {
5020
- ...(baseCollection == null ? void 0 : baseCollection.match) || {},
5040
+ ...baseCollection?.match || {},
5021
5041
  exclude: transformForestryMatchToTinaMatch(section.exclude)
5022
5042
  };
5023
5043
  }
5024
5044
  if (section.type === "directory") {
5025
- if (!(section == null ? void 0 : section.path) || section.path === "/" || section.path === "./" || section.path === ".") {
5045
+ if (!section?.path || section.path === "/" || section.path === "./" || section.path === ".") {
5026
5046
  logger.log(
5027
5047
  warnText(
5028
5048
  `Warning: Section ${section.label} is using a Root Path. Currently, Tina Does not support Root paths see ${linkText(
@@ -5032,11 +5052,11 @@ var generateCollectionFromForestrySection = (args) => {
5032
5052
  );
5033
5053
  return;
5034
5054
  }
5035
- const forestryTemplates = (section == null ? void 0 : section.templates) || [];
5055
+ const forestryTemplates = section?.templates || [];
5036
5056
  if (forestryTemplates.length === 0 && section.create === "all") {
5037
5057
  for (const templateKey of templateMap.keys()) {
5038
5058
  const { templateObj } = templateMap.get(templateKey);
5039
- const pages = templateObj == null ? void 0 : templateObj.pages;
5059
+ const pages = templateObj?.pages;
5040
5060
  if (pages) {
5041
5061
  let glob = section.match;
5042
5062
  const skipPath = section.path === "" || section.path === "/" || !section.path;
@@ -5053,7 +5073,7 @@ var generateCollectionFromForestrySection = (args) => {
5053
5073
  }
5054
5074
  const hasBody = ["md", "mdx", "markdown"].includes(format3);
5055
5075
  let c;
5056
- if (((forestryTemplates == null ? void 0 : forestryTemplates.length) || 0) > 1) {
5076
+ if ((forestryTemplates?.length || 0) > 1) {
5057
5077
  c = {
5058
5078
  ...baseCollection,
5059
5079
  // @ts-expect-error
@@ -5075,7 +5095,7 @@ var generateCollectionFromForestrySection = (args) => {
5075
5095
  })
5076
5096
  };
5077
5097
  }
5078
- if ((forestryTemplates == null ? void 0 : forestryTemplates.length) === 1) {
5098
+ if (forestryTemplates?.length === 1) {
5079
5099
  const tem = forestryTemplates[0];
5080
5100
  const template = templateMap.get(tem);
5081
5101
  const fieldsString = stringifyLabelWithField(template.templateObj.label);
@@ -5090,7 +5110,7 @@ var generateCollectionFromForestrySection = (args) => {
5090
5110
  })
5091
5111
  };
5092
5112
  }
5093
- if ((forestryTemplates == null ? void 0 : forestryTemplates.length) === 0) {
5113
+ if (forestryTemplates?.length === 0) {
5094
5114
  logger.warn(
5095
5115
  warnText(
5096
5116
  `No templates found for section ${section.label}. Please see ${linkText(
@@ -5103,7 +5123,7 @@ var generateCollectionFromForestrySection = (args) => {
5103
5123
  fields: [BODY_FIELD]
5104
5124
  };
5105
5125
  }
5106
- if ((section == null ? void 0 : section.create) === "none") {
5126
+ if (section?.create === "none") {
5107
5127
  c.ui = {
5108
5128
  ...c.ui,
5109
5129
  allowedActions: {
@@ -5125,7 +5145,7 @@ var generateCollectionFromForestrySection = (args) => {
5125
5145
  }
5126
5146
  for (const currentTemplateName of templateMap.keys()) {
5127
5147
  const { templateObj, fields: additionalFields } = templateMap.get(currentTemplateName);
5128
- const pages = (templateObj == null ? void 0 : templateObj.pages) || [];
5148
+ const pages = templateObj?.pages || [];
5129
5149
  if (pages.includes(section.path)) {
5130
5150
  fields.push(...additionalFields);
5131
5151
  break;
@@ -5204,11 +5224,10 @@ var generateCollections = async ({
5204
5224
  };
5205
5225
  };
5206
5226
  var rewriteTemplateKeysInDocs = (args) => {
5207
- var _a;
5208
5227
  const { templateMap, markdownParseConfig } = args;
5209
5228
  for (const templateKey of templateMap.keys()) {
5210
5229
  const { templateObj } = templateMap.get(templateKey);
5211
- (_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
5230
+ templateObj?.pages?.forEach((page) => {
5212
5231
  try {
5213
5232
  const filePath = import_path9.default.join(page);
5214
5233
  if (import_fs_extra10.default.lstatSync(filePath).isDirectory()) {
@@ -5257,6 +5276,15 @@ var CodemodCommand = class extends import_clipanion5.Command {
5257
5276
  description: "increase verbosity of logged output"
5258
5277
  });
5259
5278
  }
5279
+ static {
5280
+ this.paths = [["codemod"], ["codemod", "move-tina-folder"]];
5281
+ }
5282
+ static {
5283
+ this.usage = import_clipanion5.Command.Usage({
5284
+ category: `Commands`,
5285
+ description: `Use codemods for various Tina tasks`
5286
+ });
5287
+ }
5260
5288
  async catch(error) {
5261
5289
  console.log(error);
5262
5290
  }
@@ -5277,11 +5305,6 @@ var CodemodCommand = class extends import_clipanion5.Command {
5277
5305
  await command2();
5278
5306
  }
5279
5307
  };
5280
- CodemodCommand.paths = [["codemod"], ["codemod", "move-tina-folder"]];
5281
- CodemodCommand.usage = import_clipanion5.Command.Usage({
5282
- category: `Commands`,
5283
- description: `Use codemods for various Tina tasks`
5284
- });
5285
5308
  var moveTinaFolder = async (rootPath = process.cwd()) => {
5286
5309
  const configManager = new ConfigManager({ rootPath });
5287
5310
  try {
@@ -5561,11 +5584,10 @@ var baseFields = `[
5561
5584
  },
5562
5585
  ]`;
5563
5586
  var generateCollectionString = (args) => {
5564
- var _a, _b, _c, _d;
5565
5587
  if (args.collections) {
5566
5588
  return args.collections;
5567
5589
  }
5568
- let extraTinaCollections = (_b = (_a = args.config.authProvider) == null ? void 0 : _a.extraTinaCollections) == null ? void 0 : _b.join(",\n");
5590
+ let extraTinaCollections = args.config.authProvider?.extraTinaCollections?.join(",\n");
5569
5591
  if (extraTinaCollections) {
5570
5592
  extraTinaCollections = extraTinaCollections + ",";
5571
5593
  }
@@ -5591,18 +5613,17 @@ var generateCollectionString = (args) => {
5591
5613
  },
5592
5614
  },
5593
5615
  ]`;
5594
- if (((_d = (_c = args.config) == null ? void 0 : _c.framework) == null ? void 0 : _d.name) === "next") {
5616
+ if (args.config?.framework?.name === "next") {
5595
5617
  return nextExampleCollection;
5596
5618
  }
5597
5619
  return baseCollections;
5598
5620
  };
5599
5621
  var generateConfig = (args) => {
5600
- var _a, _b, _c;
5601
- const isUsingTinaCloud = !args.selfHosted || ((_a = args.config.authProvider) == null ? void 0 : _a.name) === "tina-cloud";
5622
+ const isUsingTinaCloud = !args.selfHosted || args.config.authProvider?.name === "tina-cloud";
5602
5623
  let extraImports = "";
5603
5624
  if (args.selfHosted) {
5604
5625
  if (args.config.authProvider) {
5605
- extraImports = extraImports + makeImportString((_b = args.config.authProvider) == null ? void 0 : _b.configImports);
5626
+ extraImports = extraImports + makeImportString(args.config.authProvider?.configImports);
5606
5627
  }
5607
5628
  if (!isUsingTinaCloud) {
5608
5629
  extraImports = extraImports + `
@@ -5625,7 +5646,7 @@ import { LocalAuthProvider } from "tinacms";`;
5625
5646
  branch,
5626
5647
  ${args.selfHosted && !isUsingTinaCloud ? `authProvider: isLocal
5627
5648
  ? new LocalAuthProvider()
5628
- :${(_c = args.config) == null ? void 0 : _c.authProvider.configAuthProviderClass},` : ""}
5649
+ :${args.config?.authProvider.configAuthProviderClass},` : ""}
5629
5650
  ${isUsingTinaCloud ? `// Get this from tina.io
5630
5651
  clientId: process.env.NEXT_PUBLIC_TINA_CLIENT_ID,` : ""}
5631
5652
  ${isUsingTinaCloud ? `// Get this from tina.io
@@ -5652,11 +5673,10 @@ import { LocalAuthProvider } from "tinacms";`;
5652
5673
 
5653
5674
  // src/cmds/init/templates/database.ts
5654
5675
  var databaseTemplate = ({ config: config2 }) => {
5655
- var _a, _b, _c, _d;
5656
5676
  return `
5657
5677
  import { createDatabase, createLocalDatabase } from '@tinacms/datalayer'
5658
- ${makeImportString((_a = config2.gitProvider) == null ? void 0 : _a.imports)}
5659
- ${makeImportString((_b = config2.databaseAdapter) == null ? void 0 : _b.imports)}
5678
+ ${makeImportString(config2.gitProvider?.imports)}
5679
+ ${makeImportString(config2.databaseAdapter?.imports)}
5660
5680
 
5661
5681
  const branch = (process.env.GITHUB_BRANCH ||
5662
5682
  process.env.VERCEL_GIT_COMMIT_REF ||
@@ -5668,8 +5688,8 @@ const isLocal = process.env.${config2.isLocalEnvVarName} === 'true'
5668
5688
  export default isLocal
5669
5689
  ? createLocalDatabase()
5670
5690
  : createDatabase({
5671
- gitProvider: ${(_c = config2.gitProvider) == null ? void 0 : _c.gitProviderClassText},
5672
- databaseAdapter: ${(_d = config2.databaseAdapter) == null ? void 0 : _d.databaseAdapterClassText},
5691
+ gitProvider: ${config2.gitProvider?.gitProviderClassText},
5692
+ databaseAdapter: ${config2.databaseAdapter?.databaseAdapterClassText},
5673
5693
  namespace: branch,
5674
5694
  })
5675
5695
  `;
@@ -5680,10 +5700,9 @@ var nextApiRouteTemplate = ({
5680
5700
  config: config2,
5681
5701
  env
5682
5702
  }) => {
5683
- var _a, _b;
5684
5703
  const extraPath = env.usingSrc ? "../" : "";
5685
5704
  return `import { TinaNodeBackend, LocalBackendAuthProvider } from '@tinacms/datalayer'
5686
- ${makeImportString((_a = config2.authProvider) == null ? void 0 : _a.backendAuthProviderImports)}
5705
+ ${makeImportString(config2.authProvider?.backendAuthProviderImports)}
5687
5706
 
5688
5707
 
5689
5708
 
@@ -5694,7 +5713,7 @@ var nextApiRouteTemplate = ({
5694
5713
  const handler = TinaNodeBackend({
5695
5714
  authProvider: isLocal
5696
5715
  ? LocalBackendAuthProvider()
5697
- : ${((_b = config2.authProvider) == null ? void 0 : _b.backendAuthProvider) || ""},
5716
+ : ${config2.authProvider?.backendAuthProvider || ""},
5698
5717
  databaseClient,
5699
5718
  })
5700
5719
 
@@ -5722,19 +5741,18 @@ var import_prettier2 = require("prettier");
5722
5741
  // src/utils/script-helpers.ts
5723
5742
  function generateGqlScript(scriptValue, opts) {
5724
5743
  const cmd = `tinacms dev -c "${scriptValue}"`;
5725
- if (opts == null ? void 0 : opts.isLocalEnvVarName) {
5744
+ if (opts?.isLocalEnvVarName) {
5726
5745
  return `${opts.isLocalEnvVarName}=true ${cmd}`;
5727
5746
  }
5728
5747
  return cmd;
5729
5748
  }
5730
5749
  function extendNextScripts(scripts, opts) {
5731
- var _a, _b;
5732
5750
  const result = {
5733
5751
  ...scripts,
5734
- dev: !(scripts == null ? void 0 : scripts.dev) || ((_a = scripts == null ? void 0 : scripts.dev) == null ? void 0 : _a.indexOf("tinacms dev -c")) === -1 ? generateGqlScript((scripts == null ? void 0 : scripts.dev) || "next dev", opts) : scripts == null ? void 0 : scripts.dev,
5735
- build: !(scripts == null ? void 0 : scripts.build) || !((_b = scripts == null ? void 0 : scripts.build) == null ? void 0 : _b.startsWith("tinacms build &&")) ? `tinacms build && ${(scripts == null ? void 0 : scripts.build) || "next build"}` : scripts == null ? void 0 : scripts.build
5752
+ dev: !scripts?.dev || scripts?.dev?.indexOf("tinacms dev -c") === -1 ? generateGqlScript(scripts?.dev || "next dev", opts) : scripts?.dev,
5753
+ build: !scripts?.build || !scripts?.build?.startsWith("tinacms build &&") ? `tinacms build && ${scripts?.build || "next build"}` : scripts?.build
5736
5754
  };
5737
- if ((opts == null ? void 0 : opts.addSetupUsers) && !scripts["setup:users"]) {
5755
+ if (opts?.addSetupUsers && !scripts["setup:users"]) {
5738
5756
  result["setup:users"] = "tinacms-next-auth setup";
5739
5757
  }
5740
5758
  return result;
@@ -5816,7 +5834,6 @@ var makeVariableStatementVisitor = (sourceFile, variableStmtSourceFile, variable
5816
5834
  }
5817
5835
  };
5818
5836
  var makeImportsVisitor = (sourceFile, importMap) => (ctx) => (node) => {
5819
- var _a;
5820
5837
  if (import_typescript3.default.isSourceFile(node)) {
5821
5838
  const newStatements = [...node.statements];
5822
5839
  let changed = false;
@@ -5825,7 +5842,7 @@ var makeImportsVisitor = (sourceFile, importMap) => (ctx) => (node) => {
5825
5842
  for (const statement of newStatements) {
5826
5843
  if (import_typescript3.default.isImportDeclaration(statement) && import_typescript3.default.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === moduleName) {
5827
5844
  foundImportStatement = true;
5828
- const existingImports = ((_a = statement.importClause) == null ? void 0 : _a.namedBindings) && import_typescript3.default.isNamedImports(statement.importClause.namedBindings) ? statement.importClause.namedBindings.elements.map(
5845
+ const existingImports = statement.importClause?.namedBindings && import_typescript3.default.isNamedImports(statement.importClause.namedBindings) ? statement.importClause.namedBindings.elements.map(
5829
5846
  (e) => e.name.text
5830
5847
  ) : [];
5831
5848
  const newImports = [
@@ -6042,7 +6059,6 @@ async function apply({
6042
6059
  params,
6043
6060
  config: config2
6044
6061
  }) {
6045
- var _a;
6046
6062
  if (config2.framework.name === "other" && config2.hosting === "self-host") {
6047
6063
  logger.error(
6048
6064
  logText(
@@ -6168,7 +6184,7 @@ async function apply({
6168
6184
  env.tinaConfigExists && // Are we running tinacms init backend
6169
6185
  params.isBackendInit && // Do the user choose the 'self-host' option
6170
6186
  config2.hosting === "self-host" && // the user did not choose the 'tina-cloud' auth provider
6171
- (((_a = config2.authProvider) == null ? void 0 : _a.name) || "") !== "tina-cloud"
6187
+ (config2.authProvider?.name || "") !== "tina-cloud"
6172
6188
  ) {
6173
6189
  await addSelfHostedTinaAuthToConfig(config2, env.generatedFiles["config"]);
6174
6190
  }
@@ -6236,7 +6252,6 @@ var updateGitIgnore = async ({
6236
6252
  await import_fs_extra13.default.writeFile(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
6237
6253
  };
6238
6254
  var addDependencies = async (config2, env, params) => {
6239
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
6240
6255
  const { packageManager } = config2;
6241
6256
  const tagVersion = params.tinaVersion ? `@${params.tinaVersion}` : "";
6242
6257
  let deps = [];
@@ -6252,18 +6267,18 @@ var addDependencies = async (config2, env, params) => {
6252
6267
  deps.push("@tinacms/datalayer");
6253
6268
  }
6254
6269
  deps.push(
6255
- ...((_b = (_a = config2.databaseAdapter) == null ? void 0 : _a.imports) == null ? void 0 : _b.map((x) => x.packageName)) || []
6270
+ ...config2.databaseAdapter?.imports?.map((x) => x.packageName) || []
6256
6271
  );
6257
- deps.push(...((_c = config2.authProvider) == null ? void 0 : _c.peerDependencies) || []);
6272
+ deps.push(...config2.authProvider?.peerDependencies || []);
6258
6273
  deps.push(
6259
- ...((_e = (_d = config2.authProvider) == null ? void 0 : _d.backendAuthProviderImports) == null ? void 0 : _e.map(
6274
+ ...config2.authProvider?.backendAuthProviderImports?.map(
6260
6275
  (x) => x.packageName
6261
- )) || []
6276
+ ) || []
6262
6277
  );
6263
6278
  deps.push(
6264
- ...((_g = (_f = config2.authProvider) == null ? void 0 : _f.configImports) == null ? void 0 : _g.map((x) => x.packageName)) || []
6279
+ ...config2.authProvider?.configImports?.map((x) => x.packageName) || []
6265
6280
  );
6266
- deps.push(...((_i = (_h = config2.gitProvider) == null ? void 0 : _h.imports) == null ? void 0 : _i.map((x) => x.packageName)) || []);
6281
+ deps.push(...config2.gitProvider?.imports?.map((x) => x.packageName) || []);
6267
6282
  if (tagVersion) {
6268
6283
  deps = deps.map(
6269
6284
  (dep) => dep.indexOf("tina") >= 0 ? `${dep}${tagVersion}` : dep
@@ -6327,12 +6342,11 @@ var addConfigFile = async ({
6327
6342
  generatedFile,
6328
6343
  config: config2
6329
6344
  }) => {
6330
- var _a;
6331
6345
  const content = (0, import_prettier2.format)(generateConfig(configArgs), {
6332
6346
  parser: "babel"
6333
6347
  });
6334
6348
  await writeGeneratedFile({
6335
- overwrite: (_a = config2.overwriteList) == null ? void 0 : _a.includes("config"),
6349
+ overwrite: config2.overwriteList?.includes("config"),
6336
6350
  generatedFile,
6337
6351
  content,
6338
6352
  typescript: config2.typescript
@@ -6346,10 +6360,9 @@ var addDatabaseFile = async ({
6346
6360
  config: config2,
6347
6361
  generatedFile
6348
6362
  }) => {
6349
- var _a;
6350
6363
  await writeGeneratedFile({
6351
6364
  generatedFile,
6352
- overwrite: (_a = config2.overwriteList) == null ? void 0 : _a.includes("database"),
6365
+ overwrite: config2.overwriteList?.includes("database"),
6353
6366
  content: databaseTemplate({ config: config2 }),
6354
6367
  typescript: config2.typescript
6355
6368
  });
@@ -6359,13 +6372,12 @@ var addNextApiRoute = async ({
6359
6372
  generatedFile,
6360
6373
  env
6361
6374
  }) => {
6362
- var _a;
6363
6375
  const content = (0, import_prettier2.format)(nextApiRouteTemplate({ config: config2, env }), {
6364
6376
  parser: "babel"
6365
6377
  });
6366
6378
  await writeGeneratedFile({
6367
6379
  generatedFile,
6368
- overwrite: (_a = config2.overwriteList) == null ? void 0 : _a.includes("next-api-handler"),
6380
+ overwrite: config2.overwriteList?.includes("next-api-handler"),
6369
6381
  content,
6370
6382
  typescript: config2.typescript
6371
6383
  });
@@ -6375,10 +6387,9 @@ var addTemplateFile = async ({
6375
6387
  generatedFile,
6376
6388
  config: config2
6377
6389
  }) => {
6378
- var _a;
6379
6390
  await writeGeneratedFile({
6380
6391
  generatedFile,
6381
- overwrite: (_a = config2.overwriteList) == null ? void 0 : _a.includes(generatedFile.generatedFileType),
6392
+ overwrite: config2.overwriteList?.includes(generatedFile.generatedFileType),
6382
6393
  content,
6383
6394
  typescript: config2.typescript
6384
6395
  });
@@ -6387,7 +6398,6 @@ var addContentFile = async ({
6387
6398
  config: config2,
6388
6399
  env
6389
6400
  }) => {
6390
- var _a;
6391
6401
  await writeGeneratedFile({
6392
6402
  generatedFile: {
6393
6403
  javascriptExists: false,
@@ -6405,7 +6415,7 @@ var addContentFile = async ({
6405
6415
  });
6406
6416
  }
6407
6417
  },
6408
- overwrite: (_a = config2.overwriteList) == null ? void 0 : _a.includes("sample-content"),
6418
+ overwrite: config2.overwriteList?.includes("sample-content"),
6409
6419
  content: helloWorldPost,
6410
6420
  typescript: false
6411
6421
  });
@@ -6496,12 +6506,11 @@ var addReactiveFile = {
6496
6506
  baseDir,
6497
6507
  dataLayer
6498
6508
  }) => {
6499
- var _a, _b;
6500
6509
  const packageJsonPath = import_path11.default.join(baseDir, "package.json");
6501
6510
  await writeGeneratedFile({
6502
6511
  generatedFile,
6503
6512
  typescript: config2.typescript,
6504
- overwrite: (_a = config2.overwriteList) == null ? void 0 : _a.includes(
6513
+ overwrite: config2.overwriteList?.includes(
6505
6514
  generatedFile.generatedFileType
6506
6515
  ),
6507
6516
  content: templates["demo-post-page"]({
@@ -6517,7 +6526,7 @@ var addReactiveFile = {
6517
6526
  ...packageJson,
6518
6527
  scripts: extendNextScripts(scripts, {
6519
6528
  isLocalEnvVarName: config2.isLocalEnvVarName,
6520
- addSetupUsers: ((_b = config2.authProvider) == null ? void 0 : _b.name) === "next-auth"
6529
+ addSetupUsers: config2.authProvider?.name === "next-auth"
6521
6530
  })
6522
6531
  },
6523
6532
  null,
@@ -6592,6 +6601,15 @@ var InitCommand = class extends import_clipanion6.Command {
6592
6601
  description: "Specify a version for tina dependencies"
6593
6602
  });
6594
6603
  }
6604
+ static {
6605
+ this.paths = [["init"], ["init", "backend"]];
6606
+ }
6607
+ static {
6608
+ this.usage = import_clipanion6.Command.Usage({
6609
+ category: `Commands`,
6610
+ description: `Add Tina to an existing project`
6611
+ });
6612
+ }
6595
6613
  async catch(error) {
6596
6614
  logger.error("Error occured during tinacms init");
6597
6615
  console.error(error);
@@ -6611,11 +6629,6 @@ var InitCommand = class extends import_clipanion6.Command {
6611
6629
  process.exit();
6612
6630
  }
6613
6631
  };
6614
- InitCommand.paths = [["init"], ["init", "backend"]];
6615
- InitCommand.usage = import_clipanion6.Command.Usage({
6616
- category: `Commands`,
6617
- description: `Add Tina to an existing project`
6618
- });
6619
6632
 
6620
6633
  // src/next/commands/searchindex-command/index.ts
6621
6634
  var import_clipanion7 = require("clipanion");
@@ -6631,13 +6644,21 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
6631
6644
  description: "increase verbosity of logged output"
6632
6645
  });
6633
6646
  }
6647
+ static {
6648
+ this.paths = [["search-index"]];
6649
+ }
6650
+ static {
6651
+ this.usage = import_clipanion7.Command.Usage({
6652
+ category: `Commands`,
6653
+ description: `Index the site for search`
6654
+ });
6655
+ }
6634
6656
  async catch(error) {
6635
6657
  logger.error("Error occured during tinacms search-index");
6636
6658
  console.error(error);
6637
6659
  process.exit(1);
6638
6660
  }
6639
6661
  async execute() {
6640
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
6641
6662
  const rootPath = this.rootPath || process.cwd();
6642
6663
  const configManager = new ConfigManager({ rootPath });
6643
6664
  try {
@@ -6648,7 +6669,7 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
6648
6669
  console.error(e);
6649
6670
  }
6650
6671
  }
6651
- if (!((_a = configManager.config) == null ? void 0 : _a.search)) {
6672
+ if (!configManager.config?.search) {
6652
6673
  logger.error("No search config found");
6653
6674
  process.exit(1);
6654
6675
  }
@@ -6657,9 +6678,9 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
6657
6678
  schema: { ...schema, config: configManager.config }
6658
6679
  });
6659
6680
  let client;
6660
- const hasTinaSearch = Boolean((_c = (_b = configManager.config) == null ? void 0 : _b.search) == null ? void 0 : _c.tina);
6681
+ const hasTinaSearch = Boolean(configManager.config?.search?.tina);
6661
6682
  if (hasTinaSearch) {
6662
- if (!((_d = configManager.config) == null ? void 0 : _d.branch)) {
6683
+ if (!configManager.config?.branch) {
6663
6684
  logger.error(
6664
6685
  `${dangerText(
6665
6686
  `ERROR: Branch not configured in tina search configuration.`
@@ -6667,11 +6688,11 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
6667
6688
  );
6668
6689
  throw new Error("Branch not configured in tina search configuration.");
6669
6690
  }
6670
- if (!((_e = configManager.config) == null ? void 0 : _e.clientId)) {
6691
+ if (!configManager.config?.clientId) {
6671
6692
  logger.error(`${dangerText(`ERROR: clientId not configured.`)}`);
6672
6693
  throw new Error("clientId not configured.");
6673
6694
  }
6674
- if (!((_h = (_g = (_f = configManager.config) == null ? void 0 : _f.search) == null ? void 0 : _g.tina) == null ? void 0 : _h.indexerToken)) {
6695
+ if (!configManager.config?.search?.tina?.indexerToken) {
6675
6696
  logger.error(
6676
6697
  `${dangerText(
6677
6698
  `ERROR: indexerToken not configured in tina search configuration.`
@@ -6682,22 +6703,22 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
6682
6703
  );
6683
6704
  }
6684
6705
  client = new import_search3.TinaCMSSearchIndexClient({
6685
- apiUrl: `${((_i = configManager.config.tinaioConfig) == null ? void 0 : _i.contentApiUrlOverride) || "https://content.tinajs.io"}/searchIndex/${(_j = configManager.config) == null ? void 0 : _j.clientId}`,
6686
- branch: (_k = configManager.config) == null ? void 0 : _k.branch,
6687
- indexerToken: (_n = (_m = (_l = configManager.config) == null ? void 0 : _l.search) == null ? void 0 : _m.tina) == null ? void 0 : _n.indexerToken,
6688
- stopwordLanguages: (_q = (_p = (_o = configManager.config) == null ? void 0 : _o.search) == null ? void 0 : _p.tina) == null ? void 0 : _q.stopwordLanguages
6706
+ apiUrl: `${configManager.config.tinaioConfig?.contentApiUrlOverride || "https://content.tinajs.io"}/searchIndex/${configManager.config?.clientId}`,
6707
+ branch: configManager.config?.branch,
6708
+ indexerToken: configManager.config?.search?.tina?.indexerToken,
6709
+ stopwordLanguages: configManager.config?.search?.tina?.stopwordLanguages
6689
6710
  });
6690
6711
  } else {
6691
- client = (_s = (_r = configManager.config) == null ? void 0 : _r.search) == null ? void 0 : _s.searchClient;
6712
+ client = configManager.config?.search?.searchClient;
6692
6713
  }
6693
6714
  const searchIndexer = new import_search3.SearchIndexer({
6694
- batchSize: ((_t = configManager.config.search) == null ? void 0 : _t.indexBatchSize) || 100,
6715
+ batchSize: configManager.config.search?.indexBatchSize || 100,
6695
6716
  bridge: new import_graphql17.FilesystemBridge(
6696
6717
  configManager.rootPath,
6697
6718
  configManager.contentRootPath
6698
6719
  ),
6699
6720
  schema: tinaSchema,
6700
- textIndexLength: ((_u = configManager.config.search) == null ? void 0 : _u.maxSearchIndexFieldLength) || 100,
6721
+ textIndexLength: configManager.config.search?.maxSearchIndexFieldLength || 100,
6701
6722
  client
6702
6723
  });
6703
6724
  let err;
@@ -6718,11 +6739,6 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
6718
6739
  process.exit(0);
6719
6740
  }
6720
6741
  };
6721
- SearchIndexCommand.paths = [["search-index"]];
6722
- SearchIndexCommand.usage = import_clipanion7.Command.Usage({
6723
- category: `Commands`,
6724
- description: `Index the site for search`
6725
- });
6726
6742
 
6727
6743
  // src/index.ts
6728
6744
  var cli = new import_clipanion8.Cli({