@tinacms/cli 1.6.13 → 1.7.0
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,7 +31,7 @@ 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");
|
|
@@ -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()) {
|
|
@@ -999,6 +1004,8 @@ var createConfig = async ({
|
|
|
999
1004
|
if (configManager.config.build.basePath) {
|
|
1000
1005
|
basePath = configManager.config.build.basePath;
|
|
1001
1006
|
}
|
|
1007
|
+
const fullVersion = configManager.getTinaGraphQLVersion();
|
|
1008
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
1002
1009
|
const config2 = {
|
|
1003
1010
|
root: configManager.spaRootPath,
|
|
1004
1011
|
base: `/${basePath ? `${(0, import_normalize_path2.default)(basePath)}/` : ""}${(0, import_normalize_path2.default)(
|
|
@@ -1014,7 +1021,7 @@ var createConfig = async ({
|
|
|
1014
1021
|
"process.platform": `"${process.platform}"`,
|
|
1015
1022
|
__API_URL__: `"${apiURL}"`,
|
|
1016
1023
|
__BASE_PATH__: `"${((_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.basePath) || ""}"`,
|
|
1017
|
-
__TINA_GRAPHQL_VERSION__:
|
|
1024
|
+
__TINA_GRAPHQL_VERSION__: version2
|
|
1018
1025
|
},
|
|
1019
1026
|
logLevel: "error",
|
|
1020
1027
|
optimizeDeps: {
|
|
@@ -1788,7 +1795,8 @@ var Codegen = class {
|
|
|
1788
1795
|
const branch = (_a = this.configManager.config) == null ? void 0 : _a.branch;
|
|
1789
1796
|
const clientId = (_b = this.configManager.config) == null ? void 0 : _b.clientId;
|
|
1790
1797
|
const token = (_c = this.configManager.config) == null ? void 0 : _c.token;
|
|
1791
|
-
const
|
|
1798
|
+
const fullVersion = this.configManager.getTinaGraphQLVersion();
|
|
1799
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
1792
1800
|
const baseUrl = ((_d = this.configManager.config.tinaioConfig) == null ? void 0 : _d.contentApiUrlOverride) || `https://${TINA_HOST}`;
|
|
1793
1801
|
if ((!branch || !clientId || !token) && !this.port && !this.configManager.config.contentApiUrlOverride) {
|
|
1794
1802
|
const missing = [];
|
|
@@ -2582,7 +2590,7 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
2582
2590
|
// src/next/commands/build-command/index.ts
|
|
2583
2591
|
var import_schema_tools2 = require("@tinacms/schema-tools");
|
|
2584
2592
|
var import_graphql12 = require("graphql");
|
|
2585
|
-
var
|
|
2593
|
+
var import_core3 = require("@graphql-inspector/core");
|
|
2586
2594
|
|
|
2587
2595
|
// src/next/commands/build-command/waitForDB.ts
|
|
2588
2596
|
var import_progress = __toESM(require("progress"));
|
|
@@ -2684,6 +2692,20 @@ var waitForDB = async (config2, apiUrl, previewName, verbose) => {
|
|
|
2684
2692
|
|
|
2685
2693
|
// src/next/commands/build-command/index.ts
|
|
2686
2694
|
var import_search2 = require("@tinacms/search");
|
|
2695
|
+
|
|
2696
|
+
// src/utils/index.ts
|
|
2697
|
+
var import_core2 = require("@graphql-inspector/core");
|
|
2698
|
+
var getFaqLink = (type) => {
|
|
2699
|
+
switch (type) {
|
|
2700
|
+
case import_core2.ChangeType.FieldRemoved: {
|
|
2701
|
+
return "https://tina.io/docs/introduction/faq#how-do-i-resolve-the-local-graphql-schema-doesnt-match-the-remote-graphql-schema-errors";
|
|
2702
|
+
}
|
|
2703
|
+
default:
|
|
2704
|
+
return null;
|
|
2705
|
+
}
|
|
2706
|
+
};
|
|
2707
|
+
|
|
2708
|
+
// src/next/commands/build-command/index.ts
|
|
2687
2709
|
var BuildCommand = class extends BaseCommand {
|
|
2688
2710
|
constructor() {
|
|
2689
2711
|
super(...arguments);
|
|
@@ -3113,7 +3135,7 @@ ${dangerText(e.message)}
|
|
|
3113
3135
|
);
|
|
3114
3136
|
const { config: config2 } = configManager;
|
|
3115
3137
|
const token = config2.token;
|
|
3116
|
-
const { remoteSchema,
|
|
3138
|
+
const { remoteSchema, remoteProjectVersion } = await fetchRemoteGraphqlSchema({
|
|
3117
3139
|
url: apiURL,
|
|
3118
3140
|
token
|
|
3119
3141
|
});
|
|
@@ -3133,7 +3155,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3133
3155
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
3134
3156
|
const localGraphqlSchema = (0, import_graphql12.buildASTSchema)(localSchemaDocument);
|
|
3135
3157
|
try {
|
|
3136
|
-
const diffResult = await (0,
|
|
3158
|
+
const diffResult = await (0, import_core3.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
3137
3159
|
if (diffResult.length === 0) {
|
|
3138
3160
|
bar2.tick({
|
|
3139
3161
|
prog: "\u2705"
|
|
@@ -3142,21 +3164,29 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3142
3164
|
bar2.tick({
|
|
3143
3165
|
prog: "\u274C"
|
|
3144
3166
|
});
|
|
3145
|
-
|
|
3167
|
+
const type = diffResult[0].type;
|
|
3168
|
+
const reason = diffResult[0].message;
|
|
3169
|
+
const errorLevel = diffResult[0].criticality.level;
|
|
3170
|
+
const faqLink = getFaqLink(type);
|
|
3171
|
+
const tinaGraphQLVersion = configManager.getTinaGraphQLVersion();
|
|
3172
|
+
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 && `
|
|
3173
|
+
Check out '${faqLink}' for possible solutions.`}`;
|
|
3146
3174
|
errorMessage += `
|
|
3147
3175
|
|
|
3148
3176
|
Additional info:
|
|
3149
3177
|
|
|
3150
3178
|
`;
|
|
3151
3179
|
if (config2 == null ? void 0 : config2.branch) {
|
|
3152
|
-
errorMessage += `
|
|
3180
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3153
3181
|
`;
|
|
3154
3182
|
}
|
|
3155
|
-
errorMessage += `
|
|
3183
|
+
errorMessage += ` Local GraphQL version: ${tinaGraphQLVersion.fullVersion} / Remote GraphQL version: ${remoteProjectVersion}
|
|
3156
3184
|
`;
|
|
3157
|
-
errorMessage += `
|
|
3185
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3158
3186
|
timestamp
|
|
3159
3187
|
).toUTCString()}
|
|
3188
|
+
`;
|
|
3189
|
+
errorMessage += ` Reason: [${errorLevel} - ${type}] ${reason}
|
|
3160
3190
|
`;
|
|
3161
3191
|
throw new Error(errorMessage);
|
|
3162
3192
|
}
|
|
@@ -3305,7 +3335,8 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3305
3335
|
const data = await res.json();
|
|
3306
3336
|
return {
|
|
3307
3337
|
remoteSchema: data == null ? void 0 : data.data,
|
|
3308
|
-
|
|
3338
|
+
remoteRuntimeVersion: res.headers.get("tinacms-grapqhl-version"),
|
|
3339
|
+
remoteProjectVersion: res.headers.get("tinacms-graphql-project-version")
|
|
3309
3340
|
};
|
|
3310
3341
|
};
|
|
3311
3342
|
var fetchSchemaSha = async ({
|
|
@@ -36,7 +36,8 @@ export declare const fetchRemoteGraphqlSchema: ({ url, token, }: {
|
|
|
36
36
|
token?: string;
|
|
37
37
|
}) => Promise<{
|
|
38
38
|
remoteSchema: any;
|
|
39
|
-
|
|
39
|
+
remoteRuntimeVersion: string;
|
|
40
|
+
remoteProjectVersion: string;
|
|
40
41
|
}>;
|
|
41
42
|
export declare const fetchSchemaSha: ({ url, token, }: {
|
|
42
43
|
url: string;
|
|
@@ -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;
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"vite": "^4.5.5",
|
|
85
85
|
"yup": "^1.4.0",
|
|
86
86
|
"zod": "^3.23.8",
|
|
87
|
-
"@tinacms/
|
|
88
|
-
"@tinacms/
|
|
87
|
+
"@tinacms/app": "2.1.14",
|
|
88
|
+
"@tinacms/graphql": "1.5.9",
|
|
89
89
|
"@tinacms/metrics": "1.0.8",
|
|
90
|
-
"@tinacms/schema-tools": "1.6.
|
|
91
|
-
"
|
|
92
|
-
"tinacms": "
|
|
90
|
+
"@tinacms/schema-tools": "1.6.9",
|
|
91
|
+
"tinacms": "2.5.2",
|
|
92
|
+
"@tinacms/search": "1.0.36"
|
|
93
93
|
},
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"registry": "https://registry.npmjs.org"
|