@tinacms/cli 1.5.10 → 1.5.12

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
@@ -28,15 +28,15 @@ __export(src_exports, {
28
28
  default: () => src_default
29
29
  });
30
30
  module.exports = __toCommonJS(src_exports);
31
- var import_clipanion6 = require("clipanion");
31
+ var import_clipanion7 = require("clipanion");
32
32
 
33
33
  // package.json
34
- var version = "1.5.10";
34
+ var version = "1.5.12";
35
35
 
36
36
  // src/next/commands/dev-command/index.ts
37
- var import_clipanion = require("clipanion");
37
+ var import_clipanion2 = require("clipanion");
38
38
  var import_fs_extra4 = __toESM(require("fs-extra"));
39
- var import_path6 = __toESM(require("path"));
39
+ var import_path7 = __toESM(require("path"));
40
40
  var import_chokidar = __toESM(require("chokidar"));
41
41
  var import_graphql8 = require("@tinacms/graphql");
42
42
 
@@ -47,6 +47,7 @@ var import_os = __toESM(require("os"));
47
47
  var esbuild = __toESM(require("esbuild"));
48
48
  var dotenv = __toESM(require("dotenv"));
49
49
  var import_normalize_path = __toESM(require("normalize-path"));
50
+ var import_chalk2 = __toESM(require("chalk"));
50
51
 
51
52
  // src/logger/index.ts
52
53
  var import_chalk = __toESM(require("chalk"));
@@ -91,15 +92,16 @@ ${message}
91
92
  len - strip(ln).length
92
93
  )}${import_chalk.default.gray(bar)}`
93
94
  ).join("\n");
95
+ const underscoreLen = len - title.length - 1 > 0 ? len - title.length - 1 : 0;
94
96
  process.stdout.write(
95
97
  `${import_chalk.default.gray(bar)}
96
98
  ${import_chalk.default.green("\u25CB")} ${import_chalk.default.reset(
97
99
  title
98
- )} ${import_chalk.default.gray(
99
- "\u2500".repeat(len - title.length - 1) + "\u256E"
100
- )}
100
+ )} ${import_chalk.default.gray("\u2500".repeat(underscoreLen) + "\u256E")}
101
101
  ${msg}
102
- ${import_chalk.default.gray("\u251C" + "\u2500".repeat(len + 2) + "\u256F")}
102
+ ${import_chalk.default.gray(
103
+ "\u251C" + "\u2500".repeat(len + 2) + "\u256F"
104
+ )}
103
105
  `
104
106
  );
105
107
  };
@@ -286,12 +288,28 @@ var ConfigManager = class {
286
288
  this.tinaFolderPath,
287
289
  this.config.localContentPath || ""
288
290
  );
289
- if (this.config.localContentPath && await import_fs_extra.default.existsSync(fullLocalContentPath)) {
290
- logger.info(`Using separate content repo at ${fullLocalContentPath}`);
291
- this.contentRootPath = fullLocalContentPath;
292
- } else {
291
+ if (this.config.localContentPath) {
292
+ const localContentPathExists = await import_fs_extra.default.pathExists(fullLocalContentPath);
293
+ if (localContentPathExists) {
294
+ logger.info(`Using separate content repo at ${fullLocalContentPath}`);
295
+ this.contentRootPath = fullLocalContentPath;
296
+ } else {
297
+ logger.warn(
298
+ `${import_chalk2.default.yellow("Warning:")} The localContentPath ${import_chalk2.default.cyan(
299
+ fullLocalContentPath
300
+ )} does not exist. Please create it or remove the localContentPath from your config file at ${import_chalk2.default.cyan(
301
+ this.tinaConfigFilePath
302
+ )}`
303
+ );
304
+ }
305
+ }
306
+ if (!this.contentRootPath) {
293
307
  this.contentRootPath = this.rootPath;
294
308
  }
309
+ this.generatedFolderPathContentRepo = import_path.default.join(
310
+ await this.getTinaFolderPath(this.contentRootPath),
311
+ GENERATED_FOLDER
312
+ );
295
313
  this.spaMainPath = require.resolve("@tinacms/app");
296
314
  this.spaRootPath = import_path.default.join(this.spaMainPath, "..", "..");
297
315
  }
@@ -434,6 +452,48 @@ var loaders = {
434
452
  };
435
453
 
436
454
  // src/next/commands/dev-command/html.ts
455
+ var errorHTML = `<style type="text/css">
456
+ #no-assets-placeholder body {
457
+ font-family: sans-serif;
458
+ font-size: 16px;
459
+ line-height: 1.4;
460
+ color: #333;
461
+ background-color: #f5f5f5;
462
+ }
463
+ #no-assets-placeholder {
464
+ max-width: 600px;
465
+ margin: 0 auto;
466
+ padding: 40px;
467
+ text-align: center;
468
+ background-color: #fff;
469
+ box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
470
+ }
471
+ #no-assets-placeholder h1 {
472
+ font-size: 24px;
473
+ margin-bottom: 20px;
474
+ }
475
+ #no-assets-placeholder p {
476
+ margin-bottom: 10px;
477
+ }
478
+ #no-assets-placeholder a {
479
+ color: #0077cc;
480
+ text-decoration: none;
481
+ }
482
+ #no-assets-placeholder a:hover {
483
+ text-decoration: underline;
484
+ }
485
+ </style>
486
+ <div id="no-assets-placeholder">
487
+ <h1>Failed loading TinaCMS assets</h1>
488
+ <p>
489
+ Your TinaCMS configuration may be misconfigured, and we could not load
490
+ the assets for this page.
491
+ </p>
492
+ <p>
493
+ 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.
494
+ </p>
495
+ </div>
496
+ </div>`.trim().replace(/[\r\n\s]+/g, " ");
437
497
  var devHTML = (port) => `<!DOCTYPE html>
438
498
  <html lang="en">
439
499
  <head>
