@tinacms/cli 1.5.26 → 1.5.28

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
@@ -31,11 +31,11 @@ module.exports = __toCommonJS(src_exports);
31
31
  var import_clipanion8 = require("clipanion");
32
32
 
33
33
  // package.json
34
- var version = "1.5.26";
34
+ var version = "1.5.28";
35
35
 
36
36
  // src/next/commands/dev-command/index.ts
37
37
  var import_clipanion2 = require("clipanion");
38
- var import_fs_extra5 = __toESM(require("fs-extra"));
38
+ var import_fs_extra6 = __toESM(require("fs-extra"));
39
39
  var import_path7 = __toESM(require("path"));
40
40
  var import_chokidar = __toESM(require("chokidar"));
41
41
  var import_graphql9 = require("@tinacms/graphql");
@@ -582,13 +582,12 @@ var import_vite3 = require("vite");
582
582
 
583
583
  // src/next/vite/index.ts
584
584
  var import_path3 = __toESM(require("path"));
585
+ var import_fs_extra2 = __toESM(require("fs-extra"));
585
586
  var import_vite = require("vite");
586
587
  var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
587
588
 
588
589
  // src/next/vite/tailwind.ts
589
590
  var import_tailwindcss = __toESM(require("tailwindcss"));
590
- var import_postcss_nested = __toESM(require("postcss-nested/index.js"));
591
- var import_nesting = __toESM(require("tailwindcss/nesting/index.js"));
592
591
  var import_defaultTheme = __toESM(require("tailwindcss/defaultTheme.js"));
593
592
  var import_typography = __toESM(require("@tailwindcss/typography"));
594
593
  var import_aspect_ratio = __toESM(require("@tailwindcss/aspect-ratio"));
