@tinacms/cli 0.0.0-d69e892-20241003042309 → 0.0.0-d888ad0-20241223044700
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,12 +31,12 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
31
|
var import_clipanion8 = require("clipanion");
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "1.
|
|
34
|
+
var version = "1.7.0";
|
|
35
35
|
|
|
36
36
|
// src/next/commands/dev-command/index.ts
|
|
37
37
|
var import_clipanion2 = require("clipanion");
|
|
38
38
|
var import_fs_extra6 = __toESM(require("fs-extra"));
|
|
39
|
-
var
|
|
39
|
+
var import_path5 = __toESM(require("path"));
|
|
40
40
|
var import_chokidar = __toESM(require("chokidar"));
|
|
41
41
|
var import_graphql10 = require("@tinacms/graphql");
|
|
42
42
|
|
|
@@ -355,17 +355,22 @@ var ConfigManager = class {
|
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
getTinaGraphQLVersion() {
|
|
358
|
-
var _a, _b;
|
|
359
358
|
if (this.tinaGraphQLVersionFromCLI) {
|
|
360
|
-
|
|
359
|
+
const version2 = this.tinaGraphQLVersionFromCLI.split(".");
|
|
360
|
+
return {
|
|
361
|
+
fullVersion: this.tinaGraphQLVersionFromCLI,
|
|
362
|
+
major: version2[0] || "x",
|
|
363
|
+
minor: version2[1] || "x",
|
|
364
|
+
patch: version2[2] || "x"
|
|
365
|
+
};
|
|
361
366
|
}
|
|
362
367
|
const generatedSchema = import_fs_extra.default.readJSONSync(this.generatedSchemaJSONPath);
|
|
363
|
-
if (!generatedSchema || !(typeof (generatedSchema == null ? void 0 : generatedSchema.version) !== "undefined")
|
|
368
|
+
if (!generatedSchema || !(typeof (generatedSchema == null ? void 0 : generatedSchema.version) !== "undefined")) {
|
|
364
369
|
throw new Error(
|
|
365
370
|
`Can not find Tina GraphQL version in ${this.generatedSchemaJSONPath}`
|
|
366
371
|
);
|
|
367
372
|
}
|
|
368
|
-
return
|
|
373
|
+
return generatedSchema.version;
|
|
369
374
|
}
|
|
370
375
|
printGeneratedClientFilePath() {
|
|
371
376
|
if (this.isUsingTs()) {
|
|
@@ -427,7 +432,10 @@ var ConfigManager = class {
|
|
|
427
432
|
}
|
|
428
433
|
async loadConfigFile(generatedFolderPath, configFilePath) {
|
|
429
434
|
const tmpdir = import_path.default.join(import_os.default.tmpdir(), Date.now().toString());
|
|
430
|
-
const
|
|
435
|
+
const preBuildConfigPath = import_path.default.join(
|
|
436
|
+
this.generatedFolderPath,
|
|
437
|
+
"config.prebuild.jsx"
|
|
438
|
+
);
|
|
431
439
|
const outfile = import_path.default.join(tmpdir, "config.build.jsx");
|
|
432
440
|
const outfile2 = import_path.default.join(tmpdir, "config.build.js");
|
|
433
441
|
const tempTSConfigFile = import_path.default.join(tmpdir, "tsconfig.json");
|
|
@@ -441,7 +449,7 @@ var ConfigManager = class {
|
|
|
441
449
|
logLevel: "silent",
|
|
442
450
|
packages: "external",
|
|
443
451
|
ignoreAnnotations: true,
|
|
444
|
-
outfile:
|
|
452
|
+
outfile: preBuildConfigPath,
|
|
445
453
|
loader: loaders,
|
|
446
454
|
metafile: true
|
|
447
455
|
});
|
|
@@ -481,7 +489,7 @@ var ConfigManager = class {
|
|
|
481
489
|
import_fs_extra.default.removeSync(outfile2);
|
|
482
490
|
return {
|
|
483
491
|
config: result.default,
|
|
484
|
-
prebuildPath:
|
|
492
|
+
prebuildPath: preBuildConfigPath,
|
|
485
493
|
watchList: flattenedList
|
|
486
494
|
};
|
|
487
495
|
}
|
|
@@ -612,17 +620,19 @@ var CONFIRMATION_TEXT = import_chalk3.default.dim("enter to confirm");
|
|
|
612
620
|
var import_vite3 = require("vite");
|
|
613
621
|
|
|
614
622
|
// src/next/vite/index.ts
|
|
615
|
-
var
|
|
623
|
+
var import_node_path2 = __toESM(require("path"));
|
|
624
|
+
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
616
625
|
var import_fs_extra2 = __toESM(require("fs-extra"));
|
|
626
|
+
var import_normalize_path2 = __toESM(require("normalize-path"));
|
|
617
627
|
var import_vite = require("vite");
|
|
618
|
-
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
619
628
|
|
|
620
629
|
// src/next/vite/tailwind.ts
|
|
630
|
+
var import_node_path = __toESM(require("path"));
|
|
631
|
+
var import_aspect_ratio = __toESM(require("@tailwindcss/aspect-ratio"));
|
|
632
|
+
var import_container_queries = __toESM(require("@tailwindcss/container-queries"));
|
|
633
|
+
var import_typography = __toESM(require("@tailwindcss/typography"));
|
|
621
634
|
var import_tailwindcss = __toESM(require("tailwindcss"));
|
|
622
635
|
var import_defaultTheme = __toESM(require("tailwindcss/defaultTheme.js"));
|
|
623
|
-
var import_typography = __toESM(require("@tailwindcss/typography"));
|
|
624
|
-
var import_aspect_ratio = __toESM(require("@tailwindcss/aspect-ratio"));
|
|
625
|
-
var import_node_path = __toESM(require("path"));
|
|
626
636
|
var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
627
637
|
return {
|
|
628
638
|
name: "vite-plugin-tina",
|
|
@@ -866,7 +876,11 @@ var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
|
866
876
|
}
|
|
867
877
|
},
|
|
868
878
|
content,
|
|
869
|
-
plugins: [
|
|
879
|
+
plugins: [
|
|
880
|
+
(0, import_typography.default)({ className: "tina-prose" }),
|
|
881
|
+
import_aspect_ratio.default,
|
|
882
|
+
import_container_queries.default
|
|
883
|
+
]
|
|
870
884
|
});
|
|
871
885
|
plugins.push(tw);
|
|
872
886
|
return {
|
|
@@ -881,13 +895,12 @@ var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
|
881
895
|
};
|
|
882
896
|
|
|
883
897
|
// src/next/vite/index.ts
|
|
884
|
-
var import_normalize_path2 = __toESM(require("normalize-path"));
|
|
885
898
|
async function listFilesRecursively({
|
|
886
899
|
directoryPath,
|
|
887
900
|
config: config2,
|
|
888
901
|
roothPath
|
|
889
902
|
}) {
|
|
890
|
-
const fullDirectoryPath =
|
|
903
|
+
const fullDirectoryPath = import_node_path2.default.join(
|
|
891
904
|
roothPath,
|
|
892
905
|
config2.publicFolder,
|
|
893
906
|
directoryPath
|
|
@@ -899,23 +912,23 @@ async function listFilesRecursively({
|
|
|
899
912
|
const items = await import_fs_extra2.default.readdir(fullDirectoryPath);
|
|
900
913
|
const staticMediaItems = [];
|
|
901
914
|
for (const item of items) {
|
|
902
|
-
const itemPath =
|
|
915
|
+
const itemPath = import_node_path2.default.join(fullDirectoryPath, item);
|
|
903
916
|
const stats = await import_fs_extra2.default.promises.lstat(itemPath);
|
|
904
917
|
const staticMediaItem = {
|
|
905
918
|
id: item,
|
|
906
919
|
filename: item,
|
|
907
920
|
type: stats.isDirectory() ? "dir" : "file",
|
|
908
921
|
directory: `${directoryPath.replace(config2.mediaRoot, "")}`,
|
|
909
|
-
src: `/${
|
|
922
|
+
src: `/${import_node_path2.default.join(directoryPath, item)}`,
|
|
910
923
|
thumbnails: {
|
|
911
|
-
"75x75": `/${
|
|
912
|
-
"400x400": `/${
|
|
913
|
-
"1000x1000": `/${
|
|
924
|
+
"75x75": `/${import_node_path2.default.join(directoryPath, item)}`,
|
|
925
|
+
"400x400": `/${import_node_path2.default.join(directoryPath, item)}`,
|
|
926
|
+
"1000x1000": `/${import_node_path2.default.join(directoryPath, item)}`
|
|
914
927
|
}
|
|
915
928
|
};
|
|
916
929
|
if (stats.isDirectory()) {
|
|
917
930
|
staticMediaItem.children = await listFilesRecursively({
|
|
918
|
-
directoryPath:
|
|
931
|
+
directoryPath: import_node_path2.default.join(directoryPath, item),
|
|
919
932
|
config: config2,
|
|
920
933
|
roothPath
|
|
921
934
|
});
|
|
@@ -934,7 +947,6 @@ async function listFilesRecursively({
|
|
|
934
947
|
}
|
|
935
948
|
var createConfig = async ({
|
|
936
949
|
configManager,
|
|
937
|
-
database,
|
|
938
950
|
apiURL,
|
|
939
951
|
plugins = [],
|
|
940
952
|
noWatch,
|
|
@@ -958,7 +970,7 @@ var createConfig = async ({
|
|
|
958
970
|
}
|
|
959
971
|
}
|
|
960
972
|
});
|
|
961
|
-
const staticMediaPath =
|
|
973
|
+
const staticMediaPath = import_node_path2.default.join(
|
|
962
974
|
configManager.generatedFolderPath,
|
|
963
975
|
"static-media.json"
|
|
964
976
|
);
|
|
@@ -976,13 +988,13 @@ var createConfig = async ({
|
|
|
976
988
|
TINA_IMPORT: configManager.prebuildFilePath,
|
|
977
989
|
SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath,
|
|
978
990
|
STATIC_MEDIA_IMPORT: staticMediaPath,
|
|
979
|
-
crypto:
|
|
980
|
-
fs:
|
|
981
|
-
os:
|
|
982
|
-
path:
|
|
991
|
+
crypto: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts"),
|
|
992
|
+
fs: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts"),
|
|
993
|
+
os: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts"),
|
|
994
|
+
path: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts")
|
|
983
995
|
};
|
|
984
996
|
if (configManager.shouldSkipSDK()) {
|
|
985
|
-
alias["CLIENT_IMPORT"] =
|
|
997
|
+
alias["CLIENT_IMPORT"] = import_node_path2.default.join(
|
|
986
998
|
configManager.spaRootPath,
|
|
987
999
|
"src",
|
|
988
1000
|
"dummy-client.ts"
|
|
@@ -994,6 +1006,8 @@ var createConfig = async ({
|
|
|
994
1006
|
if (configManager.config.build.basePath) {
|
|
995
1007
|
basePath = configManager.config.build.basePath;
|
|
996
1008
|
}
|
|
1009
|
+
const fullVersion = configManager.getTinaGraphQLVersion();
|
|
1010
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
997
1011
|
const config2 = {
|
|
998
1012
|
root: configManager.spaRootPath,
|
|
999
1013
|
base: `/${basePath ? `${(0, import_normalize_path2.default)(basePath)}/` : ""}${(0, import_normalize_path2.default)(
|
|
@@ -1009,7 +1023,7 @@ var createConfig = async ({
|
|
|
1009
1023
|
"process.platform": `"${process.platform}"`,
|
|
1010
1024
|
__API_URL__: `"${apiURL}"`,
|
|
1011
1025
|
__BASE_PATH__: `"${((_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.basePath) || ""}"`,
|
|
1012
|
-
__TINA_GRAPHQL_VERSION__:
|
|
1026
|
+
__TINA_GRAPHQL_VERSION__: version2
|
|
1013
1027
|
},
|
|
1014
1028
|
logLevel: "error",
|
|
1015
1029
|
optimizeDeps: {
|
|
@@ -1054,17 +1068,17 @@ var import_pluginutils = require("@rollup/pluginutils");
|
|
|
1054
1068
|
var import_fs = __toESM(require("fs"));
|
|
1055
1069
|
var import_vite2 = require("vite");
|
|
1056
1070
|
var import_esbuild = require("esbuild");
|
|
1057
|
-
var
|
|
1071
|
+
var import_path3 = __toESM(require("path"));
|
|
1058
1072
|
var import_body_parser = __toESM(require("body-parser"));
|
|
1059
1073
|
var import_cors = __toESM(require("cors"));
|
|
1060
1074
|
var import_graphql = require("@tinacms/graphql");
|
|
1061
1075
|
|
|
1062
1076
|
// src/next/commands/dev-command/server/media.ts
|
|
1063
1077
|
var import_fs_extra3 = __toESM(require("fs-extra"));
|
|
1064
|
-
var
|
|
1078
|
+
var import_path2 = __toESM(require("path"));
|
|
1065
1079
|
var import_busboy = __toESM(require("busboy"));
|
|
1066
1080
|
var createMediaRouter = (config2) => {
|
|
1067
|
-
const mediaFolder =
|
|
1081
|
+
const mediaFolder = import_path2.default.join(
|
|
1068
1082
|
config2.rootPath,
|
|
1069
1083
|
config2.publicFolder,
|
|
1070
1084
|
config2.mediaRoot
|
|
@@ -1092,8 +1106,8 @@ var createMediaRouter = (config2) => {
|
|
|
1092
1106
|
bb.on("file", async (_name, file, _info) => {
|
|
1093
1107
|
var _a;
|
|
1094
1108
|
const fullPath = decodeURI((_a = req.url) == null ? void 0 : _a.slice("/media/upload/".length));
|
|
1095
|
-
const saveTo =
|
|
1096
|
-
await import_fs_extra3.default.ensureDir(
|
|
1109
|
+
const saveTo = import_path2.default.join(mediaFolder, ...fullPath.split("/"));
|
|
1110
|
+
await import_fs_extra3.default.ensureDir(import_path2.default.dirname(saveTo));
|
|
1097
1111
|
file.pipe(import_fs_extra3.default.createWriteStream(saveTo));
|
|
1098
1112
|
});
|
|
1099
1113
|
bb.on("error", (error) => {
|
|
@@ -1128,7 +1142,7 @@ var MediaModel = class {
|
|
|
1128
1142
|
}
|
|
1129
1143
|
async listMedia(args) {
|
|
1130
1144
|
try {
|
|
1131
|
-
const folderPath = (0,
|
|
1145
|
+
const folderPath = (0, import_path2.join)(
|
|
1132
1146
|
this.rootPath,
|
|
1133
1147
|
this.publicFolder,
|
|
1134
1148
|
this.mediaRoot,
|
|
@@ -1143,7 +1157,7 @@ var MediaModel = class {
|
|
|
1143
1157
|
}
|
|
1144
1158
|
const filesStr = await import_fs_extra3.default.readdir(folderPath);
|
|
1145
1159
|
const filesProm = filesStr.map(async (file) => {
|
|
1146
|
-
const filePath = (0,
|
|
1160
|
+
const filePath = (0, import_path2.join)(folderPath, file);
|
|
1147
1161
|
const stat = await import_fs_extra3.default.stat(filePath);
|
|
1148
1162
|
let src = `/${file}`;
|
|
1149
1163
|
const isFile = stat.isFile();
|
|
@@ -1200,7 +1214,7 @@ var MediaModel = class {
|
|
|
1200
1214
|
}
|
|
1201
1215
|
async deleteMedia(args) {
|
|
1202
1216
|
try {
|
|
1203
|
-
const file = (0,
|
|
1217
|
+
const file = (0, import_path2.join)(
|
|
1204
1218
|
this.rootPath,
|
|
1205
1219
|
this.publicFolder,
|
|
1206
1220
|
this.mediaRoot,
|
|
@@ -1265,7 +1279,7 @@ var transformTsxPlugin = ({
|
|
|
1265
1279
|
const plug = {
|
|
1266
1280
|
name: "transform-tsx",
|
|
1267
1281
|
async transform(code, id) {
|
|
1268
|
-
const extName =
|
|
1282
|
+
const extName = import_path3.default.extname(id);
|
|
1269
1283
|
if (extName.startsWith(".tsx") || extName.startsWith(".ts")) {
|
|
1270
1284
|
const result = await (0, import_esbuild.transform)(code, { loader: "tsx" });
|
|
1271
1285
|
return {
|
|
@@ -1417,7 +1431,7 @@ var createDevServer = async (configManager, database, searchIndex, apiURL, noWat
|
|
|
1417
1431
|
|
|
1418
1432
|
// src/next/codegen/index.ts
|
|
1419
1433
|
var import_fs_extra4 = __toESM(require("fs-extra"));
|
|
1420
|
-
var
|
|
1434
|
+
var import_path4 = __toESM(require("path"));
|
|
1421
1435
|
var import_graphql6 = require("graphql");
|
|
1422
1436
|
|
|
1423
1437
|
// src/next/codegen/codegen/index.ts
|
|
@@ -1663,11 +1677,11 @@ var Codegen = class {
|
|
|
1663
1677
|
this.noClientBuildCache = noClientBuildCache;
|
|
1664
1678
|
}
|
|
1665
1679
|
async writeConfigFile(fileName, data) {
|
|
1666
|
-
const filePath =
|
|
1680
|
+
const filePath = import_path4.default.join(this.configManager.generatedFolderPath, fileName);
|
|
1667
1681
|
await import_fs_extra4.default.ensureFile(filePath);
|
|
1668
1682
|
await import_fs_extra4.default.outputFile(filePath, data);
|
|
1669
1683
|
if (this.configManager.hasSeparateContentRoot()) {
|
|
1670
|
-
const filePath2 =
|
|
1684
|
+
const filePath2 = import_path4.default.join(
|
|
1671
1685
|
this.configManager.generatedFolderPathContentRepo,
|
|
1672
1686
|
fileName
|
|
1673
1687
|
);
|
|
@@ -1783,7 +1797,8 @@ var Codegen = class {
|
|
|
1783
1797
|
const branch = (_a = this.configManager.config) == null ? void 0 : _a.branch;
|
|
1784
1798
|
const clientId = (_b = this.configManager.config) == null ? void 0 : _b.clientId;
|
|
1785
1799
|
const token = (_c = this.configManager.config) == null ? void 0 : _c.token;
|
|
1786
|
-
const
|
|
1800
|
+
const fullVersion = this.configManager.getTinaGraphQLVersion();
|
|
1801
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
1787
1802
|
const baseUrl = ((_d = this.configManager.config.tinaioConfig) == null ? void 0 : _d.contentApiUrlOverride) || `https://${TINA_HOST}`;
|
|
1788
1803
|
if ((!branch || !clientId || !token) && !this.port && !this.configManager.config.contentApiUrlOverride) {
|
|
1789
1804
|
const missing = [];
|
|
@@ -2204,7 +2219,7 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
2204
2219
|
pathFilter
|
|
2205
2220
|
});
|
|
2206
2221
|
const tinaPathUpdates = modified.filter(
|
|
2207
|
-
(
|
|
2222
|
+
(path14) => path14.startsWith(".tina/__generated__/_schema.json") || path14.startsWith("tina/tina-lock.json")
|
|
2208
2223
|
);
|
|
2209
2224
|
if (tinaPathUpdates.length > 0) {
|
|
2210
2225
|
res = await database.indexContent({
|
|
@@ -2319,14 +2334,14 @@ var DevCommand = class extends BaseCommand {
|
|
|
2319
2334
|
graphql: graphqlSchemaObject
|
|
2320
2335
|
});
|
|
2321
2336
|
import_fs_extra6.default.writeFileSync(
|
|
2322
|
-
|
|
2337
|
+
import_path5.default.join(configManager.tinaFolderPath, tinaLockFilename),
|
|
2323
2338
|
tinaLockContent
|
|
2324
2339
|
);
|
|
2325
2340
|
if (configManager.hasSeparateContentRoot()) {
|
|
2326
2341
|
const rootPath = await configManager.getTinaFolderPath(
|
|
2327
2342
|
configManager.contentRootPath
|
|
2328
2343
|
);
|
|
2329
|
-
const filePath =
|
|
2344
|
+
const filePath = import_path5.default.join(rootPath, tinaLockFilename);
|
|
2330
2345
|
await import_fs_extra6.default.ensureFile(filePath);
|
|
2331
2346
|
await import_fs_extra6.default.outputFile(filePath, tinaLockContent);
|
|
2332
2347
|
}
|
|
@@ -2473,7 +2488,7 @@ ${dangerText(e.message)}
|
|
|
2473
2488
|
watchContentFiles(configManager, database, searchIndexer) {
|
|
2474
2489
|
const collectionContentFiles = [];
|
|
2475
2490
|
configManager.config.schema.collections.forEach((collection) => {
|
|
2476
|
-
const collectionGlob = `${
|
|
2491
|
+
const collectionGlob = `${import_path5.default.join(
|
|
2477
2492
|
configManager.contentRootPath,
|
|
2478
2493
|
collection.path
|
|
2479
2494
|
)}/**/*.${collection.format || "md"}`;
|
|
@@ -2532,6 +2547,8 @@ DevCommand.usage = import_clipanion2.Command.Usage({
|
|
|
2532
2547
|
var import_clipanion3 = require("clipanion");
|
|
2533
2548
|
var import_progress2 = __toESM(require("progress"));
|
|
2534
2549
|
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
2550
|
+
var import_crypto = __toESM(require("crypto"));
|
|
2551
|
+
var import_path6 = __toESM(require("path"));
|
|
2535
2552
|
var import_graphql11 = require("@tinacms/graphql");
|
|
2536
2553
|
|
|
2537
2554
|
// src/next/commands/build-command/server.ts
|
|
@@ -2575,7 +2592,7 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
2575
2592
|
// src/next/commands/build-command/index.ts
|
|
2576
2593
|
var import_schema_tools2 = require("@tinacms/schema-tools");
|
|
2577
2594
|
var import_graphql12 = require("graphql");
|
|
2578
|
-
var
|
|
2595
|
+
var import_core3 = require("@graphql-inspector/core");
|
|
2579
2596
|
|
|
2580
2597
|
// src/next/commands/build-command/waitForDB.ts
|
|
2581
2598
|
var import_progress = __toESM(require("progress"));
|
|
@@ -2677,6 +2694,20 @@ var waitForDB = async (config2, apiUrl, previewName, verbose) => {
|
|
|
2677
2694
|
|
|
2678
2695
|
// src/next/commands/build-command/index.ts
|
|
2679
2696
|
var import_search2 = require("@tinacms/search");
|
|
2697
|
+
|
|
2698
|
+
// src/utils/index.ts
|
|
2699
|
+
var import_core2 = require("@graphql-inspector/core");
|
|
2700
|
+
var getFaqLink = (type) => {
|
|
2701
|
+
switch (type) {
|
|
2702
|
+
case import_core2.ChangeType.FieldRemoved: {
|
|
2703
|
+
return "https://tina.io/docs/introduction/faq#how-do-i-resolve-the-local-graphql-schema-doesnt-match-the-remote-graphql-schema-errors";
|
|
2704
|
+
}
|
|
2705
|
+
default:
|
|
2706
|
+
return null;
|
|
2707
|
+
}
|
|
2708
|
+
};
|
|
2709
|
+
|
|
2710
|
+
// src/next/commands/build-command/index.ts
|
|
2680
2711
|
var BuildCommand = class extends BaseCommand {
|
|
2681
2712
|
constructor() {
|
|
2682
2713
|
super(...arguments);
|
|
@@ -2804,7 +2835,7 @@ ${dangerText(e.message)}
|
|
|
2804
2835
|
}
|
|
2805
2836
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2806
2837
|
if (!skipCloudChecks) {
|
|
2807
|
-
const { hasUpstream } = await this.checkClientInfo(
|
|
2838
|
+
const { hasUpstream, timestamp } = await this.checkClientInfo(
|
|
2808
2839
|
configManager,
|
|
2809
2840
|
codegen2.productionUrl,
|
|
2810
2841
|
this.previewBaseBranch
|
|
@@ -2832,7 +2863,16 @@ ${dangerText(e.message)}
|
|
|
2832
2863
|
await this.checkGraphqlSchema(
|
|
2833
2864
|
configManager,
|
|
2834
2865
|
database,
|
|
2835
|
-
codegen2.productionUrl
|
|
2866
|
+
codegen2.productionUrl,
|
|
2867
|
+
timestamp
|
|
2868
|
+
);
|
|
2869
|
+
await this.checkTinaSchema(
|
|
2870
|
+
configManager,
|
|
2871
|
+
database,
|
|
2872
|
+
codegen2.productionUrl,
|
|
2873
|
+
this.previewName,
|
|
2874
|
+
this.verbose,
|
|
2875
|
+
timestamp
|
|
2836
2876
|
);
|
|
2837
2877
|
}
|
|
2838
2878
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
@@ -2951,11 +2991,13 @@ ${dangerText(e.message)}
|
|
|
2951
2991
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
2952
2992
|
let branchKnown = false;
|
|
2953
2993
|
let hasUpstream = false;
|
|
2994
|
+
let timestamp;
|
|
2954
2995
|
try {
|
|
2955
2996
|
const res = await request({
|
|
2956
2997
|
token,
|
|
2957
2998
|
url
|
|
2958
2999
|
});
|
|
3000
|
+
timestamp = res.timestamp || 0;
|
|
2959
3001
|
bar2.tick({
|
|
2960
3002
|
prog: "\u2705"
|
|
2961
3003
|
});
|
|
@@ -2997,7 +3039,8 @@ ${dangerText(e.message)}
|
|
|
2997
3039
|
prog: "\u2705"
|
|
2998
3040
|
});
|
|
2999
3041
|
return {
|
|
3000
|
-
hasUpstream
|
|
3042
|
+
hasUpstream,
|
|
3043
|
+
timestamp
|
|
3001
3044
|
};
|
|
3002
3045
|
}
|
|
3003
3046
|
for (let i = 0; i <= 5; i++) {
|
|
@@ -3087,14 +3130,14 @@ ${dangerText(e.message)}
|
|
|
3087
3130
|
throw e;
|
|
3088
3131
|
}
|
|
3089
3132
|
}
|
|
3090
|
-
async checkGraphqlSchema(configManager, database, apiURL) {
|
|
3133
|
+
async checkGraphqlSchema(configManager, database, apiURL, timestamp) {
|
|
3091
3134
|
const bar2 = new import_progress2.default(
|
|
3092
3135
|
"Checking local GraphQL Schema matches server. :prog",
|
|
3093
3136
|
1
|
|
3094
3137
|
);
|
|
3095
3138
|
const { config: config2 } = configManager;
|
|
3096
3139
|
const token = config2.token;
|
|
3097
|
-
const remoteSchema = await fetchRemoteGraphqlSchema({
|
|
3140
|
+
const { remoteSchema, remoteProjectVersion } = await fetchRemoteGraphqlSchema({
|
|
3098
3141
|
url: apiURL,
|
|
3099
3142
|
token
|
|
3100
3143
|
});
|
|
@@ -3114,7 +3157,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3114
3157
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
3115
3158
|
const localGraphqlSchema = (0, import_graphql12.buildASTSchema)(localSchemaDocument);
|
|
3116
3159
|
try {
|
|
3117
|
-
const diffResult = await (0,
|
|
3160
|
+
const diffResult = await (0, import_core3.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
3118
3161
|
if (diffResult.length === 0) {
|
|
3119
3162
|
bar2.tick({
|
|
3120
3163
|
prog: "\u2705"
|
|
@@ -3123,12 +3166,30 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3123
3166
|
bar2.tick({
|
|
3124
3167
|
prog: "\u274C"
|
|
3125
3168
|
});
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3169
|
+
const type = diffResult[0].type;
|
|
3170
|
+
const reason = diffResult[0].message;
|
|
3171
|
+
const errorLevel = diffResult[0].criticality.level;
|
|
3172
|
+
const faqLink = getFaqLink(type);
|
|
3173
|
+
const tinaGraphQLVersion = configManager.getTinaGraphQLVersion();
|
|
3174
|
+
let errorMessage = `The local GraphQL schema doesn't match the remote GraphQL schema. Please push up your changes to GitHub to update your remote GraphQL schema. ${faqLink && `
|
|
3175
|
+
Check out '${faqLink}' for possible solutions.`}`;
|
|
3176
|
+
errorMessage += `
|
|
3129
3177
|
|
|
3130
|
-
Additional info:
|
|
3178
|
+
Additional info:
|
|
3179
|
+
|
|
3180
|
+
`;
|
|
3181
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3182
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3183
|
+
`;
|
|
3131
3184
|
}
|
|
3185
|
+
errorMessage += ` Local GraphQL version: ${tinaGraphQLVersion.fullVersion} / Remote GraphQL version: ${remoteProjectVersion}
|
|
3186
|
+
`;
|
|
3187
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3188
|
+
timestamp
|
|
3189
|
+
).toUTCString()}
|
|
3190
|
+
`;
|
|
3191
|
+
errorMessage += ` Reason: [${errorLevel} - ${type}] ${reason}
|
|
3192
|
+
`;
|
|
3132
3193
|
throw new Error(errorMessage);
|
|
3133
3194
|
}
|
|
3134
3195
|
} catch (e) {
|
|
@@ -3143,6 +3204,71 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3143
3204
|
}
|
|
3144
3205
|
}
|
|
3145
3206
|
}
|
|
3207
|
+
async checkTinaSchema(configManager, database, apiURL, previewName, verbose, timestamp) {
|
|
3208
|
+
const bar2 = new import_progress2.default(
|
|
3209
|
+
"Checking local Tina Schema matches server. :prog",
|
|
3210
|
+
1
|
|
3211
|
+
);
|
|
3212
|
+
const { config: config2 } = configManager;
|
|
3213
|
+
const token = config2.token;
|
|
3214
|
+
const { clientId, branch, isLocalClient, host } = (0, import_schema_tools2.parseURL)(apiURL);
|
|
3215
|
+
if (isLocalClient || !host || !clientId || !branch) {
|
|
3216
|
+
if (verbose) {
|
|
3217
|
+
logger.info(logText("Not using Tina Cloud, skipping Tina Schema check"));
|
|
3218
|
+
}
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
const { tinaSchema: remoteTinaSchemaSha } = await fetchSchemaSha({
|
|
3222
|
+
url: `https://${host}/db/${clientId}/${previewName || branch}/schemaSha`,
|
|
3223
|
+
token
|
|
3224
|
+
});
|
|
3225
|
+
if (!remoteTinaSchemaSha) {
|
|
3226
|
+
bar2.tick({
|
|
3227
|
+
prog: "\u274C"
|
|
3228
|
+
});
|
|
3229
|
+
let errorMessage = `The remote Tina schema does not exist. Check indexing for this branch.`;
|
|
3230
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3231
|
+
errorMessage += `
|
|
3232
|
+
|
|
3233
|
+
Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
3234
|
+
}
|
|
3235
|
+
throw new Error(errorMessage);
|
|
3236
|
+
}
|
|
3237
|
+
if (!database.bridge) {
|
|
3238
|
+
throw new Error(`No bridge configured`);
|
|
3239
|
+
}
|
|
3240
|
+
const localTinaSchema = JSON.parse(
|
|
3241
|
+
await database.bridge.get(
|
|
3242
|
+
import_path6.default.join(database.tinaDirectory, "__generated__", "_schema.json")
|
|
3243
|
+
)
|
|
3244
|
+
);
|
|
3245
|
+
localTinaSchema.version = void 0;
|
|
3246
|
+
const localTinaSchemaSha = import_crypto.default.createHash("sha256").update(JSON.stringify(localTinaSchema)).digest("hex");
|
|
3247
|
+
if (localTinaSchemaSha === remoteTinaSchemaSha) {
|
|
3248
|
+
bar2.tick({
|
|
3249
|
+
prog: "\u2705"
|
|
3250
|
+
});
|
|
3251
|
+
} else {
|
|
3252
|
+
bar2.tick({
|
|
3253
|
+
prog: "\u274C"
|
|
3254
|
+
});
|
|
3255
|
+
let errorMessage = `The local Tina schema doesn't match the remote Tina schema. Please push up your changes to GitHub to update your remote tina schema.`;
|
|
3256
|
+
errorMessage += `
|
|
3257
|
+
|
|
3258
|
+
Additional info:
|
|
3259
|
+
|
|
3260
|
+
`;
|
|
3261
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3262
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3263
|
+
`;
|
|
3264
|
+
}
|
|
3265
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3266
|
+
timestamp
|
|
3267
|
+
).toUTCString()}
|
|
3268
|
+
`;
|
|
3269
|
+
throw new Error(errorMessage);
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3146
3272
|
};
|
|
3147
3273
|
BuildCommand.paths = [["build"]];
|
|
3148
3274
|
BuildCommand.usage = import_clipanion3.Command.Usage({
|
|
@@ -3209,7 +3335,26 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3209
3335
|
body
|
|
3210
3336
|
});
|
|
3211
3337
|
const data = await res.json();
|
|
3212
|
-
return
|
|
3338
|
+
return {
|
|
3339
|
+
remoteSchema: data == null ? void 0 : data.data,
|
|
3340
|
+
remoteRuntimeVersion: res.headers.get("tinacms-grapqhl-version"),
|
|
3341
|
+
remoteProjectVersion: res.headers.get("tinacms-graphql-project-version")
|
|
3342
|
+
};
|
|
3343
|
+
};
|
|
3344
|
+
var fetchSchemaSha = async ({
|
|
3345
|
+
url,
|
|
3346
|
+
token
|
|
3347
|
+
}) => {
|
|
3348
|
+
const headers = new Headers();
|
|
3349
|
+
if (token) {
|
|
3350
|
+
headers.append("X-API-KEY", token);
|
|
3351
|
+
}
|
|
3352
|
+
const res = await fetch(url, {
|
|
3353
|
+
method: "GET",
|
|
3354
|
+
headers,
|
|
3355
|
+
cache: "no-cache"
|
|
3356
|
+
});
|
|
3357
|
+
return res.json();
|
|
3213
3358
|
};
|
|
3214
3359
|
|
|
3215
3360
|
// src/next/commands/audit-command/index.ts
|
|
@@ -6012,22 +6157,22 @@ var writeGeneratedFile = async ({
|
|
|
6012
6157
|
content,
|
|
6013
6158
|
typescript
|
|
6014
6159
|
}) => {
|
|
6015
|
-
const { exists, path:
|
|
6160
|
+
const { exists, path: path14, parentPath } = generatedFile.resolve(typescript);
|
|
6016
6161
|
if (exists) {
|
|
6017
6162
|
if (overwrite) {
|
|
6018
|
-
logger.info(`Overwriting file at ${
|
|
6019
|
-
import_fs_extra13.default.outputFileSync(
|
|
6163
|
+
logger.info(`Overwriting file at ${path14}... \u2705`);
|
|
6164
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6020
6165
|
} else {
|
|
6021
|
-
logger.info(`Not overwriting file at ${
|
|
6166
|
+
logger.info(`Not overwriting file at ${path14}.`);
|
|
6022
6167
|
logger.info(
|
|
6023
|
-
logText(`Please add the following to ${
|
|
6168
|
+
logText(`Please add the following to ${path14}:
|
|
6024
6169
|
${indentText(content)}}`)
|
|
6025
6170
|
);
|
|
6026
6171
|
}
|
|
6027
6172
|
} else {
|
|
6028
|
-
logger.info(`Adding file at ${
|
|
6173
|
+
logger.info(`Adding file at ${path14}... \u2705`);
|
|
6029
6174
|
await import_fs_extra13.default.ensureDir(parentPath);
|
|
6030
|
-
import_fs_extra13.default.outputFileSync(
|
|
6175
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6031
6176
|
}
|
|
6032
6177
|
};
|
|
6033
6178
|
var addConfigFile = async ({
|
|
@@ -21,15 +21,25 @@ export declare class BuildCommand extends BaseCommand {
|
|
|
21
21
|
execute(): Promise<number | void>;
|
|
22
22
|
checkClientInfo(configManager: ConfigManager, apiURL: string, previewBaseBranch?: string): Promise<{
|
|
23
23
|
hasUpstream: boolean;
|
|
24
|
+
timestamp: number;
|
|
24
25
|
}>;
|
|
25
26
|
syncProject(configManager: ConfigManager, apiURL: string, options?: {
|
|
26
27
|
upstreamBranch?: string;
|
|
27
28
|
previewBaseBranch?: string;
|
|
28
29
|
previewName?: string;
|
|
29
30
|
}): Promise<void>;
|
|
30
|
-
checkGraphqlSchema(configManager: ConfigManager, database: Database, apiURL: string): Promise<void>;
|
|
31
|
+
checkGraphqlSchema(configManager: ConfigManager, database: Database, apiURL: string, timestamp: number): Promise<void>;
|
|
32
|
+
checkTinaSchema(configManager: ConfigManager, database: Database, apiURL: string, previewName: string, verbose: boolean, timestamp: number): Promise<void>;
|
|
31
33
|
}
|
|
32
34
|
export declare const fetchRemoteGraphqlSchema: ({ url, token, }: {
|
|
33
35
|
url: string;
|
|
34
36
|
token?: string;
|
|
37
|
+
}) => Promise<{
|
|
38
|
+
remoteSchema: any;
|
|
39
|
+
remoteRuntimeVersion: string;
|
|
40
|
+
remoteProjectVersion: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const fetchSchemaSha: ({ url, token, }: {
|
|
43
|
+
url: string;
|
|
44
|
+
token?: string;
|
|
35
45
|
}) => Promise<any>;
|
|
@@ -55,7 +55,12 @@ export declare class ConfigManager {
|
|
|
55
55
|
shouldSkipSDK(): boolean;
|
|
56
56
|
processConfig(): Promise<void>;
|
|
57
57
|
getTinaFolderPath(rootPath: any): Promise<string>;
|
|
58
|
-
getTinaGraphQLVersion():
|
|
58
|
+
getTinaGraphQLVersion(): {
|
|
59
|
+
fullVersion: string;
|
|
60
|
+
major: string;
|
|
61
|
+
minor: string;
|
|
62
|
+
patch: string;
|
|
63
|
+
};
|
|
59
64
|
printGeneratedClientFilePath(): string;
|
|
60
65
|
printGeneratedTypesFilePath(): string;
|
|
61
66
|
printoutputHTMLFilePath(): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ConfigManager } from '../config-manager';
|
|
1
|
+
import type { Database } from '@tinacms/graphql';
|
|
2
|
+
import { type BuildOptions, type InlineConfig, type Plugin } from 'vite';
|
|
3
|
+
import type { ConfigManager } from '../config-manager';
|
|
4
4
|
/**
|
|
5
5
|
* This type is duplicated in he `TinaMediaStore`
|
|
6
6
|
* It represents the files that are available at build time
|
|
@@ -22,7 +22,7 @@ interface StaticMediaItem {
|
|
|
22
22
|
export interface StaticMedia {
|
|
23
23
|
[offset: string]: StaticMediaItem[];
|
|
24
24
|
}
|
|
25
|
-
export declare const createConfig: ({ configManager,
|
|
25
|
+
export declare const createConfig: ({ configManager, apiURL, plugins, noWatch, rollupOptions, }: {
|
|
26
26
|
configManager: ConfigManager;
|
|
27
27
|
database: Database;
|
|
28
28
|
apiURL: string;
|
package/dist/server/server.d.ts
CHANGED
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-d888ad0-20241223044700",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -26,9 +26,8 @@
|
|
|
26
26
|
"@types/cors": "2.8.5",
|
|
27
27
|
"@types/crypto-js": "^4.2.2",
|
|
28
28
|
"@types/express": "^4.17.21",
|
|
29
|
-
"@types/express-graphql": "^0.9.0",
|
|
30
29
|
"@types/figlet": "1.2.0",
|
|
31
|
-
"@types/fs-extra": "^
|
|
30
|
+
"@types/fs-extra": "^11.0.4",
|
|
32
31
|
"@types/jest": "26.0.4",
|
|
33
32
|
"@types/js-yaml": "^4.0.9",
|
|
34
33
|
"@types/listr": "0.14.2",
|
|
@@ -36,22 +35,23 @@
|
|
|
36
35
|
"@types/multer": "^1.4.12",
|
|
37
36
|
"@types/progress": "^2.0.7",
|
|
38
37
|
"@types/prompts": "^2.4.9",
|
|
39
|
-
"@types/yup": "^0.
|
|
38
|
+
"@types/yup": "^0.32.0",
|
|
40
39
|
"jest": "^29.7.0",
|
|
41
|
-
"@tinacms/scripts": "1.
|
|
40
|
+
"@tinacms/scripts": "1.3.1"
|
|
42
41
|
},
|
|
43
42
|
"dependencies": {
|
|
44
43
|
"@graphql-codegen/core": "^2.6.8",
|
|
45
44
|
"@graphql-codegen/plugin-helpers": "latest",
|
|
46
|
-
"@graphql-codegen/typescript": "^4.
|
|
47
|
-
"@graphql-codegen/typescript-operations": "^4.
|
|
45
|
+
"@graphql-codegen/typescript": "^4.1.1",
|
|
46
|
+
"@graphql-codegen/typescript-operations": "^4.3.1",
|
|
48
47
|
"@graphql-codegen/visitor-plugin-common": "^4.1.2",
|
|
49
48
|
"@graphql-inspector/core": "^4.2.2",
|
|
50
49
|
"@graphql-tools/graphql-file-loader": "^7.5.17",
|
|
51
50
|
"@graphql-tools/load": "^7.8.14",
|
|
52
|
-
"@rollup/pluginutils": "^5.1.
|
|
51
|
+
"@rollup/pluginutils": "^5.1.3",
|
|
53
52
|
"@svgr/core": "8.1.0",
|
|
54
53
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
54
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
55
55
|
"@tailwindcss/typography": "^0.5.15",
|
|
56
56
|
"@vitejs/plugin-react": "3.1.0",
|
|
57
57
|
"altair-express-middleware": "^7.3.6",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"cors": "^2.8.5",
|
|
66
66
|
"crypto-js": "^4.2.0",
|
|
67
67
|
"dotenv": "^16.4.5",
|
|
68
|
-
"esbuild": "^0.
|
|
68
|
+
"esbuild": "^0.24.0",
|
|
69
69
|
"fs-extra": "^11.2.0",
|
|
70
70
|
"graphql": "15.8.0",
|
|
71
71
|
"js-yaml": "^4.1.0",
|
|
@@ -78,18 +78,18 @@
|
|
|
78
78
|
"progress": "^2.0.3",
|
|
79
79
|
"prompts": "^2.4.2",
|
|
80
80
|
"readable-stream": "^4.5.2",
|
|
81
|
-
"tailwindcss": "^3.4.
|
|
81
|
+
"tailwindcss": "^3.4.15",
|
|
82
82
|
"typanion": "3.13.0",
|
|
83
|
-
"typescript": "^5.6.
|
|
83
|
+
"typescript": "^5.6.3",
|
|
84
84
|
"vite": "^4.5.5",
|
|
85
|
-
"yup": "^
|
|
85
|
+
"yup": "^1.4.0",
|
|
86
86
|
"zod": "^3.23.8",
|
|
87
|
-
"@tinacms/app": "
|
|
88
|
-
"@tinacms/metrics": "1.0.
|
|
89
|
-
"@tinacms/schema-tools": "
|
|
90
|
-
"@tinacms/graphql": "
|
|
91
|
-
"tinacms": "
|
|
92
|
-
"
|
|
87
|
+
"@tinacms/app": "2.1.14",
|
|
88
|
+
"@tinacms/metrics": "1.0.8",
|
|
89
|
+
"@tinacms/schema-tools": "1.6.9",
|
|
90
|
+
"@tinacms/graphql": "1.5.9",
|
|
91
|
+
"@tinacms/search": "1.0.36",
|
|
92
|
+
"tinacms": "2.5.2"
|
|
93
93
|
},
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"registry": "https://registry.npmjs.org"
|