@tinacms/cli 1.6.12 → 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);
|
|
@@ -2811,7 +2833,7 @@ ${dangerText(e.message)}
|
|
|
2811
2833
|
}
|
|
2812
2834
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2813
2835
|
if (!skipCloudChecks) {
|
|
2814
|
-
const { hasUpstream } = await this.checkClientInfo(
|
|
2836
|
+
const { hasUpstream, timestamp } = await this.checkClientInfo(
|
|
2815
2837
|
configManager,
|
|
2816
2838
|
codegen2.productionUrl,
|
|
2817
2839
|
this.previewBaseBranch
|
|
@@ -2839,14 +2861,16 @@ ${dangerText(e.message)}
|
|
|
2839
2861
|
await this.checkGraphqlSchema(
|
|
2840
2862
|
configManager,
|
|
2841
2863
|
database,
|
|
2842
|
-
codegen2.productionUrl
|
|
2864
|
+
codegen2.productionUrl,
|
|
2865
|
+
timestamp
|
|
2843
2866
|
);
|
|
2844
2867
|
await this.checkTinaSchema(
|
|
2845
2868
|
configManager,
|
|
2846
2869
|
database,
|
|
2847
2870
|
codegen2.productionUrl,
|
|
2848
2871
|
this.previewName,
|
|
2849
|
-
this.verbose
|
|
2872
|
+
this.verbose,
|
|
2873
|
+
timestamp
|
|
2850
2874
|
);
|
|
2851
2875
|
}
|
|
2852
2876
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
@@ -2965,11 +2989,13 @@ ${dangerText(e.message)}
|
|
|
2965
2989
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
2966
2990
|
let branchKnown = false;
|
|
2967
2991
|
let hasUpstream = false;
|
|
2992
|
+
let timestamp;
|
|
2968
2993
|
try {
|
|
2969
2994
|
const res = await request({
|
|
2970
2995
|
token,
|
|
2971
2996
|
url
|
|
2972
2997
|
});
|
|
2998
|
+
timestamp = res.timestamp || 0;
|
|
2973
2999
|
bar2.tick({
|
|
2974
3000
|
prog: "\u2705"
|
|
2975
3001
|
});
|
|
@@ -3011,7 +3037,8 @@ ${dangerText(e.message)}
|
|
|
3011
3037
|
prog: "\u2705"
|
|
3012
3038
|
});
|
|
3013
3039
|
return {
|
|
3014
|
-
hasUpstream
|
|
3040
|
+
hasUpstream,
|
|
3041
|
+
timestamp
|
|
3015
3042
|
};
|
|
3016
3043
|
}
|
|
3017
3044
|
for (let i = 0; i <= 5; i++) {
|
|
@@ -3101,14 +3128,14 @@ ${dangerText(e.message)}
|
|
|
3101
3128
|
throw e;
|
|
3102
3129
|
}
|
|
3103
3130
|
}
|
|
3104
|
-
async checkGraphqlSchema(configManager, database, apiURL) {
|
|
3131
|
+
async checkGraphqlSchema(configManager, database, apiURL, timestamp) {
|
|
3105
3132
|
const bar2 = new import_progress2.default(
|
|
3106
3133
|
"Checking local GraphQL Schema matches server. :prog",
|
|
3107
3134
|
1
|
|
3108
3135
|
);
|
|
3109
3136
|
const { config: config2 } = configManager;
|
|
3110
3137
|
const token = config2.token;
|
|
3111
|
-
const remoteSchema = await fetchRemoteGraphqlSchema({
|
|
3138
|
+
const { remoteSchema, remoteProjectVersion } = await fetchRemoteGraphqlSchema({
|
|
3112
3139
|
url: apiURL,
|
|
3113
3140
|
token
|
|
3114
3141
|
});
|
|
@@ -3128,7 +3155,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3128
3155
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
3129
3156
|
const localGraphqlSchema = (0, import_graphql12.buildASTSchema)(localSchemaDocument);
|
|
3130
3157
|
try {
|
|
3131
|
-
const diffResult = await (0,
|
|
3158
|
+
const diffResult = await (0, import_core3.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
3132
3159
|
if (diffResult.length === 0) {
|
|
3133
3160
|
bar2.tick({
|
|
3134
3161
|
prog: "\u2705"
|
|
@@ -3137,12 +3164,30 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3137
3164
|
bar2.tick({
|
|
3138
3165
|
prog: "\u274C"
|
|
3139
3166
|
});
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
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.`}`;
|
|
3174
|
+
errorMessage += `
|
|
3143
3175
|
|
|
3144
|
-
Additional info:
|
|
3176
|
+
Additional info:
|
|
3177
|
+
|
|
3178
|
+
`;
|
|
3179
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3180
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3181
|
+
`;
|
|
3145
3182
|
}
|
|
3183
|
+
errorMessage += ` Local GraphQL version: ${tinaGraphQLVersion.fullVersion} / Remote GraphQL version: ${remoteProjectVersion}
|
|
3184
|
+
`;
|
|
3185
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3186
|
+
timestamp
|
|
3187
|
+
).toUTCString()}
|
|
3188
|
+
`;
|
|
3189
|
+
errorMessage += ` Reason: [${errorLevel} - ${type}] ${reason}
|
|
3190
|
+
`;
|
|
3146
3191
|
throw new Error(errorMessage);
|
|
3147
3192
|
}
|
|
3148
3193
|
} catch (e) {
|
|
@@ -3157,7 +3202,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3157
3202
|
}
|
|
3158
3203
|
}
|
|
3159
3204
|
}
|
|
3160
|
-
async checkTinaSchema(configManager, database, apiURL, previewName, verbose) {
|
|
3205
|
+
async checkTinaSchema(configManager, database, apiURL, previewName, verbose, timestamp) {
|
|
3161
3206
|
const bar2 = new import_progress2.default(
|
|
3162
3207
|
"Checking local Tina Schema matches server. :prog",
|
|
3163
3208
|
1
|
|
@@ -3206,11 +3251,19 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3206
3251
|
prog: "\u274C"
|
|
3207
3252
|
});
|
|
3208
3253
|
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.`;
|
|
3209
|
-
|
|
3210
|
-
errorMessage += `
|
|
3254
|
+
errorMessage += `
|
|
3211
3255
|
|
|
3212
|
-
Additional info:
|
|
3256
|
+
Additional info:
|
|
3257
|
+
|
|
3258
|
+
`;
|
|
3259
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3260
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3261
|
+
`;
|
|
3213
3262
|
}
|
|
3263
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3264
|
+
timestamp
|
|
3265
|
+
).toUTCString()}
|
|
3266
|
+
`;
|
|
3214
3267
|
throw new Error(errorMessage);
|
|
3215
3268
|
}
|
|
3216
3269
|
}
|
|
@@ -3280,7 +3333,11 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3280
3333
|
body
|
|
3281
3334
|
});
|
|
3282
3335
|
const data = await res.json();
|
|
3283
|
-
return
|
|
3336
|
+
return {
|
|
3337
|
+
remoteSchema: data == null ? void 0 : data.data,
|
|
3338
|
+
remoteRuntimeVersion: res.headers.get("tinacms-grapqhl-version"),
|
|
3339
|
+
remoteProjectVersion: res.headers.get("tinacms-graphql-project-version")
|
|
3340
|
+
};
|
|
3284
3341
|
};
|
|
3285
3342
|
var fetchSchemaSha = async ({
|
|
3286
3343
|
url,
|
|
@@ -21,19 +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
|
-
checkTinaSchema(configManager: ConfigManager, database: Database, apiURL: string, previewName: string, verbose: boolean): 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>;
|
|
32
33
|
}
|
|
33
34
|
export declare const fetchRemoteGraphqlSchema: ({ url, token, }: {
|
|
34
35
|
url: string;
|
|
35
36
|
token?: string;
|
|
36
|
-
}) => Promise<
|
|
37
|
+
}) => Promise<{
|
|
38
|
+
remoteSchema: any;
|
|
39
|
+
remoteRuntimeVersion: string;
|
|
40
|
+
remoteProjectVersion: string;
|
|
41
|
+
}>;
|
|
37
42
|
export declare const fetchSchemaSha: ({ url, token, }: {
|
|
38
43
|
url: string;
|
|
39
44
|
token?: 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/
|
|
89
|
-
"@tinacms/schema-tools": "1.6.8",
|
|
87
|
+
"@tinacms/app": "2.1.14",
|
|
88
|
+
"@tinacms/graphql": "1.5.9",
|
|
90
89
|
"@tinacms/metrics": "1.0.8",
|
|
91
|
-
"tinacms": "
|
|
92
|
-
"
|
|
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"
|