@@ -451,9 +511,16 @@ var devHTML = (port) => `<!DOCTYPE html>
451
511
  window.__vite_plugin_react_preamble_installed__ = true
452
512
  <\/script>
453
513
  <script type="module" src="http://localhost:${port}/@vite/client"><\/script>
514
+ <script>
515
+ function handleLoadError() {
516
+ // Assets have failed to load
517
+ document.getElementById('root').innerHTML = '${errorHTML}';
518
+ }
519
+ <\/script>
454
520
  <script
455
521
  type="module"
456
522
  src="http://localhost:${port}/src/main.tsx"
523
+ onerror="handleLoadError()"
457
524
  ><\/script>
458
525
  <body class="tina-tailwind">
459
526
  <div id="root"></div>
@@ -762,9 +829,15 @@ var createConfig = async ({
762
829
  } else {
763
830
  alias["CLIENT_IMPORT"] = configManager.isUsingTs() ? configManager.generatedTypesTSFilePath : configManager.generatedTypesJSFilePath;
764
831
  }
832
+ let basePath;
833
+ if (configManager.config.build.basePath) {
834
+ basePath = configManager.config.build.basePath;
835
+ }
765
836
  const config3 = {
766
837
  root: configManager.spaRootPath,
767
- base: `/${(0, import_normalize_path2.default)(configManager.config.build.outputFolder)}/`,
838
+ base: `/${basePath ? `${(0, import_normalize_path2.default)(basePath)}/` : ""}${(0, import_normalize_path2.default)(
839
+ configManager.config.build.outputFolder
840
+ )}/`,
768
841
  appType: "spa",
769
842
  resolve: {
770
843
  alias,
@@ -1102,6 +1175,7 @@ var createDevServer = async (configManager, database, apiURL, noWatch) => {
1102
1175
 
1103
1176
  // src/next/codegen/index.ts
1104
1177
  var import_fs_extra3 = __toESM(require("fs-extra"));
1178
+ var import_path6 = __toESM(require("path"));
1105
1179
  var import_graphql6 = require("graphql");
1106
1180
 
1107
1181
  // src/next/codegen/codegen/index.ts
@@ -1303,15 +1377,35 @@ var Codegen = class {
1303
1377
  constructor({
1304
1378
  configManager,
1305
1379
  port,
1306
- schema,
1307
1380
  queryDoc,
1308
- fragDoc
1381
+ fragDoc,
1382
+ isLocal,
1383
+ graphqlSchemaDoc,
1384
+ tinaSchema,
1385
+ lookup
1309
1386
  }) {
1387
+ this.isLocal = isLocal;
1388
+ this.graphqlSchemaDoc = graphqlSchemaDoc;
1310
1389
  this.configManager = configManager;
1311
1390
  this.port = port;
1312
- this.schema = schema;
1391
+ this.schema = (0, import_graphql6.buildASTSchema)(graphqlSchemaDoc);
1392
+ this.tinaSchema = tinaSchema;
1313
1393
  this.queryDoc = queryDoc;
1314
1394
  this.fragDoc = fragDoc;
1395
+ this.lookup = lookup;
1396
+ }
1397
+ async writeConfigFile(fileName, data) {
1398
+ const filePath = import_path6.default.join(this.configManager.generatedFolderPath, fileName);
1399
+ await import_fs_extra3.default.ensureFile(filePath);
1400
+ await import_fs_extra3.default.outputFile(filePath, data);
1401
+ if (this.configManager.hasSeparateContentRoot()) {
1402
+ const filePath2 = import_path6.default.join(
1403
+ this.configManager.generatedFolderPathContentRepo,
1404
+ fileName
1405
+ );
1406
+ await import_fs_extra3.default.ensureFile(filePath2);
1407
+ await import_fs_extra3.default.outputFile(filePath2, data);
1408
+ }
1315
1409
  }
1316
1410
  async removeGeneratedFilesIfExists() {
1317
1411
  await unlinkIfExists(this.configManager.generatedClientJSFilePath);
@@ -1323,7 +1417,19 @@ var Codegen = class {
1323
1417
  await unlinkIfExists(this.configManager.generatedFragmentsFilePath);
1324
1418
  }
1325
1419
  async execute() {
1326
- const apiURL = this.getApiURL();
1420
+ await this.writeConfigFile(
1421
+ "_graphql.json",
1422
+ JSON.stringify(this.graphqlSchemaDoc)
1423
+ );
1424
+ await this.writeConfigFile(
1425
+ "_schema.json",
1426
+ JSON.stringify(this.tinaSchema.schema)
1427
+ );
1428
+ await this.writeConfigFile("_lookup.json", JSON.stringify(this.lookup));
1429
+ const { apiURL, localUrl, tinaCloudUrl } = this._createApiUrl();
1430
+ this.apiURL = apiURL;
1431
+ this.localUrl = localUrl;
1432
+ this.productionUrl = tinaCloudUrl;
1327
1433
  if (this.configManager.shouldSkipSDK()) {
1328
1434
  await this.removeGeneratedFilesIfExists();
1329
1435
  return apiURL;
@@ -1374,7 +1480,7 @@ var Codegen = class {
1374
1480
  }
1375
1481
  return apiURL;
1376
1482
  }
1377
- getApiURL() {
1483
+ _createApiUrl() {
1378
1484
  var _a, _b, _c, _d;
1379
1485
  const branch = (_a = this.configManager.config) == null ? void 0 : _a.branch;
1380
1486
  const clientId = (_b = this.configManager.config) == null ? void 0 : _b.clientId;
@@ -1395,11 +1501,20 @@ var Codegen = class {
1395
1501
  )}. Please visit https://tina.io/docs/tina-cloud/connecting-site/ for more information`
1396
1502
  );
1397
1503
  }
1398
- let apiURL = this.port ? `http://localhost:${this.port}/graphql` : `${baseUrl}/${version2}/content/${clientId}/github/${branch}`;
1504
+ let localUrl = `http://localhost:${this.port}/graphql`;
1505
+ let tinaCloudUrl = `${baseUrl}/${version2}/content/${clientId}/github/${branch}`;
1506
+ let apiURL = this.isLocal ? `http://localhost:${this.port}/graphql` : `${baseUrl}/${version2}/content/${clientId}/github/${branch}`;
1399
1507
  if (this.configManager.config.contentApiUrlOverride) {
1400
1508
  apiURL = this.configManager.config.contentApiUrlOverride;
1509
+ localUrl = apiURL;
1510
+ tinaCloudUrl = apiURL;
1401
1511
  }
1402
- return apiURL;
1512
+ return { apiURL, localUrl, tinaCloudUrl };
1513
+ }
1514
+ getApiURL() {
1515
+ if (!this.apiURL)
1516
+ throw new Error("apiURL not set. Please run execute() first");
1517
+ return this.apiURL;
1403
1518
  }
1404
1519
  async genClient() {
1405
1520
  var _a;
@@ -1463,58 +1578,6 @@ var unlinkIfExists = async (filepath) => {
1463
1578
  }
1464
1579
  };
1465
1580
 
1466
- // src/next/commands/dev-command/index.ts
1467
- var import_chalk3 = __toESM(require("chalk"));
1468
-
1469
- // src/utils/start-subprocess.ts
1470
- var import_child_process = __toESM(require("child_process"));
1471
-
1472
- // src/utils/theme.ts
1473
- var import_chalk2 = __toESM(require("chalk"));
1474
- var successText = import_chalk2.default.bold.green;
1475
- var focusText = import_chalk2.default.bold;
1476
- var dangerText = import_chalk2.default.bold.red;
1477
- var neutralText = import_chalk2.default.bold.cyan;
1478
- var linkText = import_chalk2.default.bold.cyan;
1479
- var labelText = import_chalk2.default.bold;
1480
- var cmdText = import_chalk2.default.inverse;
1481
- var indentedCmd = (str) => {
1482
- return ` \u2503 ` + str;
1483
- };
1484
- var logText = import_chalk2.default.italic.gray;
1485
- var warnText = import_chalk2.default.yellowBright.bgBlack;
1486
- var titleText = import_chalk2.default.bgHex("d2f1f8").hex("ec4816");
1487
- var CONFIRMATION_TEXT = import_chalk2.default.dim("enter to confirm");
1488
-
1489
- // src/utils/start-subprocess.ts
1490
- var startSubprocess2 = async ({ command }) => {
1491
- if (typeof command === "string") {
1492
- const commands = command.split(" ");
1493
- const firstCommand = commands[0];
1494
- const args = commands.slice(1) || [];
1495
- const ps = import_child_process.default.spawn(firstCommand, args, {
1496
- stdio: "inherit",
1497
- shell: true
1498
- });
1499
- ps.on("error", (code) => {
1500
- logger.error(
1501
- dangerText(
1502
- `An error has occurred in the Next.js child process. Error message below`
1503
- )
1504
- );
1505
- logger.error(`name: ${code.name}
1506
- message: ${code.message}
1507
-
1508
- stack: ${code.stack || "No stack was provided"}`);
1509
- });
1510
- ps.on("close", (code) => {
1511
- logger.info(`child process exited with code ${code}`);
1512
- process.exit(code);
1513
- });
1514
- return ps;
1515
- }
1516
- };
1517
-
1518
1581
  // src/next/database.ts
1519
1582
  var import_graphql7 = require("@tinacms/graphql");
1520
1583
  var import_readable_stream = require("readable-stream");
@@ -1565,6 +1628,59 @@ async function createAndInitializeDatabase(configManager, datalayerPort, bridgeO
1565
1628
  return database;
1566
1629
  }
1567
1630
 