@@ -600,10 +599,10 @@ var tinaTailwind = (spaPath, prebuildFilePath) => {
600
599
  const plugins = [];
601
600
  const content2 = [
602
601
  import_path2.default.join(spaPath, "src/**/*.{vue,js,ts,jsx,tsx,svelte}"),
603
- prebuildFilePath
602
+ prebuildFilePath,
603
+ require.resolve("tinacms")
604
604
  ];
605
605
  const tw = (0, import_tailwindcss.default)({
606
- important: ".tina-tailwind",
607
606
  theme: {
608
607
  columns: {
609
608
  auto: "auto",
@@ -819,8 +818,6 @@ var tinaTailwind = (spaPath, prebuildFilePath) => {
819
818
  content: content2,
820
819
  plugins: [(0, import_typography.default)({ className: "tina-prose" }), import_aspect_ratio.default]
821
820
  });
822
- plugins.push(import_nesting.default);
823
- plugins.push(import_postcss_nested.default);
824
821
  plugins.push(tw);
825
822
  return {
826
823
  css: {
@@ -835,6 +832,56 @@ var tinaTailwind = (spaPath, prebuildFilePath) => {
835
832
 
836
833
  // src/next/vite/index.ts
837
834
  var import_normalize_path2 = __toESM(require("normalize-path"));
835
+ async function listFilesRecursively({
836
+ directoryPath,
837
+ config: config3,
838
+ roothPath
839
+ }) {
840
+ const fullDirectoryPath = import_path3.default.join(
841
+ roothPath,
842
+ config3.publicFolder,
843
+ directoryPath
844
+ );
845
+ const exists = await import_fs_extra2.default.pathExists(fullDirectoryPath);
846
+ if (!exists) {
847
+ return { "0": [] };
848
+ }
849
+ const items = await import_fs_extra2.default.readdir(fullDirectoryPath);
850
+ const staticMediaItems = [];
851
+ for (const item of items) {
852
+ const itemPath = import_path3.default.join(fullDirectoryPath, item);
853
+ const stats = await import_fs_extra2.default.promises.lstat(itemPath);
854
+ const staticMediaItem = {
855
+ id: item,
856
+ filename: item,
857
+ type: stats.isDirectory() ? "dir" : "file",
858
+ directory: `${directoryPath.replace(config3.mediaRoot, "")}`,
859
+ src: `/${import_path3.default.join(directoryPath, item)}`,
860
+ thumbnails: {
861
+ "75x75": `/${import_path3.default.join(directoryPath, item)}`,
862
+ "400x400": `/${import_path3.default.join(directoryPath, item)}`,
863
+ "1000x1000": `/${import_path3.default.join(directoryPath, item)}`
864
+ }
865
+ };
866
+ if (stats.isDirectory()) {
867
+ staticMediaItem.children = await listFilesRecursively({
868
+ directoryPath: import_path3.default.join(directoryPath, item),
869
+ config: config3,
870
+ roothPath
871
+ });
872
+ }
873
+ staticMediaItems.push(staticMediaItem);
874
+ }
875
+ function chunkArrayIntoObject(array, chunkSize) {
876
+ const result = {};
877
+ for (let i = 0; i < array.length; i += chunkSize) {
878
+ const chunkKey = `${i / chunkSize * 20}`;
879
+ result[chunkKey] = array.slice(i, i + chunkSize);
880
+ }
881
+ return result;
882
+ }
883
+ return chunkArrayIntoObject(staticMediaItems, 20);
884
+ }
838
885
  var createConfig = async ({
839
886
  configManager,
840
887
  database,
@@ -843,7 +890,7 @@ var createConfig = async ({
843
890
  noWatch,
844
891
  rollupOptions
845
892
  }) => {
846
- var _a, _b, _c;
893
+ var _a, _b, _c, _d, _e, _f;
847
894
  const publicEnv = {};
848
895
  Object.keys(process.env).forEach((key) => {
849
896
  if (key.startsWith("TINA_PUBLIC_") || key.startsWith("NEXT_PUBLIC_") || key === "NODE_ENV" || key === "HEAD") {
@@ -861,9 +908,24 @@ var createConfig = async ({
861
908
  }
862
909
  }
863
910
  });
911
+ const staticMediaPath = import_path3.default.join(
912
+ configManager.generatedFolderPath,
913
+ "static-media.json"
914
+ );
915
+ if ((_b = (_a = configManager.config.media) == null ? void 0 : _a.tina) == null ? void 0 : _b.static) {
916
+ const staticMedia = await listFilesRecursively({
917
+ directoryPath: ((_c = configManager.config.media.tina) == null ? void 0 : _c.mediaRoot) || "",
918
+ config: configManager.config.media.tina,
919
+ roothPath: configManager.rootPath
920
+ });
921
+ await import_fs_extra2.default.outputFile(staticMediaPath, JSON.stringify(staticMedia, null, 2));
922
+ } else {
923
+ await import_fs_extra2.default.outputFile(staticMediaPath, `[]`);
924
+ }
864
925
  const alias = {
865
926
  TINA_IMPORT: configManager.prebuildFilePath,
866
- SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath
927
+ SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath,
928
+ STATIC_MEDIA_IMPORT: staticMediaPath
867
929
  };
868
930
  if (configManager.shouldSkipSDK()) {
869
931
  alias["CLIENT_IMPORT"] = import_path3.default.join(
@@ -886,7 +948,7 @@ var createConfig = async ({
886
948
  appType: "spa",
887
949
  resolve: {
888
950
  alias,
889
- dedupe: ["graphql", "tinacms", "@tinacms/toolkit", "react", "react-dom"]
951
+ dedupe: ["graphql", "tinacms", "react", "react-dom"]
890
952
  },
891
953
  define: {
892
954
  "process.env": `new Object(${JSON.stringify(publicEnv)})`,
@@ -901,7 +963,7 @@ var createConfig = async ({
901
963
  include: ["react/jsx-runtime", "react/jsx-dev-runtime"]
902
964
  },
903
965
  server: {
904
- host: (_c = (_b = (_a = configManager.config) == null ? void 0 : _a.build) == null ? void 0 : _b.host) != null ? _c : false,
966
+ host: (_f = (_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.host) != null ? _f : false,
905
967
  watch: noWatch ? {
906
968
  ignored: ["**/*"]
907
969
  } : {
@@ -944,7 +1006,7 @@ var import_cors = __toESM(require("cors"));
944
1006
  var import_graphql = require("@tinacms/graphql");
945
1007
 
946
1008
  // src/next/commands/dev-command/server/media.ts
947
- var import_fs_extra2 = __toESM(require("fs-extra"));
1009
+ var import_fs_extra3 = __toESM(require("fs-extra"));
948
1010
  var import_path4 = __toESM(require("path"));
949
1011
  var import_busboy = __toESM(require("busboy"));
950
1012
  var createMediaRouter = (config3) => {
@@ -977,8 +1039,8 @@ var createMediaRouter = (config3) => {
977
1039
  var _a;
978
1040
  const fullPath = decodeURI((_a = req.url) == null ? void 0 : _a.slice("/media/upload/".length));
979
1041
  const saveTo = import_path4.default.join(mediaFolder, ...fullPath.split("/"));
980
- await import_fs_extra2.default.ensureDir(import_path4.default.dirname(saveTo));
981
- file.pipe(import_fs_extra2.default.createWriteStream(saveTo));
1042
+ await import_fs_extra3.default.ensureDir(import_path4.default.dirname(saveTo));
1043
+ file.pipe(import_fs_extra3.default.createWriteStream(saveTo));
982
1044
  });
983
1045
  bb.on("error", (error) => {
984
1046
  res.statusCode = 500;
@@ -1019,16 +1081,16 @@ var MediaModel = class {
1019
1081
  args.searchPath
1020
1082
  );
1021
1083
  const searchPath = parseMediaFolder(args.searchPath);
1022
- if (!await import_fs_extra2.default.pathExists(folderPath)) {
1084
+ if (!await import_fs_extra3.default.pathExists(folderPath)) {
1023
1085
  return {
1024
1086
  files: [],
1025
1087
  directories: []
1026
1088
  };
1027
1089
  }
1028
- const filesStr = await import_fs_extra2.default.readdir(folderPath);
1090
+ const filesStr = await import_fs_extra3.default.readdir(folderPath);
1029
1091
  const filesProm = filesStr.map(async (file) => {
1030
1092
  const filePath = (0, import_path4.join)(folderPath, file);
1031
- const stat = await import_fs_extra2.default.stat(filePath);
1093
+ const stat = await import_fs_extra3.default.stat(filePath);
1032
1094
  let src = `/${file}`;
1033
1095
  const isFile = stat.isFile();
1034
1096
  if (!isFile) {
@@ -1090,8 +1152,8 @@ var MediaModel = class {
1090
1152
  this.mediaRoot,
1091
1153
  args.searchPath
1092
1154
  );
1093
- await import_fs_extra2.default.stat(file);
1094
- await import_fs_extra2.default.remove(file);
1155
+ await import_fs_extra3.default.stat(file);
1156
+ await import_fs_extra3.default.remove(file);
1095
1157
  return { ok: true };
1096
1158
  } catch (error) {
1097
1159
  console.error(error);
@@ -1294,7 +1356,7 @@ var createDevServer = async (configManager, database, searchIndex, apiURL, noWat
1294
1356
  };
1295
1357
 
1296
1358
  // src/next/codegen/index.ts
1297
- var import_fs_extra3 = __toESM(require("fs-extra"));
1359
+ var import_fs_extra4 = __toESM(require("fs-extra"));
1298
1360
  var import_path6 = __toESM(require("path"));
1299
1361
  var import_graphql6 = require("graphql");
1300
1362
 
@@ -1308,36 +1370,55 @@ var AddGeneratedClientFunc = (apiURL) => {
1308
1370
  // TinaSDK generated code
1309
1371
  import { createClient, TinaClient } from "tinacms/dist/client";
1310
1372
 
1311
- const generateRequester = (client: TinaClient) => {
1373
+ const generateRequester = (
1374
+ client: TinaClient,
1375
+ options?: { branch?: string }
1376
+ ) => {
1312
1377
  const requester: (
1313
1378
  doc: any,
1314
1379
  vars?: any,
1315
- options?: any,
1380
+ options?: { branch?: string },
1316
1381
  client
1317
- ) => Promise<any> = async (doc, vars, _options) => {
1382
+ ) => Promise<any> = async (doc, vars, options) => {
1383
+ let url = client.apiUrl
1384
+ if (options?.branch) {
1385
+ const index = client.apiUrl.lastIndexOf('/')
1386
+ url = client.apiUrl.substring(0, index + 1) + options.branch
1387
+ }
1318
1388
  const data = await client.request({
1319
1389
  query: doc,
1320
1390
  variables: vars,
1321
- });
1391
+ url,
1392
+ })
1322
1393
 
1323
- return { data: data?.data, query: doc, variables: vars || {} };
1324
- };
1394
+ return { data: data?.data, query: doc, variables: vars || {} }
1395
+ }
1325
1396
 
1326
- return requester;
1327
- };
1397
+ return requester
1398
+ }
1328
1399
 
1329
1400
  /**
1330
1401
  * @experimental this class can be used but may change in the future
1331
1402
  **/
1332
1403
  export const ExperimentalGetTinaClient = () =>
1333
1404
  getSdk(
1334
- generateRequester(createClient({ url: "${apiURL}", queries }))
1335
- );
1405
+ generateRequester(
1406
+ createClient({
1407
+ url: "${apiURL}",
1408
+ queries,
1409
+ })
1410
+ )
1411
+ )
1336
1412
 
1337
- export const queries = (client: TinaClient) => {
1338
- const requester = generateRequester(client);
1339
- return getSdk(requester);
1340
- };
1413
+ export const queries = (
1414
+ client: TinaClient,
1415
+ options?: {
1416
+ branch?: string
1417
+ }
1418
+ ) => {
1419
+ const requester = generateRequester(client, options)
1420
+ return getSdk(requester)
1421
+ }
1341
1422
  `;
1342
1423
  };
1343
1424
  };
@@ -1516,15 +1597,15 @@ var Codegen = class {
1516
1597
  }
1517
1598
  async writeConfigFile(fileName, data) {
1518
1599
  const filePath = import_path6.default.join(this.configManager.generatedFolderPath, fileName);
1519
- await import_fs_extra3.default.ensureFile(filePath);
1520
- await import_fs_extra3.default.outputFile(filePath, data);
1600
+ await import_fs_extra4.default.ensureFile(filePath);
1601
+ await import_fs_extra4.default.outputFile(filePath, data);
1521
1602
  if (this.configManager.hasSeparateContentRoot()) {
1522
1603
  const filePath2 = import_path6.default.join(
1523
1604
  this.configManager.generatedFolderPathContentRepo,
1524
1605
  fileName
1525
1606
  );
1526
- await import_fs_extra3.default.ensureFile(filePath2);
1527
- await import_fs_extra3.default.outputFile(filePath2, data);
1607
+ await import_fs_extra4.default.ensureFile(filePath2);
1608
+ await import_fs_extra4.default.outputFile(filePath2, data);
1528
1609
  }
1529
1610
  }
1530
1611
  async removeGeneratedFilesIfExists() {
@@ -1554,27 +1635,27 @@ var Codegen = class {
1554
1635
  await this.removeGeneratedFilesIfExists();
1555
1636
  return apiURL;
1556
1637
  }
1557
- await import_fs_extra3.default.outputFile(
1638
+ await import_fs_extra4.default.outputFile(
1558
1639
  this.configManager.generatedQueriesFilePath,
1559
1640
  this.queryDoc
1560
1641
  );
1561
- await import_fs_extra3.default.outputFile(
1642
+ await import_fs_extra4.default.outputFile(
1562
1643
  this.configManager.generatedFragmentsFilePath,
1563
1644
  this.fragDoc
1564
1645
  );
1565
1646
  await maybeWarnFragmentSize(this.configManager.generatedFragmentsFilePath);
1566
1647
  const { clientString } = await this.genClient();
1567
1648
  const { codeString, schemaString } = await this.genTypes();
1568
- await import_fs_extra3.default.outputFile(
1649
+ await import_fs_extra4.default.outputFile(
1569
1650
  this.configManager.generatedGraphQLGQLPath,
1570
1651
  schemaString
1571
1652
  );
1572
1653
  if (this.configManager.isUsingTs()) {
1573
- await import_fs_extra3.default.outputFile(
1654
+ await import_fs_extra4.default.outputFile(
1574
1655
  this.configManager.generatedTypesTSFilePath,
1575
1656
  codeString
1576
1657
  );
1577
- await import_fs_extra3.default.outputFile(
1658
+ await import_fs_extra4.default.outputFile(
1578
1659
  this.configManager.generatedClientTSFilePath,
1579
1660
  clientString
1580
1661
  );
@@ -1582,16 +1663,16 @@ var Codegen = class {
1582
1663
  await unlinkIfExists(this.configManager.generatedTypesDFilePath);
1583
1664
  await unlinkIfExists(this.configManager.generatedTypesJSFilePath);
1584
1665
  } else {
1585
- await import_fs_extra3.default.outputFile(
1666
+ await import_fs_extra4.default.outputFile(
1586
1667
  this.configManager.generatedTypesDFilePath,
1587
1668
  codeString
1588
1669
  );
1589
1670
  const jsCode = await (0, import_esbuild2.transform)(codeString, { loader: "ts" });
1590
- await import_fs_extra3.default.outputFile(
1671
+ await import_fs_extra4.default.outputFile(
1591
1672
  this.configManager.generatedTypesJSFilePath,
1592
1673
  jsCode.code
1593
1674
  );
1594
- await import_fs_extra3.default.outputFile(
1675
+ await import_fs_extra4.default.outputFile(
1595
1676
  this.configManager.generatedClientJSFilePath,
1596
1677
  clientString
1597
1678
  );
@@ -1676,7 +1757,7 @@ schema {
1676
1757
  }
1677
1758
  };
1678
1759
  var maybeWarnFragmentSize = async (filepath) => {
1679
- if (await (await import_fs_extra3.default.stat(filepath)).size > 100 * 1024) {
1760
+ if (await (await import_fs_extra4.default.stat(filepath)).size > 100 * 1024) {
1680
1761
  console.warn(
1681
1762
  "Warning: frags.gql is very large (>100kb). Consider setting the reference depth to 1 or 0. See code snippet below."
1682
1763
  );
@@ -1693,8 +1774,8 @@ var maybeWarnFragmentSize = async (filepath) => {
1693
1774
  }
1694
1775
  };
1695
1776
  var unlinkIfExists = async (filepath) => {
1696
- if (await import_fs_extra3.default.existsSync(filepath)) {
1697
- await import_fs_extra3.default.unlinkSync(filepath);
1777
+ if (await import_fs_extra4.default.existsSync(filepath)) {
1778
+ await import_fs_extra4.default.unlinkSync(filepath);
1698
1779
  }
1699
1780
  };
1700
1781
 
@@ -1825,7 +1906,7 @@ function spin({
1825
1906
 
1826
1907
  // src/next/commands/baseCommands.ts
1827
1908
  var import_graphql8 = require("@tinacms/graphql");
1828
- var import_fs_extra4 = __toESM(require("fs-extra"));
1909
+ var import_fs_extra5 = __toESM(require("fs-extra"));
1829
1910
  var BaseCommand = class extends import_clipanion.Command {
1830
1911
  constructor() {
1831
1912
  super(...arguments);
@@ -1909,7 +1990,7 @@ var BaseCommand = class extends import_clipanion.Command {
1909
1990
  const rootPath = configManager.rootPath;
1910
1991
  let sha;
1911
1992
  try {
1912
- sha = await (0, import_graphql8.getSha)({ fs: import_fs_extra4.default, dir: rootPath });
1993
+ sha = await (0, import_graphql8.getSha)({ fs: import_fs_extra5.default, dir: rootPath });
1913
1994
  } catch (e) {
1914
1995
  if (partialReindex) {
1915
1996
  console.error(
@@ -1933,7 +2014,7 @@ var BaseCommand = class extends import_clipanion.Command {
1933
2014
  };
1934
2015
  }
1935
2016
  const { added, modified, deleted } = await (0, import_graphql8.getChangedFiles)({
1936
- fs: import_fs_extra4.default,
2017
+ fs: import_fs_extra5.default,
1937
2018
  dir: rootPath,
1938
2019
  from: lastSha,
1939
2020
  to: sha,
@@ -2047,7 +2128,7 @@ var DevCommand = class extends BaseCommand {
2047
2128
  const schemaObject = require(configManager.generatedSchemaJSONPath);
2048
2129
  const lookupObject = require(configManager.generatedLookupJSONPath);
2049
2130
  const graphqlSchemaObject = require(configManager.generatedGraphQLJSONPath);
2050
- await import_fs_extra5.default.writeFileSync(
2131
+ await import_fs_extra6.default.writeFileSync(
2051
2132
  import_path7.default.join(configManager.tinaFolderPath, "tina-lock.json"),
2052
2133
  JSON.stringify({
2053
2134
  schema: schemaObject,
@@ -2089,8 +2170,8 @@ var DevCommand = class extends BaseCommand {
2089
2170
  const { apiURL, graphQLSchema, tinaSchema } = await setup({
2090
2171
  firstTime: true
2091
2172
  });
2092
- await import_fs_extra5.default.outputFile(configManager.outputHTMLFilePath, devHTML(this.port));
2093
- await import_fs_extra5.default.outputFile(
2173
+ await import_fs_extra6.default.outputFile(configManager.outputHTMLFilePath, devHTML(this.port));
2174
+ await import_fs_extra6.default.outputFile(
2094
2175
  configManager.outputGitignorePath,
2095
2176
  "index.html\nassets/"
2096
2177
  );
@@ -2254,7 +2335,7 @@ DevCommand.usage = import_clipanion2.Command.Usage({
2254
2335
  var import_node_fetch2 = __toESM(require("node-fetch"));
2255
2336
  var import_clipanion3 = require("clipanion");
2256
2337
  var import_progress2 = __toESM(require("progress"));
2257
- var import_fs_extra6 = __toESM(require("fs-extra"));
2338
+ var import_fs_extra7 = __toESM(require("fs-extra"));
2258
2339
  var import_graphql10 = require("@tinacms/graphql");
2259
2340
 
2260
2341
  // src/next/commands/build-command/server.ts
@@ -2486,7 +2567,7 @@ var BuildCommand = class extends BaseCommand {
2486
2567
  );
2487
2568
  }
2488
2569
  await buildProductionSpa(configManager, database, codegen2.productionUrl);
2489
- await import_fs_extra6.default.outputFile(
2570
+ await import_fs_extra7.default.outputFile(
2490
2571
  configManager.outputGitignorePath,
2491
2572
  "index.html\nassets/"
2492
2573
  );
@@ -3044,7 +3125,7 @@ var import_clipanion6 = require("clipanion");
3044
3125
  // src/cmds/init/index.ts
3045
3126
  var import_path11 = __toESM(require("path"));
3046
3127
  var import_prettier2 = require("prettier");
3047
- var import_fs_extra10 = __toESM(require("fs-extra"));
3128
+ var import_fs_extra11 = __toESM(require("fs-extra"));
3048
3129
  var import_prompts2 = __toESM(require("prompts"));
3049
3130
  var import_metrics2 = require("@tinacms/metrics");
3050
3131
 
@@ -3396,14 +3477,14 @@ var configExamples = {
3396
3477
  };
3397
3478
 
3398
3479
  // src/cmds/forestry-migrate/index.ts
3399
- var import_fs_extra8 = __toESM(require("fs-extra"));
3480
+ var import_fs_extra9 = __toESM(require("fs-extra"));
3400
3481
  var import_path9 = __toESM(require("path"));
3401
3482
  var import_js_yaml2 = __toESM(require("js-yaml"));
3402
3483
  var import_minimatch = __toESM(require("minimatch"));
3403
3484
  var import_graphql15 = require("@tinacms/graphql");
3404
3485
 
3405
3486
  // src/cmds/forestry-migrate/util/index.ts
3406
- var import_fs_extra7 = __toESM(require("fs-extra"));
3487
+ var import_fs_extra8 = __toESM(require("fs-extra"));
3407
3488
  var import_path8 = __toESM(require("path"));
3408
3489
  var import_js_yaml = __toESM(require("js-yaml"));
3409
3490
  var import_zod = __toESM(require("zod"));
@@ -3824,7 +3905,7 @@ var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false })
3824
3905
  );
3825
3906
  let templateString = "";
3826
3907
  try {
3827
- templateString = import_fs_extra7.default.readFileSync(templatePath).toString();
3908
+ templateString = import_fs_extra8.default.readFileSync(templatePath).toString();
3828
3909
  } catch {
3829
3910
  throw new Error(
3830
3911
  `Could not find template ${tem} at ${templatePath}
@@ -3889,7 +3970,7 @@ function checkExt(ext) {
3889
3970
  var generateAllTemplates = async ({
3890
3971
  pathToForestryConfig
3891
3972
  }) => {
3892
- const allTemplates = (await import_fs_extra8.default.readdir(
3973
+ const allTemplates = (await import_fs_extra9.default.readdir(
3893
3974
  import_path9.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
3894
3975
  )).map((tem) => import_path9.default.basename(tem, ".yml"));
3895
3976
  const templateMap = /* @__PURE__ */ new Map();
@@ -4097,7 +4178,7 @@ var generateCollections = async ({
4097
4178
  templateMap,
4098
4179
  usingTypescript
4099
4180
  });
4100
- const forestryConfig = await import_fs_extra8.default.readFile(
4181
+ const forestryConfig = await import_fs_extra9.default.readFile(
4101
4182
  import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
4102
4183
  );
4103
4184
  rewriteTemplateKeysInDocs({
@@ -4130,11 +4211,11 @@ var rewriteTemplateKeysInDocs = (args) => {
4130
4211
  (_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
4131
4212
  try {
4132
4213
  const filePath = import_path9.default.join(page);
4133
- if (import_fs_extra8.default.lstatSync(filePath).isDirectory()) {
4214
+ if (import_fs_extra9.default.lstatSync(filePath).isDirectory()) {
4134
4215
  return;
4135
4216
  }
4136
4217
  const extname = import_path9.default.extname(filePath);
4137
- const fileContent = import_fs_extra8.default.readFileSync(filePath).toString();
4218
+ const fileContent = import_fs_extra9.default.readFileSync(filePath).toString();
4138
4219
  const content2 = (0, import_graphql15.parseFile)(
4139
4220
  fileContent,
4140
4221
  extname,
@@ -4145,7 +4226,7 @@ var rewriteTemplateKeysInDocs = (args) => {
4145
4226
  _template: stringifyLabel(templateKey),
4146
4227
  ...content2
4147
4228
  };
4148
- import_fs_extra8.default.writeFileSync(
4229
+ import_fs_extra9.default.writeFileSync(
4149
4230
  filePath,
4150
4231
  (0, import_graphql15.stringifyFile)(newContent, extname, true, markdownParseConfig)
4151
4232
  );
@@ -4160,7 +4241,7 @@ var rewriteTemplateKeysInDocs = (args) => {
4160
4241
 
4161
4242
  // src/next/commands/codemod-command/index.ts
4162
4243
  var import_clipanion5 = require("clipanion");
4163
- var import_fs_extra9 = __toESM(require("fs-extra"));
4244
+ var import_fs_extra10 = __toESM(require("fs-extra"));
4164
4245
  var import_path10 = __toESM(require("path"));
4165
4246
  var CodemodCommand = class extends import_clipanion5.Command {
4166
4247
  constructor() {
@@ -4206,12 +4287,12 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
4206
4287
  process.exit(1);
4207
4288
  }
4208
4289
  const tinaDestination = import_path10.default.join(configManager.rootPath, "tina");
4209
- if (await import_fs_extra9.default.existsSync(tinaDestination)) {
4290
+ if (await import_fs_extra10.default.existsSync(tinaDestination)) {
4210
4291
  logger.info(
4211
4292
  `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.`
4212
4293
  );
4213
4294
  } else {
4214
- await import_fs_extra9.default.moveSync(configManager.tinaFolderPath, tinaDestination);
4295
+ await import_fs_extra10.default.moveSync(configManager.tinaFolderPath, tinaDestination);
4215
4296
  await writeGitignore(configManager.rootPath);
4216
4297
  logger.info(
4217
4298
  "Move to 'tina' folder complete. Be sure to update any imports of the autogenerated client!"
@@ -4219,7 +4300,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
4219
4300
  }
4220
4301
  };
4221
4302
  var writeGitignore = async (rootPath) => {
4222
- await import_fs_extra9.default.outputFileSync(
4303
+ await import_fs_extra10.default.outputFileSync(
4223
4304
  import_path10.default.join(rootPath, "tina", ".gitignore"),
4224
4305
  "__generated__"
4225
4306
  );
@@ -4245,7 +4326,7 @@ async function initStaticTina({
4245
4326
  let collections;
4246
4327
  let templateCode;
4247
4328
  let extraText;
4248
- const hasForestryConfig = await import_fs_extra10.default.pathExists(
4329
+ const hasForestryConfig = await import_fs_extra11.default.pathExists(
4249
4330
  import_path11.default.join(pathToForestryConfig, ".forestry", "settings.yml")
4250
4331
  );
4251
4332
  let isForestryMigration = false;
@@ -4268,11 +4349,11 @@ async function initStaticTina({
4268
4349
  hasForestryConfig,
4269
4350
  noTelemetry
4270
4351
  });
4271
- const hasPackageJSON = await import_fs_extra10.default.pathExistsSync("package.json");
4352
+ const hasPackageJSON = await import_fs_extra11.default.pathExistsSync("package.json");
4272
4353
  if (!hasPackageJSON) {
4273
4354
  await createPackageJSON();
4274
4355
  }
4275
- const hasGitignore = await import_fs_extra10.default.pathExistsSync(".gitignore");
4356
+ const hasGitignore = await import_fs_extra11.default.pathExistsSync(".gitignore");
4276
4357
  if (!hasGitignore) {
4277
4358
  await createGitignore({ baseDir: "" });
4278
4359
  } else {
@@ -4437,7 +4518,7 @@ ${disclaimer}`
4437
4518
  var getFrontmatterFormat = async (rootPath) => {
4438
4519
  try {
4439
4520
  const hugoConfigPath = import_path11.default.join(rootPath, "config.toml");
4440
- const hugoConfig = await import_fs_extra10.default.readFile(hugoConfigPath, "utf8");
4521
+ const hugoConfig = await import_fs_extra11.default.readFile(hugoConfigPath, "utf8");
4441
4522
  const frontMatterFormat = hugoConfig.match(/metaDataFormat = "(.*)"/);
4442
4523
  console.log({ frontMatterFormat });
4443
4524
  if (frontMatterFormat && frontMatterFormat[1]) {
@@ -4484,22 +4565,22 @@ var createPackageJSON = async () => {
4484
4565
  };
4485
4566
  var createGitignore = async ({ baseDir }) => {
4486
4567
  logger.info(logText("No .gitignore found, creating one"));
4487
- await import_fs_extra10.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
4568
+ await import_fs_extra11.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
4488
4569
  };
4489
4570
  var checkGitignoreForNodeModules = async ({
4490
4571
  baseDir
4491
4572
  }) => {
4492
- const gitignoreContent = await import_fs_extra10.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
4573
+ const gitignoreContent = await import_fs_extra11.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
4493
4574
  return gitignoreContent.split("\n").some((item) => item === "node_modules");
4494
4575
  };
4495
4576
  var addNodeModulesToGitignore = async ({ baseDir }) => {
4496
4577
  logger.info(logText("Adding node_modules to .gitignore"));
4497
- const gitignoreContent = await import_fs_extra10.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
4578
+ const gitignoreContent = await import_fs_extra11.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
4498
4579
  const newGitignoreContent = [
4499
4580
  ...gitignoreContent.split("\n"),
4500
4581
  "node_modules"
4501
4582
  ].join("\n");
4502
- await import_fs_extra10.default.writeFileSync(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
4583
+ await import_fs_extra11.default.writeFileSync(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
4503
4584
  };
4504
4585
  var addDependencies = async (packageManager) => {
4505
4586
  logger.info(logText("Adding dependencies, this might take a moment..."));
@@ -4519,7 +4600,7 @@ var addConfigFile = async (args) => {
4519
4600
  `config.${usingTypescript ? "ts" : "js"}`
4520
4601
  );
4521
4602
  const fullConfigPath = import_path11.default.join(baseDir, configPath);
4522
- if (import_fs_extra10.default.pathExistsSync(fullConfigPath)) {
4603
+ if (import_fs_extra11.default.pathExistsSync(fullConfigPath)) {
4523
4604
  const override = await (0, import_prompts2.default)({
4524
4605
  name: "selection",
4525
4606
  type: "confirm",
@@ -4527,7 +4608,7 @@ var addConfigFile = async (args) => {
4527
4608
  });
4528
4609
  if (override["selection"]) {
4529
4610
  logger.info(logText(`Overriding file at ${configPath}.`));
4530
- await import_fs_extra10.default.outputFileSync(fullConfigPath, config2(args));
4611
+ await import_fs_extra11.default.outputFileSync(fullConfigPath, config2(args));
4531
4612
  } else {
4532
4613
  logger.info(logText(`Not overriding file at ${configPath}.`));
4533
4614
  }
@@ -4537,7 +4618,7 @@ var addConfigFile = async (args) => {
4537
4618
  `Adding config file at tina/config.${usingTypescript ? "ts" : "js"}`
4538
4619
  )
4539
4620
  );
4540
- await import_fs_extra10.default.outputFileSync(fullConfigPath, config2(args));
4621
+ await import_fs_extra11.default.outputFileSync(fullConfigPath, config2(args));
4541
4622
  await writeGitignore(baseDir);
4542
4623
  }
4543
4624
  };
@@ -4548,7 +4629,7 @@ var addTemplateFile = async (args) => {
4548
4629
  `templates.${usingTypescript ? "ts" : "js"}`
4549
4630
  );
4550
4631
  const fullTemplatesPath = import_path11.default.join(baseDir, templatesPath);
4551
- if (import_fs_extra10.default.pathExistsSync(fullTemplatesPath)) {
4632
+ if (import_fs_extra11.default.pathExistsSync(fullTemplatesPath)) {
4552
4633
  const override = await (0, import_prompts2.default)({
4553
4634
  name: "selection",
4554
4635
  type: "confirm",
@@ -4556,19 +4637,19 @@ var addTemplateFile = async (args) => {
4556
4637
  });
4557
4638
  if (override["selection"]) {
4558
4639
  logger.info(logText(`Overriding file at ${templatesPath}.`));
4559
- await import_fs_extra10.default.outputFileSync(fullTemplatesPath, templateCode);
4640
+ await import_fs_extra11.default.outputFileSync(fullTemplatesPath, templateCode);
4560
4641
  } else {
4561
4642
  logger.info(logText(`Not overriding file at ${templatesPath}.`));
4562
4643
  }
4563
4644
  } else {
4564
4645
  logger.info(logText(`Adding template file at ${templatesPath}`));
4565
- await import_fs_extra10.default.outputFileSync(fullTemplatesPath, templateCode);
4646
+ await import_fs_extra11.default.outputFileSync(fullTemplatesPath, templateCode);
4566
4647
  }
4567
4648
  };
4568
4649
  var addContentFile = async ({ baseDir }) => {
4569
4650
  const contentPath = import_path11.default.join("content", "posts", "hello-world.md");
4570
4651
  const fullContentPath = import_path11.default.join(baseDir, contentPath);
4571
- if (import_fs_extra10.default.pathExistsSync(fullContentPath)) {
4652
+ if (import_fs_extra11.default.pathExistsSync(fullContentPath)) {
4572
4653
  const override = await (0, import_prompts2.default)({
4573
4654
  name: "selection",
4574
4655
  type: "confirm",
@@ -4576,13 +4657,13 @@ var addContentFile = async ({ baseDir }) => {
4576
4657
  });
4577
4658
  if (override["selection"]) {
4578
4659
  logger.info(logText(`Overriding file at ${contentPath}.`));
4579
- await import_fs_extra10.default.outputFileSync(fullContentPath, content);
4660
+ await import_fs_extra11.default.outputFileSync(fullContentPath, content);
4580
4661
  } else {
4581
4662
  logger.info(logText(`Not overriding file at ${contentPath}.`));
4582
4663
  }
4583
4664
  } else {
4584
4665
  logger.info(logText(`Adding content file at ${contentPath}`));
4585
- await import_fs_extra10.default.outputFileSync(fullContentPath, content);
4666
+ await import_fs_extra11.default.outputFileSync(fullContentPath, content);
4586
4667
  }
4587
4668
  };
4588
4669
  var logNextSteps = ({
@@ -4642,7 +4723,7 @@ var addReactiveFile = {
4642
4723
  baseDir,
4643
4724
  usingTypescript
4644
4725
  }) => {
4645
- const usingSrc = !import_fs_extra10.default.pathExistsSync(import_path11.default.join(baseDir, "pages"));
4726
+ const usingSrc = !import_fs_extra11.default.pathExistsSync(import_path11.default.join(baseDir, "pages"));
4646
4727
  const pagesPath = import_path11.default.join(baseDir, usingSrc ? "src" : "", "pages");
4647
4728
  const packageJSONPath = import_path11.default.join(baseDir, "package.json");
4648
4729
  const tinaBlogPagePath = import_path11.default.join(pagesPath, "demo", "blog");
@@ -4650,12 +4731,12 @@ var addReactiveFile = {
4650
4731
  tinaBlogPagePath,
4651
4732
  `[filename].${usingTypescript ? "tsx" : "js"}`
4652
4733
  );
4653
- if (!import_fs_extra10.default.pathExistsSync(tinaBlogPagePathFile)) {
4654
- import_fs_extra10.default.mkdirpSync(tinaBlogPagePath);
4655
- import_fs_extra10.default.writeFileSync(tinaBlogPagePathFile, nextPostPage({ usingSrc }));
4734
+ if (!import_fs_extra11.default.pathExistsSync(tinaBlogPagePathFile)) {
4735
+ import_fs_extra11.default.mkdirpSync(tinaBlogPagePath);
4736
+ import_fs_extra11.default.writeFileSync(tinaBlogPagePathFile, nextPostPage({ usingSrc }));
4656
4737
  }
4657
4738
  logger.info("Adding a nextjs example... \u2705");
4658
- const pack = JSON.parse(import_fs_extra10.default.readFileSync(packageJSONPath).toString());
4739
+ const pack = JSON.parse(import_fs_extra11.default.readFileSync(packageJSONPath).toString());
4659
4740
  const oldScripts = pack.scripts || {};
4660
4741
  const newPack = JSON.stringify(
4661
4742
  {
@@ -4665,7 +4746,7 @@ var addReactiveFile = {
4665
4746
  null,
4666
4747
  2
4667
4748
  );
4668
- import_fs_extra10.default.writeFileSync(packageJSONPath, newPack);
4749
+ import_fs_extra11.default.writeFileSync(packageJSONPath, newPack);
4669
4750
  }
4670
4751
  };
4671
4752
  function execShellCommand(cmd) {
@@ -1,6 +1,27 @@
1
1
  import { BuildOptions, InlineConfig, Plugin } from 'vite';
2
2
  import { Database } from '@tinacms/graphql';
3
3
  import { ConfigManager } from '../config-manager';
4
+ /**
5
+ * This type is duplicated in he `TinaMediaStore`
6
+ * It represents the files that are available at build time
7
+ * and can be referenced in the media manager
8
+ */
9
+ interface StaticMediaItem {
10
+ id: string;
11
+ filename: string;
12
+ src: string;
13
+ directory: string;
14
+ thumbnails: {
15
+ '75x75': string;
16
+ '400x400': string;
17
+ '1000x1000': string;
18
+ };
19
+ type: 'file' | 'dir';
20
+ children?: StaticMedia;
21
+ }
22
+ export interface StaticMedia {
23
+ [offset: string]: StaticMediaItem[];
24
+ }
4
25
  export declare const createConfig: ({ configManager, database, apiURL, plugins, noWatch, rollupOptions, }: {
5
26
  configManager: ConfigManager;
6
27
  database: Database;
@@ -9,3 +30,4 @@ export declare const createConfig: ({ configManager, database, apiURL, plugins,
9
30
  plugins?: Plugin[];
10
31
  rollupOptions?: BuildOptions['rollupOptions'];
11
32
  }) => Promise<InlineConfig>;
33
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
- "version": "1.5.26",
3
+ "version": "1.5.28",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -21,7 +21,7 @@
21
21
  ]
22
22
  },
23
23
  "devDependencies": {
24
- "@tinacms/scripts": "1.1.1",
24
+ "@tinacms/scripts": "1.1.2",
25
25
  "@types/clear": "0.1.0",
26
26
  "@types/cli-spinner": "^0.2.1",
27
27
  "@types/cors": "2.8.5",
@@ -58,12 +58,13 @@
58
58
  "@tailwindcss/aspect-ratio": "^0.4.0",
59
59
  "@tailwindcss/line-clamp": "^0.3.1",
60
60
  "@tailwindcss/typography": "^0.5.9",
61
- "@tinacms/app": "1.2.24",
62
- "@tinacms/datalayer": "1.2.22",
63
- "@tinacms/graphql": "1.4.22",
61
+ "@tinacms/app": "1.2.26",
62
+ "tinacms": "1.5.19",
63
+ "@tinacms/datalayer": "1.2.24",
64
+ "@tinacms/graphql": "1.4.24",
64
65
  "@tinacms/metrics": "1.0.2",
65
- "@tinacms/schema-tools": "1.4.9",
66
- "@tinacms/search": "1.0.7",
66
+ "@tinacms/schema-tools": "1.4.11",
67
+ "@tinacms/search": "1.0.9",
67
68
  "@vitejs/plugin-react": "3.1.0",
68
69
  "ajv": "^6.12.3",
69
70
  "altair-express-middleware": "4.0.6",
@@ -95,7 +96,6 @@
95
96
  "multer": "1.4.5-lts.1",
96
97
  "node-fetch": "2",
97
98
  "normalize-path": "^3.0.0",
98
- "postcss-nested": "^5.0.6",
99
99
  "postcss": "^8.3.3",
100
100
  "prettier": "^2.2.1",
101
101
  "progress": "^2.0.3",
@@ -1,2 +0,0 @@
1
- import { Plugin } from 'vite';
2
- export declare const tinaTailwind: (spaPath: string, configFilePath: any) => Plugin;
@@ -1,2 +0,0 @@
1
- import { Plugin } from 'vite';
2
- export declare const tinaTailwind: (spaPath: string, configFilePath: any) => Plugin;