@tinacms/cli 0.0.0-bf22bf8-20241004045704 → 0.0.0-c45ac5d-20241213020122
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 +185 -57
- package/dist/next/commands/build-command/index.d.ts +10 -1
- package/dist/next/vite/index.d.ts +3 -3
- package/dist/server/server.d.ts +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/package.json +16 -17
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.6.
|
|
34
|
+
var version = "1.6.13";
|
|
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
|
|
|
@@ -612,18 +612,19 @@ var CONFIRMATION_TEXT = import_chalk3.default.dim("enter to confirm");
|
|
|
612
612
|
var import_vite3 = require("vite");
|
|
613
613
|
|
|
614
614
|
// src/next/vite/index.ts
|
|
615
|
-
var
|
|
615
|
+
var import_node_path2 = __toESM(require("path"));
|
|
616
|
+
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
616
617
|
var import_fs_extra2 = __toESM(require("fs-extra"));
|
|
618
|
+
var import_normalize_path2 = __toESM(require("normalize-path"));
|
|
617
619
|
var import_vite = require("vite");
|
|
618
|
-
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
619
620
|
|
|
620
621
|
// src/next/vite/tailwind.ts
|
|
621
|
-
var import_tailwindcss = __toESM(require("tailwindcss"));
|
|
622
|
-
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
622
|
var import_node_path = __toESM(require("path"));
|
|
623
|
+
var import_aspect_ratio = __toESM(require("@tailwindcss/aspect-ratio"));
|
|
626
624
|
var import_container_queries = __toESM(require("@tailwindcss/container-queries"));
|
|
625
|
+
var import_typography = __toESM(require("@tailwindcss/typography"));
|
|
626
|
+
var import_tailwindcss = __toESM(require("tailwindcss"));
|
|
627
|
+
var import_defaultTheme = __toESM(require("tailwindcss/defaultTheme.js"));
|
|
627
628
|
var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
628
629
|
return {
|
|
629
630
|
name: "vite-plugin-tina",
|
|
@@ -886,13 +887,12 @@ var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
|
886
887
|
};
|
|
887
888
|
|
|
888
889
|
// src/next/vite/index.ts
|
|
889
|
-
var import_normalize_path2 = __toESM(require("normalize-path"));
|
|
890
890
|
async function listFilesRecursively({
|
|
891
891
|
directoryPath,
|
|
892
892
|
config: config2,
|
|
893
893
|
roothPath
|
|
894
894
|
}) {
|
|
895
|
-
const fullDirectoryPath =
|
|
895
|
+
const fullDirectoryPath = import_node_path2.default.join(
|
|
896
896
|
roothPath,
|
|
897
897
|
config2.publicFolder,
|
|
898
898
|
directoryPath
|
|
@@ -904,23 +904,23 @@ async function listFilesRecursively({
|
|
|
904
904
|
const items = await import_fs_extra2.default.readdir(fullDirectoryPath);
|
|
905
905
|
const staticMediaItems = [];
|
|
906
906
|
for (const item of items) {
|
|
907
|
-
const itemPath =
|
|
907
|
+
const itemPath = import_node_path2.default.join(fullDirectoryPath, item);
|
|
908
908
|
const stats = await import_fs_extra2.default.promises.lstat(itemPath);
|
|
909
909
|
const staticMediaItem = {
|
|
910
910
|
id: item,
|
|
911
911
|
filename: item,
|
|
912
912
|
type: stats.isDirectory() ? "dir" : "file",
|
|
913
913
|
directory: `${directoryPath.replace(config2.mediaRoot, "")}`,
|
|
914
|
-
src: `/${
|
|
914
|
+
src: `/${import_node_path2.default.join(directoryPath, item)}`,
|
|
915
915
|
thumbnails: {
|
|
916
|
-
"75x75": `/${
|
|
917
|
-
"400x400": `/${
|
|
918
|
-
"1000x1000": `/${
|
|
916
|
+
"75x75": `/${import_node_path2.default.join(directoryPath, item)}`,
|
|
917
|
+
"400x400": `/${import_node_path2.default.join(directoryPath, item)}`,
|
|
918
|
+
"1000x1000": `/${import_node_path2.default.join(directoryPath, item)}`
|
|
919
919
|
}
|
|
920
920
|
};
|
|
921
921
|
if (stats.isDirectory()) {
|
|
922
922
|
staticMediaItem.children = await listFilesRecursively({
|
|
923
|
-
directoryPath:
|
|
923
|
+
directoryPath: import_node_path2.default.join(directoryPath, item),
|
|
924
924
|
config: config2,
|
|
925
925
|
roothPath
|
|
926
926
|
});
|
|
@@ -963,7 +963,7 @@ var createConfig = async ({
|
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
965
|
});
|
|
966
|
-
const staticMediaPath =
|
|
966
|
+
const staticMediaPath = import_node_path2.default.join(
|
|
967
967
|
configManager.generatedFolderPath,
|
|
968
968
|
"static-media.json"
|
|
969
969
|
);
|
|
@@ -981,13 +981,13 @@ var createConfig = async ({
|
|
|
981
981
|
TINA_IMPORT: configManager.prebuildFilePath,
|
|
982
982
|
SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath,
|
|
983
983
|
STATIC_MEDIA_IMPORT: staticMediaPath,
|
|
984
|
-
crypto:
|
|
985
|
-
fs:
|
|
986
|
-
os:
|
|
987
|
-
path:
|
|
984
|
+
crypto: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts"),
|
|
985
|
+
fs: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts"),
|
|
986
|
+
os: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts"),
|
|
987
|
+
path: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts")
|
|
988
988
|
};
|
|
989
989
|
if (configManager.shouldSkipSDK()) {
|
|
990
|
-
alias["CLIENT_IMPORT"] =
|
|
990
|
+
alias["CLIENT_IMPORT"] = import_node_path2.default.join(
|
|
991
991
|
configManager.spaRootPath,
|
|
992
992
|
"src",
|
|
993
993
|
"dummy-client.ts"
|
|
@@ -1059,17 +1059,17 @@ var import_pluginutils = require("@rollup/pluginutils");
|
|
|
1059
1059
|
var import_fs = __toESM(require("fs"));
|
|
1060
1060
|
var import_vite2 = require("vite");
|
|
1061
1061
|
var import_esbuild = require("esbuild");
|
|
1062
|
-
var
|
|
1062
|
+
var import_path3 = __toESM(require("path"));
|
|
1063
1063
|
var import_body_parser = __toESM(require("body-parser"));
|
|
1064
1064
|
var import_cors = __toESM(require("cors"));
|
|
1065
1065
|
var import_graphql = require("@tinacms/graphql");
|
|
1066
1066
|
|
|
1067
1067
|
// src/next/commands/dev-command/server/media.ts
|
|
1068
1068
|
var import_fs_extra3 = __toESM(require("fs-extra"));
|
|
1069
|
-
var
|
|
1069
|
+
var import_path2 = __toESM(require("path"));
|
|
1070
1070
|
var import_busboy = __toESM(require("busboy"));
|
|
1071
1071
|
var createMediaRouter = (config2) => {
|
|
1072
|
-
const mediaFolder =
|
|
1072
|
+
const mediaFolder = import_path2.default.join(
|
|
1073
1073
|
config2.rootPath,
|
|
1074
1074
|
config2.publicFolder,
|
|
1075
1075
|
config2.mediaRoot
|
|
@@ -1097,8 +1097,8 @@ var createMediaRouter = (config2) => {
|
|
|
1097
1097
|
bb.on("file", async (_name, file, _info) => {
|
|
1098
1098
|
var _a;
|
|
1099
1099
|
const fullPath = decodeURI((_a = req.url) == null ? void 0 : _a.slice("/media/upload/".length));
|
|
1100
|
-
const saveTo =
|
|
1101
|
-
await import_fs_extra3.default.ensureDir(
|
|
1100
|
+
const saveTo = import_path2.default.join(mediaFolder, ...fullPath.split("/"));
|
|
1101
|
+
await import_fs_extra3.default.ensureDir(import_path2.default.dirname(saveTo));
|
|
1102
1102
|
file.pipe(import_fs_extra3.default.createWriteStream(saveTo));
|
|
1103
1103
|
});
|
|
1104
1104
|
bb.on("error", (error) => {
|
|
@@ -1133,7 +1133,7 @@ var MediaModel = class {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
async listMedia(args) {
|
|
1135
1135
|
try {
|
|
1136
|
-
const folderPath = (0,
|
|
1136
|
+
const folderPath = (0, import_path2.join)(
|
|
1137
1137
|
this.rootPath,
|
|
1138
1138
|
this.publicFolder,
|
|
1139
1139
|
this.mediaRoot,
|
|
@@ -1148,7 +1148,7 @@ var MediaModel = class {
|
|
|
1148
1148
|
}
|
|
1149
1149
|
const filesStr = await import_fs_extra3.default.readdir(folderPath);
|
|
1150
1150
|
const filesProm = filesStr.map(async (file) => {
|
|
1151
|
-
const filePath = (0,
|
|
1151
|
+
const filePath = (0, import_path2.join)(folderPath, file);
|
|
1152
1152
|
const stat = await import_fs_extra3.default.stat(filePath);
|
|
1153
1153
|
let src = `/${file}`;
|
|
1154
1154
|
const isFile = stat.isFile();
|
|
@@ -1205,7 +1205,7 @@ var MediaModel = class {
|
|
|
1205
1205
|
}
|
|
1206
1206
|
async deleteMedia(args) {
|
|
1207
1207
|
try {
|
|
1208
|
-
const file = (0,
|
|
1208
|
+
const file = (0, import_path2.join)(
|
|
1209
1209
|
this.rootPath,
|
|
1210
1210
|
this.publicFolder,
|
|
1211
1211
|
this.mediaRoot,
|
|
@@ -1270,7 +1270,7 @@ var transformTsxPlugin = ({
|
|
|
1270
1270
|
const plug = {
|
|
1271
1271
|
name: "transform-tsx",
|
|
1272
1272
|
async transform(code, id) {
|
|
1273
|
-
const extName =
|
|
1273
|
+
const extName = import_path3.default.extname(id);
|
|
1274
1274
|
if (extName.startsWith(".tsx") || extName.startsWith(".ts")) {
|
|
1275
1275
|
const result = await (0, import_esbuild.transform)(code, { loader: "tsx" });
|
|
1276
1276
|
return {
|
|
@@ -1422,7 +1422,7 @@ var createDevServer = async (configManager, database, searchIndex, apiURL, noWat
|
|
|
1422
1422
|
|
|
1423
1423
|
// src/next/codegen/index.ts
|
|
1424
1424
|
var import_fs_extra4 = __toESM(require("fs-extra"));
|
|
1425
|
-
var
|
|
1425
|
+
var import_path4 = __toESM(require("path"));
|
|
1426
1426
|
var import_graphql6 = require("graphql");
|
|
1427
1427
|
|
|
1428
1428
|
// src/next/codegen/codegen/index.ts
|
|
@@ -1668,11 +1668,11 @@ var Codegen = class {
|
|
|
1668
1668
|
this.noClientBuildCache = noClientBuildCache;
|
|
1669
1669
|
}
|
|
1670
1670
|
async writeConfigFile(fileName, data) {
|
|
1671
|
-
const filePath =
|
|
1671
|
+
const filePath = import_path4.default.join(this.configManager.generatedFolderPath, fileName);
|
|
1672
1672
|
await import_fs_extra4.default.ensureFile(filePath);
|
|
1673
1673
|
await import_fs_extra4.default.outputFile(filePath, data);
|
|
1674
1674
|
if (this.configManager.hasSeparateContentRoot()) {
|
|
1675
|
-
const filePath2 =
|
|
1675
|
+
const filePath2 = import_path4.default.join(
|
|
1676
1676
|
this.configManager.generatedFolderPathContentRepo,
|
|
1677
1677
|
fileName
|
|
1678
1678
|
);
|
|
@@ -2209,7 +2209,7 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
2209
2209
|
pathFilter
|
|
2210
2210
|
});
|
|
2211
2211
|
const tinaPathUpdates = modified.filter(
|
|
2212
|
-
(
|
|
2212
|
+
(path14) => path14.startsWith(".tina/__generated__/_schema.json") || path14.startsWith("tina/tina-lock.json")
|
|
2213
2213
|
);
|
|
2214
2214
|
if (tinaPathUpdates.length > 0) {
|
|
2215
2215
|
res = await database.indexContent({
|
|
@@ -2324,14 +2324,14 @@ var DevCommand = class extends BaseCommand {
|
|
|
2324
2324
|
graphql: graphqlSchemaObject
|
|
2325
2325
|
});
|
|
2326
2326
|
import_fs_extra6.default.writeFileSync(
|
|
2327
|
-
|
|
2327
|
+
import_path5.default.join(configManager.tinaFolderPath, tinaLockFilename),
|
|
2328
2328
|
tinaLockContent
|
|
2329
2329
|
);
|
|
2330
2330
|
if (configManager.hasSeparateContentRoot()) {
|
|
2331
2331
|
const rootPath = await configManager.getTinaFolderPath(
|
|
2332
2332
|
configManager.contentRootPath
|
|
2333
2333
|
);
|
|
2334
|
-
const filePath =
|
|
2334
|
+
const filePath = import_path5.default.join(rootPath, tinaLockFilename);
|
|
2335
2335
|
await import_fs_extra6.default.ensureFile(filePath);
|
|
2336
2336
|
await import_fs_extra6.default.outputFile(filePath, tinaLockContent);
|
|
2337
2337
|
}
|
|
@@ -2478,7 +2478,7 @@ ${dangerText(e.message)}
|
|
|
2478
2478
|
watchContentFiles(configManager, database, searchIndexer) {
|
|
2479
2479
|
const collectionContentFiles = [];
|
|
2480
2480
|
configManager.config.schema.collections.forEach((collection) => {
|
|
2481
|
-
const collectionGlob = `${
|
|
2481
|
+
const collectionGlob = `${import_path5.default.join(
|
|
2482
2482
|
configManager.contentRootPath,
|
|
2483
2483
|
collection.path
|
|
2484
2484
|
)}/**/*.${collection.format || "md"}`;
|
|
@@ -2537,6 +2537,8 @@ DevCommand.usage = import_clipanion2.Command.Usage({
|
|
|
2537
2537
|
var import_clipanion3 = require("clipanion");
|
|
2538
2538
|
var import_progress2 = __toESM(require("progress"));
|
|
2539
2539
|
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
2540
|
+
var import_crypto = __toESM(require("crypto"));
|
|
2541
|
+
var import_path6 = __toESM(require("path"));
|
|
2540
2542
|
var import_graphql11 = require("@tinacms/graphql");
|
|
2541
2543
|
|
|
2542
2544
|
// src/next/commands/build-command/server.ts
|
|
@@ -2580,7 +2582,7 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
2580
2582
|
// src/next/commands/build-command/index.ts
|
|
2581
2583
|
var import_schema_tools2 = require("@tinacms/schema-tools");
|
|
2582
2584
|
var import_graphql12 = require("graphql");
|
|
2583
|
-
var
|
|
2585
|
+
var import_core3 = require("@graphql-inspector/core");
|
|
2584
2586
|
|
|
2585
2587
|
// src/next/commands/build-command/waitForDB.ts
|
|
2586
2588
|
var import_progress = __toESM(require("progress"));
|
|
@@ -2682,6 +2684,20 @@ var waitForDB = async (config2, apiUrl, previewName, verbose) => {
|
|
|
2682
2684
|
|
|
2683
2685
|
// src/next/commands/build-command/index.ts
|
|
2684
2686
|
var import_search2 = require("@tinacms/search");
|
|
2687
|
+
|
|
2688
|
+
// src/utils/index.ts
|
|
2689
|
+
var import_core2 = require("@graphql-inspector/core");
|
|
2690
|
+
var getFaqLink = (type) => {
|
|
2691
|
+
switch (type) {
|
|
2692
|
+
case import_core2.ChangeType.FieldRemoved: {
|
|
2693
|
+
return "https://tina.io/docs/introduction/faq#how-do-i-resolve-the-local-graphql-schema-doesnt-match-the-remote-graphql-schema-errors";
|
|
2694
|
+
}
|
|
2695
|
+
default:
|
|
2696
|
+
return null;
|
|
2697
|
+
}
|
|
2698
|
+
};
|
|
2699
|
+
|
|
2700
|
+
// src/next/commands/build-command/index.ts
|
|
2685
2701
|
var BuildCommand = class extends BaseCommand {
|
|
2686
2702
|
constructor() {
|
|
2687
2703
|
super(...arguments);
|
|
@@ -2809,7 +2825,7 @@ ${dangerText(e.message)}
|
|
|
2809
2825
|
}
|
|
2810
2826
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2811
2827
|
if (!skipCloudChecks) {
|
|
2812
|
-
const { hasUpstream } = await this.checkClientInfo(
|
|
2828
|
+
const { hasUpstream, timestamp } = await this.checkClientInfo(
|
|
2813
2829
|
configManager,
|
|
2814
2830
|
codegen2.productionUrl,
|
|
2815
2831
|
this.previewBaseBranch
|
|
@@ -2837,7 +2853,16 @@ ${dangerText(e.message)}
|
|
|
2837
2853
|
await this.checkGraphqlSchema(
|
|
2838
2854
|
configManager,
|
|
2839
2855
|
database,
|
|
2840
|
-
codegen2.productionUrl
|
|
2856
|
+
codegen2.productionUrl,
|
|
2857
|
+
timestamp
|
|
2858
|
+
);
|
|
2859
|
+
await this.checkTinaSchema(
|
|
2860
|
+
configManager,
|
|
2861
|
+
database,
|
|
2862
|
+
codegen2.productionUrl,
|
|
2863
|
+
this.previewName,
|
|
2864
|
+
this.verbose,
|
|
2865
|
+
timestamp
|
|
2841
2866
|
);
|
|
2842
2867
|
}
|
|
2843
2868
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
@@ -2956,11 +2981,13 @@ ${dangerText(e.message)}
|
|
|
2956
2981
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
2957
2982
|
let branchKnown = false;
|
|
2958
2983
|
let hasUpstream = false;
|
|
2984
|
+
let timestamp;
|
|
2959
2985
|
try {
|
|
2960
2986
|
const res = await request({
|
|
2961
2987
|
token,
|
|
2962
2988
|
url
|
|
2963
2989
|
});
|
|
2990
|
+
timestamp = res.timestamp || 0;
|
|
2964
2991
|
bar2.tick({
|
|
2965
2992
|
prog: "\u2705"
|
|
2966
2993
|
});
|
|
@@ -3002,7 +3029,8 @@ ${dangerText(e.message)}
|
|
|
3002
3029
|
prog: "\u2705"
|
|
3003
3030
|
});
|
|
3004
3031
|
return {
|
|
3005
|
-
hasUpstream
|
|
3032
|
+
hasUpstream,
|
|
3033
|
+
timestamp
|
|
3006
3034
|
};
|
|
3007
3035
|
}
|
|
3008
3036
|
for (let i = 0; i <= 5; i++) {
|
|
@@ -3092,14 +3120,14 @@ ${dangerText(e.message)}
|
|
|
3092
3120
|
throw e;
|
|
3093
3121
|
}
|
|
3094
3122
|
}
|
|
3095
|
-
async checkGraphqlSchema(configManager, database, apiURL) {
|
|
3123
|
+
async checkGraphqlSchema(configManager, database, apiURL, timestamp) {
|
|
3096
3124
|
const bar2 = new import_progress2.default(
|
|
3097
3125
|
"Checking local GraphQL Schema matches server. :prog",
|
|
3098
3126
|
1
|
|
3099
3127
|
);
|
|
3100
3128
|
const { config: config2 } = configManager;
|
|
3101
3129
|
const token = config2.token;
|
|
3102
|
-
const remoteSchema = await fetchRemoteGraphqlSchema({
|
|
3130
|
+
const { remoteSchema, remoteVersion } = await fetchRemoteGraphqlSchema({
|
|
3103
3131
|
url: apiURL,
|
|
3104
3132
|
token
|
|
3105
3133
|
});
|
|
@@ -3119,7 +3147,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3119
3147
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
3120
3148
|
const localGraphqlSchema = (0, import_graphql12.buildASTSchema)(localSchemaDocument);
|
|
3121
3149
|
try {
|
|
3122
|
-
const diffResult = await (0,
|
|
3150
|
+
const diffResult = await (0, import_core3.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
3123
3151
|
if (diffResult.length === 0) {
|
|
3124
3152
|
bar2.tick({
|
|
3125
3153
|
prog: "\u2705"
|
|
@@ -3128,12 +3156,29 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3128
3156
|
bar2.tick({
|
|
3129
3157
|
prog: "\u274C"
|
|
3130
3158
|
});
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3159
|
+
const type = diffResult[0].type;
|
|
3160
|
+
const reason = diffResult[0].message;
|
|
3161
|
+
const errorLevel = diffResult[0].criticality.level;
|
|
3162
|
+
const faqLink = getFaqLink(type);
|
|
3163
|
+
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 && `
|
|
3164
|
+
Check out '${faqLink}' for possible solutions.`}`;
|
|
3165
|
+
errorMessage += `
|
|
3134
3166
|
|
|
3135
|
-
Additional info:
|
|
3167
|
+
Additional info:
|
|
3168
|
+
|
|
3169
|
+
`;
|
|
3170
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3171
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3172
|
+
`;
|
|
3136
3173
|
}
|
|
3174
|
+
errorMessage += ` Local GraphQL version: ${configManager.getTinaGraphQLVersion()} / Remote GraphQL version: ${remoteVersion}
|
|
3175
|
+
`;
|
|
3176
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3177
|
+
timestamp
|
|
3178
|
+
).toUTCString()}
|
|
3179
|
+
`;
|
|
3180
|
+
errorMessage += ` Reason: [${errorLevel} - ${type}] ${reason}
|
|
3181
|
+
`;
|
|
3137
3182
|
throw new Error(errorMessage);
|
|
3138
3183
|
}
|
|
3139
3184
|
} catch (e) {
|
|
@@ -3148,6 +3193,71 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3148
3193
|
}
|
|
3149
3194
|
}
|
|
3150
3195
|
}
|
|
3196
|
+
async checkTinaSchema(configManager, database, apiURL, previewName, verbose, timestamp) {
|
|
3197
|
+
const bar2 = new import_progress2.default(
|
|
3198
|
+
"Checking local Tina Schema matches server. :prog",
|
|
3199
|
+
1
|
|
3200
|
+
);
|
|
3201
|
+
const { config: config2 } = configManager;
|
|
3202
|
+
const token = config2.token;
|
|
3203
|
+
const { clientId, branch, isLocalClient, host } = (0, import_schema_tools2.parseURL)(apiURL);
|
|
3204
|
+
if (isLocalClient || !host || !clientId || !branch) {
|
|
3205
|
+
if (verbose) {
|
|
3206
|
+
logger.info(logText("Not using Tina Cloud, skipping Tina Schema check"));
|
|
3207
|
+
}
|
|
3208
|
+
return;
|
|
3209
|
+
}
|
|
3210
|
+
const { tinaSchema: remoteTinaSchemaSha } = await fetchSchemaSha({
|
|
3211
|
+
url: `https://${host}/db/${clientId}/${previewName || branch}/schemaSha`,
|
|
3212
|
+
token
|
|
3213
|
+
});
|
|
3214
|
+
if (!remoteTinaSchemaSha) {
|
|
3215
|
+
bar2.tick({
|
|
3216
|
+
prog: "\u274C"
|
|
3217
|
+
});
|
|
3218
|
+
let errorMessage = `The remote Tina schema does not exist. Check indexing for this branch.`;
|
|
3219
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3220
|
+
errorMessage += `
|
|
3221
|
+
|
|
3222
|
+
Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
3223
|
+
}
|
|
3224
|
+
throw new Error(errorMessage);
|
|
3225
|
+
}
|
|
3226
|
+
if (!database.bridge) {
|
|
3227
|
+
throw new Error(`No bridge configured`);
|
|
3228
|
+
}
|
|
3229
|
+
const localTinaSchema = JSON.parse(
|
|
3230
|
+
await database.bridge.get(
|
|
3231
|
+
import_path6.default.join(database.tinaDirectory, "__generated__", "_schema.json")
|
|
3232
|
+
)
|
|
3233
|
+
);
|
|
3234
|
+
localTinaSchema.version = void 0;
|
|
3235
|
+
const localTinaSchemaSha = import_crypto.default.createHash("sha256").update(JSON.stringify(localTinaSchema)).digest("hex");
|
|
3236
|
+
if (localTinaSchemaSha === remoteTinaSchemaSha) {
|
|
3237
|
+
bar2.tick({
|
|
3238
|
+
prog: "\u2705"
|
|
3239
|
+
});
|
|
3240
|
+
} else {
|
|
3241
|
+
bar2.tick({
|
|
3242
|
+
prog: "\u274C"
|
|
3243
|
+
});
|
|
3244
|
+
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.`;
|
|
3245
|
+
errorMessage += `
|
|
3246
|
+
|
|
3247
|
+
Additional info:
|
|
3248
|
+
|
|
3249
|
+
`;
|
|
3250
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3251
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3252
|
+
`;
|
|
3253
|
+
}
|
|
3254
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3255
|
+
timestamp
|
|
3256
|
+
).toUTCString()}
|
|
3257
|
+
`;
|
|
3258
|
+
throw new Error(errorMessage);
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3151
3261
|
};
|
|
3152
3262
|
BuildCommand.paths = [["build"]];
|
|
3153
3263
|
BuildCommand.usage = import_clipanion3.Command.Usage({
|
|
@@ -3214,7 +3324,25 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3214
3324
|
body
|
|
3215
3325
|
});
|
|
3216
3326
|
const data = await res.json();
|
|
3217
|
-
return
|
|
3327
|
+
return {
|
|
3328
|
+
remoteSchema: data == null ? void 0 : data.data,
|
|
3329
|
+
remoteVersion: res.headers.get("tinacms-grapqhl-version")
|
|
3330
|
+
};
|
|
3331
|
+
};
|
|
3332
|
+
var fetchSchemaSha = async ({
|
|
3333
|
+
url,
|
|
3334
|
+
token
|
|
3335
|
+
}) => {
|
|
3336
|
+
const headers = new Headers();
|
|
3337
|
+
if (token) {
|
|
3338
|
+
headers.append("X-API-KEY", token);
|
|
3339
|
+
}
|
|
3340
|
+
const res = await fetch(url, {
|
|
3341
|
+
method: "GET",
|
|
3342
|
+
headers,
|
|
3343
|
+
cache: "no-cache"
|
|
3344
|
+
});
|
|
3345
|
+
return res.json();
|
|
3218
3346
|
};
|
|
3219
3347
|
|
|
3220
3348
|
// src/next/commands/audit-command/index.ts
|
|
@@ -6017,22 +6145,22 @@ var writeGeneratedFile = async ({
|
|
|
6017
6145
|
content,
|
|
6018
6146
|
typescript
|
|
6019
6147
|
}) => {
|
|
6020
|
-
const { exists, path:
|
|
6148
|
+
const { exists, path: path14, parentPath } = generatedFile.resolve(typescript);
|
|
6021
6149
|
if (exists) {
|
|
6022
6150
|
if (overwrite) {
|
|
6023
|
-
logger.info(`Overwriting file at ${
|
|
6024
|
-
import_fs_extra13.default.outputFileSync(
|
|
6151
|
+
logger.info(`Overwriting file at ${path14}... \u2705`);
|
|
6152
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6025
6153
|
} else {
|
|
6026
|
-
logger.info(`Not overwriting file at ${
|
|
6154
|
+
logger.info(`Not overwriting file at ${path14}.`);
|
|
6027
6155
|
logger.info(
|
|
6028
|
-
logText(`Please add the following to ${
|
|
6156
|
+
logText(`Please add the following to ${path14}:
|
|
6029
6157
|
${indentText(content)}}`)
|
|
6030
6158
|
);
|
|
6031
6159
|
}
|
|
6032
6160
|
} else {
|
|
6033
|
-
logger.info(`Adding file at ${
|
|
6161
|
+
logger.info(`Adding file at ${path14}... \u2705`);
|
|
6034
6162
|
await import_fs_extra13.default.ensureDir(parentPath);
|
|
6035
|
-
import_fs_extra13.default.outputFileSync(
|
|
6163
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6036
6164
|
}
|
|
6037
6165
|
};
|
|
6038
6166
|
var addConfigFile = async ({
|
|
@@ -21,15 +21,24 @@ 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
|
+
remoteVersion: string;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const fetchSchemaSha: ({ url, token, }: {
|
|
42
|
+
url: string;
|
|
43
|
+
token?: string;
|
|
35
44
|
}) => Promise<any>;
|
|
@@ -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
|
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-c45ac5d-20241213020122",
|
|
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,20 +35,20 @@
|
|
|
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",
|
|
55
54
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
@@ -79,18 +78,18 @@
|
|
|
79
78
|
"progress": "^2.0.3",
|
|
80
79
|
"prompts": "^2.4.2",
|
|
81
80
|
"readable-stream": "^4.5.2",
|
|
82
|
-
"tailwindcss": "^3.4.
|
|
81
|
+
"tailwindcss": "^3.4.15",
|
|
83
82
|
"typanion": "3.13.0",
|
|
84
|
-
"typescript": "^5.6.
|
|
83
|
+
"typescript": "^5.6.3",
|
|
85
84
|
"vite": "^4.5.5",
|
|
86
|
-
"yup": "^
|
|
85
|
+
"yup": "^1.4.0",
|
|
87
86
|
"zod": "^3.23.8",
|
|
88
|
-
"@tinacms/
|
|
89
|
-
"@tinacms/
|
|
90
|
-
"@tinacms/
|
|
91
|
-
"@tinacms/
|
|
92
|
-
"@tinacms/
|
|
93
|
-
"tinacms": "0.0.0-
|
|
87
|
+
"@tinacms/schema-tools": "0.0.0-c45ac5d-20241213020122",
|
|
88
|
+
"@tinacms/app": "0.0.0-c45ac5d-20241213020122",
|
|
89
|
+
"@tinacms/metrics": "1.0.8",
|
|
90
|
+
"@tinacms/search": "0.0.0-c45ac5d-20241213020122",
|
|
91
|
+
"@tinacms/graphql": "0.0.0-c45ac5d-20241213020122",
|
|
92
|
+
"tinacms": "0.0.0-c45ac5d-20241213020122"
|
|
94
93
|
},
|
|
95
94
|
"publishConfig": {
|
|
96
95
|
"registry": "https://registry.npmjs.org"
|