1631
+ // src/next/commands/baseCommands.ts
1632
+ var import_clipanion = require("clipanion");
1633
+ var import_chalk4 = __toESM(require("chalk"));
1634
+
1635
+ // src/utils/start-subprocess.ts
1636
+ var import_child_process = __toESM(require("child_process"));
1637
+
1638
+ // src/utils/theme.ts
1639
+ var import_chalk3 = __toESM(require("chalk"));
1640
+ var successText = import_chalk3.default.bold.green;
1641
+ var focusText = import_chalk3.default.bold;
1642
+ var dangerText = import_chalk3.default.bold.red;
1643
+ var neutralText = import_chalk3.default.bold.cyan;
1644
+ var linkText = import_chalk3.default.bold.cyan;
1645
+ var labelText = import_chalk3.default.bold;
1646
+ var cmdText = import_chalk3.default.inverse;
1647
+ var indentedCmd = (str) => {
1648
+ return ` \u2503 ` + str;
1649
+ };
1650
+ var logText = import_chalk3.default.italic.gray;
1651
+ var warnText = import_chalk3.default.yellowBright.bgBlack;
1652
+ var titleText = import_chalk3.default.bgHex("d2f1f8").hex("ec4816");
1653
+ var CONFIRMATION_TEXT = import_chalk3.default.dim("enter to confirm");
1654
+
1655
+ // src/utils/start-subprocess.ts
1656
+ var startSubprocess2 = async ({ command }) => {
1657
+ if (typeof command === "string") {
1658
+ const commands = command.split(" ");
1659
+ const firstCommand = commands[0];
1660
+ const args = commands.slice(1) || [];
1661
+ const ps = import_child_process.default.spawn(firstCommand, args, {
1662
+ stdio: "inherit",
1663
+ shell: true
1664
+ });
1665
+ ps.on("error", (code) => {
1666
+ logger.error(
1667
+ dangerText(
1668
+ `An error has occurred in the Next.js child process. Error message below`
1669
+ )
1670
+ );
1671
+ logger.error(`name: ${code.name}
1672
+ message: ${code.message}
1673
+
1674
+ stack: ${code.stack || "No stack was provided"}`);
1675
+ });
1676
+ ps.on("close", (code) => {
1677
+ logger.info(`child process exited with code ${code}`);
1678
+ process.exit(code);
1679
+ });
1680
+ return ps;
1681
+ }
1682
+ };
1683
+
1568
1684
  // src/utils/spinner.ts
1569
1685
  var import_cli_spinner = require("cli-spinner");
1570
1686
  async function localSpin({
@@ -1601,10 +1717,16 @@ function spin({
1601
1717
  }
1602
1718
  }
1603
1719
 
1604
- // src/next/commands/dev-command/index.ts
1605
- var DevCommand = class extends import_clipanion.Command {
1720
+ // src/next/commands/baseCommands.ts
1721
+ var BaseCommand = class extends import_clipanion.Command {
1606
1722
  constructor() {
1607
1723
  super(...arguments);
1724
+ this.experimentalDataLayer = import_clipanion.Option.Boolean("--experimentalData", {
1725
+ description: "DEPRECATED - Build the server with additional data querying capabilities"
1726
+ });
1727
+ this.isomorphicGitBridge = import_clipanion.Option.Boolean("--isomorphicGitBridge", {
1728
+ description: "DEPRECATED - Enable Isomorphic Git Bridge Implementation"
1729
+ });
1608
1730
  this.port = import_clipanion.Option.String("-p,--port", "4001", {
1609
1731
  description: "Specify a port to run the server on. (default 4001)"
1610
1732
  });
@@ -1617,21 +1739,9 @@ var DevCommand = class extends import_clipanion.Command {
1617
1739
  this.rootPath = import_clipanion.Option.String("--rootPath", {
1618
1740
  description: "Specify the root directory to run the CLI from (defaults to current working directory)"
1619
1741
  });
1620
- this.watchFolders = import_clipanion.Option.String("-w,--watchFolders", {
1621
- description: "DEPRECATED - a list of folders (relative to where this is being run) that the cli will watch for changes"
1622
- });
1623
- this.isomorphicGitBridge = import_clipanion.Option.Boolean("--isomorphicGitBridge", {
1624
- description: "DEPRECATED - Enable Isomorphic Git Bridge Implementation"
1625
- });
1626
- this.experimentalDataLayer = import_clipanion.Option.Boolean("--experimentalData", {
1627
- description: "DEPRECATED - Build the server with additional data querying capabilities"
1628
- });
1629
1742
  this.verbose = import_clipanion.Option.Boolean("-v,--verbose", false, {
1630
1743
  description: "increase verbosity of logged output"
1631
1744
  });
1632
- this.noWatch = import_clipanion.Option.Boolean("--noWatch", false, {
1633
- description: "Don't regenerate config on file changes"
1634
- });
1635
1745
  this.noSDK = import_clipanion.Option.Boolean("--noSDK", false, {
1636
1746
  description: "DEPRECATED - This should now be set in the config at client.skip = true'. Don't generate the generated client SDK"
1637
1747
  });
@@ -1639,17 +1749,25 @@ var DevCommand = class extends import_clipanion.Command {
1639
1749
  description: "Disable anonymous telemetry that is collected"
1640
1750
  });
1641
1751
  }
1642
- async catch(error) {
1643
- logger.error("Error occured during tinacms dev");
1644
- console.error(error);
1645
- process.exit(1);
1646
- }
1647
- async execute() {
1648
- if (this.watchFolders) {
1649
- logger.warn(
1650
- "--watchFolders has been deprecated, imports from your Tina config file will be watched automatically. If you still need it please open a ticket at https://github.com/tinacms/tinacms/issues"
1651
- );
1752
+ async startSubCommand() {
1753
+ let subProc;
1754
+ if (this.subCommand) {
1755
+ subProc = await startSubprocess2({ command: this.subCommand });
1756
+ logger.info(`Starting subprocess: ${import_chalk4.default.cyan(this.subCommand)}`);
1757
+ }
1758
+ function exitHandler(options, exitCode) {
1759
+ if (subProc) {
1760
+ subProc.kill();
1761
+ }
1762
+ process.exit();
1652
1763
  }
1764
+ process.on("exit", exitHandler);
1765
+ process.on("SIGINT", exitHandler);
1766
+ process.on("SIGUSR1", exitHandler);
1767
+ process.on("SIGUSR2", exitHandler);
1768
+ process.on("uncaughtException", exitHandler);
1769
+ }
1770
+ logDeprecationWarnings() {
1653
1771
  if (this.isomorphicGitBridge) {
1654
1772
  logger.warn("--isomorphicGitBridge has been deprecated");
1655
1773
  }
@@ -1663,11 +1781,63 @@ var DevCommand = class extends import_clipanion.Command {
1663
1781
  "--noSDK has been deprecated, and will be unsupported in a future release. This should be set in the config at client.skip = true"
1664
1782
  );
1665
1783
  }
1784
+ }
1785
+ async indexContentWithSpinner({
1786
+ database,
1787
+ graphQLSchema,
1788
+ tinaSchema
1789
+ }) {
1790
+ const warnings = [];
1791
+ await spin({
1792
+ waitFor: async () => {
1793
+ const res = await database.indexContent({
1794
+ graphQLSchema,
1795
+ tinaSchema
1796
+ });
1797
+ warnings.push(...res.warnings);
1798
+ },
1799
+ text: "Indexing local files"
1800
+ });
1801
+ if (warnings.length > 0) {
1802
+ logger.warn(`Indexing completed with ${warnings.length} warning(s)`);
1803
+ warnings.forEach((warning) => {
1804
+ logger.warn(warnText(`${warning}`));
1805
+ });
1806
+ }
1807
+ }
1808
+ };
1809
+
1810
+ // src/next/commands/dev-command/index.ts
1811
+ var DevCommand = class extends BaseCommand {
1812
+ constructor() {
1813
+ super(...arguments);
1814
+ this.watchFolders = import_clipanion2.Option.String("-w,--watchFolders", {
1815
+ description: "DEPRECATED - a list of folders (relative to where this is being run) that the cli will watch for changes"
1816
+ });
1817
+ this.noWatch = import_clipanion2.Option.Boolean("--noWatch", false, {
1818
+ description: "Don't regenerate config on file changes"
1819
+ });
1820
+ }
1821
+ async catch(error) {
1822
+ logger.error("Error occured during tinacms dev");
1823
+ console.error(error);
1824
+ process.exit(1);
1825
+ }
1826
+ logDeprecationWarnings() {
1827
+ super.logDeprecationWarnings();
1828
+ if (this.watchFolders) {
1829
+ logger.warn(
1830
+ "--watchFolders has been deprecated, imports from your Tina config file will be watched automatically. If you still need it please open a ticket at https://github.com/tinacms/tinacms/issues"
1831
+ );
1832
+ }
1833
+ }
1834
+ async execute() {
1666
1835
  const configManager = new ConfigManager({
1667
1836
  rootPath: this.rootPath,
1668
1837
  legacyNoSDK: this.noSDK
1669
1838
  });
1670
1839
  logger.info("Starting Tina Dev Server");
1840
+ this.logDeprecationWarnings();
1671
1841
  createDBServer(Number(this.datalayerPort));
1672
1842
  let database = null;
1673
1843
  const setup = async ({ firstTime }) => {
@@ -1693,7 +1863,18 @@ var DevCommand = class extends import_clipanion.Command {
1693
1863
  } else {
1694
1864
  database.clearCache();
1695
1865
  }
1696
- const { tinaSchema, graphQLSchema, queryDoc, fragDoc } = await (0, import_graphql8.buildSchema)(database, configManager.config);
1866
+ const { tinaSchema, graphQLSchema, lookup, queryDoc, fragDoc } = await (0, import_graphql8.buildSchema)(configManager.config);
1867
+ const codegen2 = new Codegen({
1868
+ isLocal: true,
1869
+ configManager,
1870
+ port: Number(this.port),
1871
+ queryDoc,
1872
+ fragDoc,
1873
+ graphqlSchemaDoc: graphQLSchema,
1874
+ tinaSchema,
1875
+ lookup
1876
+ });
1877
+ const apiURL2 = await codegen2.execute();
1697
1878
  if (!configManager.isUsingLegacyFolder) {
1698
1879
  delete require.cache[configManager.generatedSchemaJSONPath];
1699
1880
  delete require.cache[configManager.generatedLookupJSONPath];
@@ -1702,7 +1883,7 @@ var DevCommand = class extends import_clipanion.Command {
1702
1883
  const lookupObject = require(configManager.generatedLookupJSONPath);
1703
1884
  const graphqlSchemaObject = require(configManager.generatedGraphQLJSONPath);
1704
1885
  await import_fs_extra4.default.writeFileSync(
1705
- import_path6.default.join(configManager.tinaFolderPath, "tina-lock.json"),
1886
+ import_path7.default.join(configManager.tinaFolderPath, "tina-lock.json"),
1706
1887
  JSON.stringify({
1707
1888
  schema: schemaObject,
1708
1889
  lookup: lookupObject,
@@ -1710,34 +1891,14 @@ var DevCommand = class extends import_clipanion.Command {
1710
1891
  })
1711
1892
  );
1712
1893
  }
1713
- const codegen2 = new Codegen({
1714
- schema: await (0, import_graphql8.getASTSchema)(database),
1715
- configManager,
1716
- port: Number(this.port),
1717
- queryDoc,
1718
- fragDoc
1719
- });
1720
- const apiURL2 = await codegen2.execute();
1721
1894
  if (!this.noWatch) {
1722
1895
  this.watchQueries(configManager, async () => await codegen2.execute());
1723
1896
  }
1724
- const warnings = [];
1725
- await spin({
1726
- waitFor: async () => {
1727
- const res = await database.indexContent({
1728
- graphQLSchema,
1729
- tinaSchema
1730
- });
1731
- warnings.push(...res.warnings);
1732
- },
1733
- text: "Indexing local files"
1897
+ await this.indexContentWithSpinner({
1898
+ database,
1899
+ graphQLSchema,
1900
+ tinaSchema
1734
1901
  });
1735
- if (warnings.length > 0) {
1736
- logger.warn(`Indexing completed with ${warnings.length} warning(s)`);
1737
- warnings.forEach((warning) => {
1738
- logger.warn(warnText(`${warning}`));
1739
- });
1740
- }
1741
1902
  return { apiURL: apiURL2, database };
1742
1903
  };
1743
1904
  const { apiURL } = await setup({ firstTime: true });
@@ -1823,27 +1984,12 @@ var DevCommand = class extends import_clipanion.Command {
1823
1984
  ...summaryItems
1824
1985
  ]
1825
1986
  });
1826
- let subProc;
1827
- if (this.subCommand) {
1828
- subProc = await startSubprocess2({ command: this.subCommand });
1829
- logger.info(`Starting subprocess: ${import_chalk3.default.cyan(this.subCommand)}`);
1830
- }
1831
- function exitHandler(options, exitCode) {
1832
- if (subProc) {
1833
- subProc.kill();
1834
- }
1835
- process.exit();
1836
- }
1837
- process.on("exit", exitHandler);
1838
- process.on("SIGINT", exitHandler);
1839
- process.on("SIGUSR1", exitHandler);
1840
- process.on("SIGUSR2", exitHandler);
1841
- process.on("uncaughtException", exitHandler);
1987
+ await this.startSubCommand();
1842
1988
  }
1843
1989
  watchContentFiles(configManager, database) {
1844
1990
  const collectionContentFiles = [];
1845
1991
  configManager.config.schema.collections.forEach((collection) => {
1846
- const collectionGlob = `${import_path6.default.join(
1992
+ const collectionGlob = `${import_path7.default.join(
1847
1993
  configManager.contentRootPath,
1848
1994
  collection.path
1849
1995
  )}/**/*.${collection.format || "md"}`;
@@ -1880,7 +2026,7 @@ var DevCommand = class extends import_clipanion.Command {
1880
2026
  }
1881
2027
  };
1882
2028
  DevCommand.paths = [["dev"], ["server:start"]];
1883
- DevCommand.usage = import_clipanion.Command.Usage({
2029
+ DevCommand.usage = import_clipanion2.Command.Usage({
1884
2030
  category: `Commands`,
1885
2031
  description: `Builds Tina and starts the dev server`,
1886
2032
  examples: [
@@ -1891,7 +2037,7 @@ DevCommand.usage = import_clipanion.Command.Usage({
1891
2037
 
1892
2038
  // src/next/commands/build-command/index.ts
1893
2039
  var import_node_fetch2 = __toESM(require("node-fetch"));
1894
- var import_clipanion2 = require("clipanion");
2040
+ var import_clipanion3 = require("clipanion");
1895
2041
  var import_progress2 = __toESM(require("progress"));
1896
2042
  var import_fs_extra5 = __toESM(require("fs-extra"));
1897
2043
  var import_graphql9 = require("@tinacms/graphql");
@@ -2031,64 +2177,31 @@ var waitForDB = async (config3, apiUrl, verbose) => {
2031
2177
  };
2032
2178
 
2033
2179
  // src/next/commands/build-command/index.ts
2034
- var BuildCommand = class extends import_clipanion2.Command {
2180
+ var BuildCommand = class extends BaseCommand {
2035
2181
  constructor() {
2036
2182
  super(...arguments);
2037
- this.rootPath = import_clipanion2.Option.String("--rootPath", {
2038
- description: "Specify the root directory to run the CLI from (defaults to current working directory)"
2039
- });
2040
- this.verbose = import_clipanion2.Option.Boolean("-v,--verbose", false, {
2041
- description: "increase verbosity of logged output"
2042
- });
2043
- this.noSDK = import_clipanion2.Option.Boolean("--noSDK", false, {
2044
- description: "DEPRECATED - This should now be set in the config at client.skip = true'. Don't generate the generated client SDK"
2045
- });
2046
- this.datalayerPort = import_clipanion2.Option.String("--datalayer-port", "9000", {
2047
- description: "Specify a port to run the datalayer server on. (default 9000)"
2048
- });
2049
- this.isomorphicGitBridge = import_clipanion2.Option.Boolean("--isomorphicGitBridge", {
2050
- description: "DEPRECATED - Enable Isomorphic Git Bridge Implementation"
2051
- });
2052
- this.localOption = import_clipanion2.Option.Boolean("--local", {
2053
- description: "DEPRECATED: Uses the local file system graphql server"
2054
- });
2055
- this.experimentalDataLayer = import_clipanion2.Option.Boolean("--experimentalData", {
2056
- description: "DEPRECATED - Build the server with additional data querying capabilities"
2183
+ this.localOption = import_clipanion3.Option.Boolean("--local", {
2184
+ description: "Starts local Graphql server and builds the local client instead of production client"
2057
2185
  });
2058
- this.noTelemetry = import_clipanion2.Option.Boolean("--noTelemetry", false, {
2059
- description: "Disable anonymous telemetry that is collected"
2060
- });
2061
- this.tinaGraphQLVersion = import_clipanion2.Option.String("--tina-graphql-version", {
2186
+ this.tinaGraphQLVersion = import_clipanion3.Option.String("--tina-graphql-version", {
2062
2187
  description: "Specify the version of @tinacms/graphql to use (defaults to latest)"
2063
2188
  });
2189
+ this.skipCloudChecks = import_clipanion3.Option.Boolean("--skip-cloud-checks", false, {
2190
+ description: "Skips checking the provided cloud config."
2191
+ });
2064
2192
  }
2065
2193
  async catch(error) {
2066
2194
  console.error(error);
2067
2195
  process.exit(1);
2068
2196
  }
2069
2197
  async execute() {
2198
+ logger.info("Starting Tina build");
2199
+ this.logDeprecationWarnings();
2070
2200
  const configManager = new ConfigManager({
2071
2201
  rootPath: this.rootPath,
2072
2202
  tinaGraphQLVersion: this.tinaGraphQLVersion,
2073
2203
  legacyNoSDK: this.noSDK
2074
2204
  });
2075
- logger.info("Starting Tina build");
2076
- if (this.isomorphicGitBridge) {
2077
- logger.warn("--isomorphicGitBridge has been deprecated");
2078
- }
2079
- if (this.experimentalDataLayer) {
2080
- logger.warn(
2081
- "--experimentalDataLayer has been deprecated, the data layer is now built-in automatically"
2082
- );
2083
- }
2084
- if (this.localOption) {
2085
- logger.warn("--local has been deprecated");
2086
- }
2087
- if (this.noSDK) {
2088
- logger.warn(
2089
- "--noSDK has been deprecated, and will be unsupported in a future release. This should be set in the config at client.skip = true"
2090
- );
2091
- }
2092
2205
  try {
2093
2206
  await configManager.processConfig();
2094
2207
  } catch (e) {
@@ -2096,28 +2209,45 @@ var BuildCommand = class extends import_clipanion2.Command {
2096
2209
  logger.error("Unable to build, please fix your Tina config and try again");
2097
2210
  process.exit(1);
2098
2211
  }
2212
+ let server;
2099
2213
  createDBServer(Number(this.datalayerPort));
2100
2214
  const database = await createAndInitializeDatabase(
2101
2215
  configManager,
2102
2216
  Number(this.datalayerPort)
2103
2217
  );
2104
- const { queryDoc, fragDoc } = await (0, import_graphql9.buildSchema)(
2105
- database,
2106
- configManager.config
2107
- );
2218
+ const { queryDoc, fragDoc, graphQLSchema, tinaSchema, lookup } = await (0, import_graphql9.buildSchema)(configManager.config);
2108
2219
  const codegen2 = new Codegen({
2109
- schema: await (0, import_graphql9.getASTSchema)(database),
2110
2220
  configManager,
2221
+ port: this.localOption ? Number(this.port) : void 0,
2222
+ isLocal: this.localOption,
2111
2223
  queryDoc,
2112
- fragDoc
2224
+ fragDoc,
2225
+ graphqlSchemaDoc: graphQLSchema,
2226
+ tinaSchema,
2227
+ lookup
2113
2228
  });
2114
2229
  const apiURL = await codegen2.execute();
2115
- if (!configManager.hasSelfHostedConfig()) {
2116
- await this.checkClientInfo(configManager, apiURL);
2117
- await waitForDB(configManager.config, apiURL, false);
2118
- await this.checkGraphqlSchema(configManager, database, apiURL);
2230
+ if (this.localOption) {
2231
+ await this.indexContentWithSpinner({
2232
+ database,
2233
+ graphQLSchema,
2234
+ tinaSchema
2235
+ });
2236
+ server = await createDevServer(configManager, database, apiURL, true);
2237
+ await server.listen(Number(this.port));
2238
+ console.log("server listening on port", this.port);
2119
2239
  }
2120
- await buildProductionSpa(configManager, database, apiURL);
2240
+ const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
2241
+ if (!skipCloudChecks) {
2242
+ await this.checkClientInfo(configManager, codegen2.productionUrl);
2243
+ await waitForDB(configManager.config, codegen2.productionUrl, false);
2244
+ await this.checkGraphqlSchema(
2245
+ configManager,
2246
+ database,
2247
+ codegen2.productionUrl
2248
+ );
2249
+ }
2250
+ await buildProductionSpa(configManager, database, codegen2.productionUrl);
2121
2251
  await import_fs_extra5.default.outputFile(
2122
2252
  configManager.outputGitignorePath,
2123
2253
  "index.html\nassets/"
@@ -2155,7 +2285,11 @@ var BuildCommand = class extends import_clipanion2.Command {
2155
2285
  ...summaryItems
2156
2286
  ]
2157
2287
  });
2158
- process.exit();
2288
+ if (this.subCommand) {
2289
+ await this.startSubCommand();
2290
+ } else {
2291
+ process.exit();
2292
+ }
2159
2293
  }
2160
2294
  async checkClientInfo(configManager, apiURL) {
2161
2295
  const { config: config3 } = configManager;
@@ -2284,7 +2418,7 @@ Additional info: Branch: ${config3.branch}, Client ID: ${config3.clientId} `;
2284
2418
  }
2285
2419
  };
2286
2420
  BuildCommand.paths = [["build"]];
2287
- BuildCommand.usage = import_clipanion2.Command.Usage({
2421
+ BuildCommand.usage = import_clipanion3.Command.Usage({
2288
2422
  category: `Commands`,
2289
2423
  description: `Build the CMS and autogenerated modules for usage with Tina Cloud`
2290
2424
  });
@@ -2348,14 +2482,14 @@ var fetchRemoteGraphqlSchema = async ({
2348
2482
  };
2349
2483
 
2350
2484
  // src/next/commands/audit-command/index.ts
2351
- var import_clipanion3 = require("clipanion");
2485
+ var import_clipanion4 = require("clipanion");
2352
2486
  var import_graphql12 = require("@tinacms/graphql");
2353
2487
 
2354
2488
  // src/next/commands/audit-command/audit.ts
2355
2489
  var import_prompts = __toESM(require("prompts"));
2356
2490
  var import_metrics = require("@tinacms/metrics");
2357
2491
  var import_graphql11 = require("@tinacms/graphql");
2358
- var import_chalk4 = __toESM(require("chalk"));
2492
+ var import_chalk5 = __toESM(require("chalk"));
2359
2493
  var audit = async ({
2360
2494
  database,
2361
2495
  clean,
@@ -2373,7 +2507,7 @@ var audit = async ({
2373
2507
  });
2374
2508
  if (clean) {
2375
2509
  logger.info(
2376
- `You are using the \`--clean\` option. This will modify your content as if a user is submitting a form. Before running this you should have a ${import_chalk4.default.bold(
2510
+ `You are using the \`--clean\` option. This will modify your content as if a user is submitting a form. Before running this you should have a ${import_chalk5.default.bold(
2377
2511
  "clean git tree"
2378
2512
  )} so unwanted changes can be undone.
2379
2513
 
@@ -2385,13 +2519,13 @@ var audit = async ({
2385
2519
  message: `Do you want to continue?`
2386
2520
  });
2387
2521
  if (!res.useClean) {
2388
- logger.warn(import_chalk4.default.yellowBright("\u26A0\uFE0F Audit not complete"));
2522
+ logger.warn(import_chalk5.default.yellowBright("\u26A0\uFE0F Audit not complete"));
2389
2523
  process.exit(0);
2390
2524
  }
2391
2525
  }
2392
2526
  if (useDefaultValues && !clean) {
2393
2527
  logger.warn(
2394
- import_chalk4.default.yellowBright(
2528
+ import_chalk5.default.yellowBright(
2395
2529
  "WARNING: using the `--useDefaultValues` without the `--clean` flag has no effect. Please re-run audit and add the `--clean` flag"
2396
2530
  )
2397
2531
  );
@@ -2419,10 +2553,10 @@ var audit = async ({
2419
2553
  }
2420
2554
  if (error) {
2421
2555
  logger.error(
2422
- import_chalk4.default.redBright(`\u203C\uFE0F Audit ${import_chalk4.default.bold("failed")} with errors`)
2556
+ import_chalk5.default.redBright(`\u203C\uFE0F Audit ${import_chalk5.default.bold("failed")} with errors`)
2423
2557
  );
2424
2558
  } else {
2425
- logger.info(import_chalk4.default.greenBright("\u2705 Audit passed"));
2559
+ logger.info(import_chalk5.default.greenBright("\u2705 Audit passed"));
2426
2560
  }
2427
2561
  };
2428
2562
  var auditDocuments = async (args) => {
@@ -2450,10 +2584,10 @@ var auditDocuments = async (args) => {
2450
2584
  if (docResult.errors) {
2451
2585
  error = true;
2452
2586
  docResult.errors.forEach((err) => {
2453
- logger.error(import_chalk4.default.red(err.message));
2587
+ logger.error(import_chalk5.default.red(err.message));
2454
2588
  if (err.originalError.originalError) {
2455
2589
  logger.error(
2456
- import_chalk4.default.red(` ${err.originalError.originalError.message}`)
2590
+ import_chalk5.default.red(` ${err.originalError.originalError.message}`)
2457
2591
  );
2458
2592
  }
2459
2593
  });
@@ -2495,7 +2629,7 @@ var auditDocuments = async (args) => {
2495
2629
  if (mutationRes.errors) {
2496
2630
  mutationRes.errors.forEach((err) => {
2497
2631
  error = true;
2498
- logger.error(import_chalk4.default.red(err.message));
2632
+ logger.error(import_chalk5.default.red(err.message));
2499
2633
  });
2500
2634
  }
2501
2635
  }
@@ -2513,25 +2647,25 @@ function filterObject(obj) {
2513
2647
 
2514
2648
  // src/next/commands/audit-command/index.ts
2515
2649
  var import_graphql13 = require("@tinacms/graphql");
2516
- var AuditCommand = class extends import_clipanion3.Command {
2650
+ var AuditCommand = class extends import_clipanion4.Command {
2517
2651
  constructor() {
2518
2652
  super(...arguments);
2519
- this.rootPath = import_clipanion3.Option.String("--rootPath", {
2653
+ this.rootPath = import_clipanion4.Option.String("--rootPath", {
2520
2654
  description: "Specify the root directory to run the CLI from"
2521
2655
  });
2522
- this.verbose = import_clipanion3.Option.Boolean("-v,--verbose", false, {
2656
+ this.verbose = import_clipanion4.Option.Boolean("-v,--verbose", false, {
2523
2657
  description: "increase verbosity of logged output"
2524
2658
  });
2525
- this.clean = import_clipanion3.Option.Boolean("--clean", false, {
2659
+ this.clean = import_clipanion4.Option.Boolean("--clean", false, {
2526
2660
  description: "Clean the output"
2527
2661
  });
2528
- this.useDefaultValues = import_clipanion3.Option.Boolean("--useDefaultValues", false, {
2662
+ this.useDefaultValues = import_clipanion4.Option.Boolean("--useDefaultValues", false, {
2529
2663
  description: "When cleaning the output, use defaults on the config"
2530
2664
  });
2531
- this.noTelemetry = import_clipanion3.Option.Boolean("--noTelemetry", false, {
2665
+ this.noTelemetry = import_clipanion4.Option.Boolean("--noTelemetry", false, {
2532
2666
  description: "Disable anonymous telemetry that is collected"
2533
2667
  });
2534
- this.datalayerPort = import_clipanion3.Option.String("--datalayer-port", "9000", {
2668
+ this.datalayerPort = import_clipanion4.Option.String("--datalayer-port", "9000", {
2535
2669
  description: "Specify a port to run the datalayer server on. (default 9000)"
2536
2670
  });
2537
2671
  }
@@ -2557,8 +2691,7 @@ var AuditCommand = class extends import_clipanion3.Command {
2557
2691
  Number(this.datalayerPort),
2558
2692
  this.clean ? void 0 : new import_graphql13.AuditFileSystemBridge(configManager.rootPath)
2559
2693
  );
2560
- const { tinaSchema, graphQLSchema } = await (0, import_graphql12.buildSchema)(
2561
- database,
2694
+ const { tinaSchema, graphQLSchema, lookup } = await (0, import_graphql12.buildSchema)(
2562
2695
  configManager.config
2563
2696
  );
2564
2697
  const warnings = [];
@@ -2566,7 +2699,8 @@ var AuditCommand = class extends import_clipanion3.Command {
2566
2699
  waitFor: async () => {
2567
2700
  const res = await database.indexContent({
2568
2701
  graphQLSchema,
2569
- tinaSchema
2702
+ tinaSchema,
2703
+ lookup
2570
2704
  });
2571
2705
  warnings.push(...res.warnings);
2572
2706
  },
@@ -2589,16 +2723,16 @@ var AuditCommand = class extends import_clipanion3.Command {
2589
2723
  }
2590
2724
  };
2591
2725
  AuditCommand.paths = [["audit"]];
2592
- AuditCommand.usage = import_clipanion3.Command.Usage({
2726
+ AuditCommand.usage = import_clipanion4.Command.Usage({
2593
2727
  category: `Commands`,
2594
2728
  description: `Audit config and content files`
2595
2729
  });
2596
2730
 
2597
2731
  // src/next/commands/init-command/index.ts
2598
- var import_clipanion5 = require("clipanion");
2732
+ var import_clipanion6 = require("clipanion");
2599
2733
 
2600
2734
  // src/cmds/init/index.ts
2601
- var import_path10 = __toESM(require("path"));
2735
+ var import_path11 = __toESM(require("path"));
2602
2736
  var import_prettier2 = require("prettier");
2603
2737
  var import_fs_extra9 = __toESM(require("fs-extra"));
2604
2738
  var import_prompts2 = __toESM(require("prompts"));
@@ -2953,14 +3087,14 @@ var configExamples = {
2953
3087
 
2954
3088
  // src/cmds/forestry-migrate/index.ts
2955
3089
  var import_fs_extra7 = __toESM(require("fs-extra"));
2956
- var import_path8 = __toESM(require("path"));
3090
+ var import_path9 = __toESM(require("path"));
2957
3091
  var import_js_yaml2 = __toESM(require("js-yaml"));
2958
3092
  var import_minimatch = __toESM(require("minimatch"));
2959
3093
  var import_graphql14 = require("@tinacms/graphql");
2960
3094
 
2961
3095
  // src/cmds/forestry-migrate/util/index.ts
2962
3096
  var import_fs_extra6 = __toESM(require("fs-extra"));
2963
- var import_path7 = __toESM(require("path"));
3097
+ var import_path8 = __toESM(require("path"));
2964
3098
  var import_js_yaml = __toESM(require("js-yaml"));
2965
3099
  var import_zod = __toESM(require("zod"));
2966
3100
 
@@ -3371,7 +3505,7 @@ var transformForestryFieldsToTinaFields = ({
3371
3505
  return tinaFields;
3372
3506
  };
3373
3507
  var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false }) => {
3374
- const templatePath = import_path7.default.join(
3508
+ const templatePath = import_path8.default.join(
3375
3509
  pathToForestryConfig,
3376
3510
  ".forestry",
3377
3511
  "front_matter",
@@ -3446,8 +3580,8 @@ var generateAllTemplates = async ({
3446
3580
  pathToForestryConfig
3447
3581
  }) => {
3448
3582
  const allTemplates = (await import_fs_extra7.default.readdir(
3449
- import_path8.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
3450
- )).map((tem) => import_path8.default.basename(tem, ".yml"));
3583
+ import_path9.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
3584
+ )).map((tem) => import_path9.default.basename(tem, ".yml"));
3451
3585
  const templateMap = /* @__PURE__ */ new Map();
3452
3586
  const proms = allTemplates.map(async (tem) => {
3453
3587
  try {
@@ -3589,9 +3723,9 @@ var generateCollectionFromForestrySection = (args) => {
3589
3723
  return c;
3590
3724
  } else if (section.type === "document") {
3591
3725
  const filePath = section.path;
3592
- const extname = import_path8.default.extname(filePath);
3593
- const fileName = import_path8.default.basename(filePath, extname);
3594
- const dir = import_path8.default.dirname(filePath);
3726
+ const extname = import_path9.default.extname(filePath);
3727
+ const fileName = import_path9.default.basename(filePath, extname);
3728
+ const dir = import_path9.default.dirname(filePath);
3595
3729
  const ext = checkExt(extname);
3596
3730
  if (ext) {
3597
3731
  const fields = [];
@@ -3654,7 +3788,7 @@ var generateCollections = async ({
3654
3788
  usingTypescript
3655
3789
  });
3656
3790
  const forestryConfig = await import_fs_extra7.default.readFile(
3657
- import_path8.default.join(pathToForestryConfig, ".forestry", "settings.yml")
3791
+ import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
3658
3792
  );
3659
3793
  rewriteTemplateKeysInDocs({
3660
3794
  templateMap,
@@ -3685,11 +3819,11 @@ var rewriteTemplateKeysInDocs = (args) => {
3685
3819
  const { templateObj } = templateMap.get(templateKey);
3686
3820
  (_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
3687
3821
  try {
3688
- const filePath = import_path8.default.join(page);
3822
+ const filePath = import_path9.default.join(page);
3689
3823
  if (import_fs_extra7.default.lstatSync(filePath).isDirectory()) {
3690
3824
  return;
3691
3825
  }
3692
- const extname = import_path8.default.extname(filePath);
3826
+ const extname = import_path9.default.extname(filePath);
3693
3827
  const fileContent = import_fs_extra7.default.readFileSync(filePath).toString();
3694
3828
  const content2 = (0, import_graphql14.parseFile)(
3695
3829
  fileContent,
@@ -3715,16 +3849,16 @@ var rewriteTemplateKeysInDocs = (args) => {
3715
3849
  };
3716
3850
 
3717
3851
  // src/next/commands/codemod-command/index.ts
3718
- var import_clipanion4 = require("clipanion");
3852
+ var import_clipanion5 = require("clipanion");
3719
3853
  var import_fs_extra8 = __toESM(require("fs-extra"));
3720
- var import_path9 = __toESM(require("path"));
3721
- var CodemodCommand = class extends import_clipanion4.Command {
3854
+ var import_path10 = __toESM(require("path"));
3855
+ var CodemodCommand = class extends import_clipanion5.Command {
3722
3856
  constructor() {
3723
3857
  super(...arguments);
3724
- this.rootPath = import_clipanion4.Option.String("--rootPath", {
3858
+ this.rootPath = import_clipanion5.Option.String("--rootPath", {
3725
3859
  description: "Specify the root directory to run the CLI from"
3726
3860
  });
3727
- this.verbose = import_clipanion4.Option.Boolean("-v,--verbose", false, {
3861
+ this.verbose = import_clipanion5.Option.Boolean("-v,--verbose", false, {
3728
3862
  description: "increase verbosity of logged output"
3729
3863
  });
3730
3864
  }
@@ -3749,7 +3883,7 @@ var CodemodCommand = class extends import_clipanion4.Command {
3749
3883
  }
3750
3884
  };
3751
3885
  CodemodCommand.paths = [["codemod"], ["codemod", "move-tina-folder"]];
3752
- CodemodCommand.usage = import_clipanion4.Command.Usage({
3886
+ CodemodCommand.usage = import_clipanion5.Command.Usage({
3753
3887
  category: `Commands`,
3754
3888
  description: `Use codemods for various Tina tasks`
3755
3889
  });
@@ -3761,7 +3895,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
3761
3895
  logger.error(e.message);
3762
3896
  process.exit(1);
3763
3897
  }
3764
- const tinaDestination = import_path9.default.join(configManager.rootPath, "tina");
3898
+ const tinaDestination = import_path10.default.join(configManager.rootPath, "tina");
3765
3899
  if (await import_fs_extra8.default.existsSync(tinaDestination)) {
3766
3900
  logger.info(
3767
3901
  `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.`
@@ -3776,7 +3910,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
3776
3910
  };
3777
3911
  var writeGitignore = async (rootPath) => {
3778
3912
  await import_fs_extra8.default.outputFileSync(
3779
- import_path9.default.join(rootPath, "tina", ".gitignore"),
3913
+ import_path10.default.join(rootPath, "tina", ".gitignore"),
3780
3914
  "__generated__"
3781
3915
  );
3782
3916
  };
@@ -3802,7 +3936,7 @@ async function initStaticTina({
3802
3936
  let templateCode;
3803
3937
  let extraText;
3804
3938
  const hasForestryConfig = await import_fs_extra9.default.pathExists(
3805
- import_path10.default.join(pathToForestryConfig, ".forestry", "settings.yml")
3939
+ import_path11.default.join(pathToForestryConfig, ".forestry", "settings.yml")
3806
3940
  );
3807
3941
  let isForestryMigration = false;
3808
3942
  if (hasForestryConfig) {
@@ -3844,8 +3978,8 @@ async function initStaticTina({
3844
3978
  await addTemplateFile({ baseDir: "", usingTypescript, templateCode });
3845
3979
  }
3846
3980
  await addConfigFile({
3847
- publicFolder: import_path10.default.join(
3848
- import_path10.default.relative(process.cwd(), pathToForestryConfig),
3981
+ publicFolder: import_path11.default.join(
3982
+ import_path11.default.relative(process.cwd(), pathToForestryConfig),
3849
3983
  publicFolder
3850
3984
  ),
3851
3985
  baseDir: "",
@@ -3992,7 +4126,7 @@ ${disclaimer}`
3992
4126
  };
3993
4127
  var getFrontmatterFormat = async (rootPath) => {
3994
4128
  try {
3995
- const hugoConfigPath = import_path10.default.join(rootPath, "config.toml");
4129
+ const hugoConfigPath = import_path11.default.join(rootPath, "config.toml");
3996
4130
  const hugoConfig = await import_fs_extra9.default.readFile(hugoConfigPath, "utf8");
3997
4131
  const frontMatterFormat = hugoConfig.match(/metaDataFormat = "(.*)"/);
3998
4132
  console.log({ frontMatterFormat });
@@ -4040,22 +4174,22 @@ var createPackageJSON = async () => {
4040
4174
  };
4041
4175
  var createGitignore = async ({ baseDir }) => {
4042
4176
  logger.info(logText("No .gitignore found, creating one"));
4043
- await import_fs_extra9.default.outputFileSync(import_path10.default.join(baseDir, ".gitignore"), "node_modules");
4177
+ await import_fs_extra9.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
4044
4178
  };
4045
4179
  var checkGitignoreForNodeModules = async ({
4046
4180
  baseDir
4047
4181
  }) => {
4048
- const gitignoreContent = await import_fs_extra9.default.readFileSync(import_path10.default.join(baseDir, ".gitignore")).toString();
4182
+ const gitignoreContent = await import_fs_extra9.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
4049
4183
  return gitignoreContent.split("\n").some((item) => item === "node_modules");
4050
4184
  };
4051
4185
  var addNodeModulesToGitignore = async ({ baseDir }) => {
4052
4186
  logger.info(logText("Adding node_modules to .gitignore"));
4053
- const gitignoreContent = await import_fs_extra9.default.readFileSync(import_path10.default.join(baseDir, ".gitignore")).toString();
4187
+ const gitignoreContent = await import_fs_extra9.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
4054
4188
  const newGitignoreContent = [
4055
4189
  ...gitignoreContent.split("\n"),
4056
4190
  "node_modules"
4057
4191
  ].join("\n");
4058
- await import_fs_extra9.default.writeFileSync(import_path10.default.join(baseDir, ".gitignore"), newGitignoreContent);
4192
+ await import_fs_extra9.default.writeFileSync(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
4059
4193
  };
4060
4194
  var addDependencies = async (packageManager) => {
4061
4195
  logger.info(logText("Adding dependencies, this might take a moment..."));
@@ -4070,11 +4204,11 @@ var addDependencies = async (packageManager) => {
4070
4204
  };
4071
4205
  var addConfigFile = async (args) => {
4072
4206
  const { baseDir, usingTypescript } = args;
4073
- const configPath = import_path10.default.join(
4207
+ const configPath = import_path11.default.join(
4074
4208
  "tina",
4075
4209
  `config.${usingTypescript ? "ts" : "js"}`
4076
4210
  );
4077
- const fullConfigPath = import_path10.default.join(baseDir, configPath);
4211
+ const fullConfigPath = import_path11.default.join(baseDir, configPath);
4078
4212
  if (import_fs_extra9.default.pathExistsSync(fullConfigPath)) {
4079
4213
  const override = await (0, import_prompts2.default)({
4080
4214
  name: "selection",
@@ -4099,11 +4233,11 @@ var addConfigFile = async (args) => {
4099
4233
  };
4100
4234
  var addTemplateFile = async (args) => {
4101
4235
  const { baseDir, usingTypescript, templateCode } = args;
4102
- const templatesPath = import_path10.default.join(
4236
+ const templatesPath = import_path11.default.join(
4103
4237
  "tina",
4104
4238
  `templates.${usingTypescript ? "ts" : "js"}`
4105
4239
  );
4106
- const fullTemplatesPath = import_path10.default.join(baseDir, templatesPath);
4240
+ const fullTemplatesPath = import_path11.default.join(baseDir, templatesPath);
4107
4241
  if (import_fs_extra9.default.pathExistsSync(fullTemplatesPath)) {
4108
4242
  const override = await (0, import_prompts2.default)({
4109
4243
  name: "selection",
@@ -4122,8 +4256,8 @@ var addTemplateFile = async (args) => {
4122
4256
  }
4123
4257
  };
4124
4258
  var addContentFile = async ({ baseDir }) => {
4125
- const contentPath = import_path10.default.join("content", "posts", "hello-world.md");
4126
- const fullContentPath = import_path10.default.join(baseDir, contentPath);
4259
+ const contentPath = import_path11.default.join("content", "posts", "hello-world.md");
4260
+ const fullContentPath = import_path11.default.join(baseDir, contentPath);
4127
4261
  if (import_fs_extra9.default.pathExistsSync(fullContentPath)) {
4128
4262
  const override = await (0, import_prompts2.default)({
4129
4263
  name: "selection",
@@ -4198,11 +4332,11 @@ var addReactiveFile = {
4198
4332
  baseDir,
4199
4333
  usingTypescript
4200
4334
  }) => {
4201
- const usingSrc = !import_fs_extra9.default.pathExistsSync(import_path10.default.join(baseDir, "pages"));
4202
- const pagesPath = import_path10.default.join(baseDir, usingSrc ? "src" : "", "pages");
4203
- const packageJSONPath = import_path10.default.join(baseDir, "package.json");
4204
- const tinaBlogPagePath = import_path10.default.join(pagesPath, "demo", "blog");
4205
- const tinaBlogPagePathFile = import_path10.default.join(
4335
+ const usingSrc = !import_fs_extra9.default.pathExistsSync(import_path11.default.join(baseDir, "pages"));
4336
+ const pagesPath = import_path11.default.join(baseDir, usingSrc ? "src" : "", "pages");
4337
+ const packageJSONPath = import_path11.default.join(baseDir, "package.json");
4338
+ const tinaBlogPagePath = import_path11.default.join(pagesPath, "demo", "blog");
4339
+ const tinaBlogPagePathFile = import_path11.default.join(
4206
4340
  tinaBlogPagePath,
4207
4341
  `[filename].${usingTypescript ? "tsx" : "js"}`
4208
4342
  );
@@ -4237,16 +4371,16 @@ function execShellCommand(cmd) {
4237
4371
  }
4238
4372
 
4239
4373
  // src/next/commands/init-command/index.ts
4240
- var InitCommand = class extends import_clipanion5.Command {
4374
+ var InitCommand = class extends import_clipanion6.Command {
4241
4375
  constructor() {
4242
4376
  super(...arguments);
4243
- this.pathToForestryConfig = import_clipanion5.Option.String("--forestryPath", {
4377
+ this.pathToForestryConfig = import_clipanion6.Option.String("--forestryPath", {
4244
4378
  description: "Specify the relative path to the .forestry directory, if importing an existing forestry site."
4245
4379
  });
4246
- this.rootPath = import_clipanion5.Option.String("--rootPath", {
4380
+ this.rootPath = import_clipanion6.Option.String("--rootPath", {
4247
4381
  description: "Specify the root directory to run the CLI from (defaults to current working directory)"
4248
4382
  });
4249
- this.noTelemetry = import_clipanion5.Option.Boolean("--noTelemetry", false, {
4383
+ this.noTelemetry = import_clipanion6.Option.Boolean("--noTelemetry", false, {
4250
4384
  description: "Disable anonymous telemetry that is collected"
4251
4385
  });
4252
4386
  }
@@ -4266,13 +4400,13 @@ var InitCommand = class extends import_clipanion5.Command {
4266
4400
  }
4267
4401
  };
4268
4402
  InitCommand.paths = [["init"]];
4269
- InitCommand.usage = import_clipanion5.Command.Usage({
4403
+ InitCommand.usage = import_clipanion6.Command.Usage({
4270
4404
  category: `Commands`,
4271
4405
  description: `Add Tina to an existing project`
4272
4406
  });
4273
4407
 
4274
4408
  // src/index.ts
4275
- var cli = new import_clipanion6.Cli({
4409
+ var cli = new import_clipanion7.Cli({
4276
4410
  binaryName: `tinacms`,
4277
4411
  binaryLabel: `TinaCMS`,
4278
4412
  binaryVersion: version
@@ -4282,9 +4416,9 @@ cli.register(BuildCommand);
4282
4416
  cli.register(AuditCommand);
4283
4417
  cli.register(InitCommand);
4284
4418
  cli.register(CodemodCommand);
4285
- cli.register(import_clipanion6.Builtins.DefinitionsCommand);
4286
- cli.register(import_clipanion6.Builtins.HelpCommand);
4287
- cli.register(import_clipanion6.Builtins.VersionCommand);
4419
+ cli.register(import_clipanion7.Builtins.DefinitionsCommand);
4420
+ cli.register(import_clipanion7.Builtins.HelpCommand);
4421
+ cli.register(import_clipanion7.Builtins.VersionCommand);
4288
4422
  var src_default = cli;
4289
4423
  // Annotate the CommonJS export names for ESM import in node:
4290
4424
  0 && (module.exports = {});