@tinacms/cli 0.0.0-d80714b-20241205222511 → 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,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()) {
|
|
@@ -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
|
}
|
|
@@ -939,7 +947,6 @@ async function listFilesRecursively({
|
|
|
939
947
|
}
|
|
940
948
|
var createConfig = async ({
|
|
941
949
|
configManager,
|
|
942
|
-
database,
|
|
943
950
|
apiURL,
|
|
944
951
|
plugins = [],
|
|
945
952
|
noWatch,
|
|
@@ -999,6 +1006,8 @@ var createConfig = async ({
|
|
|
999
1006
|
if (configManager.config.build.basePath) {
|
|
1000
1007
|
basePath = configManager.config.build.basePath;
|
|
1001
1008
|
}
|
|
1009
|
+
const fullVersion = configManager.getTinaGraphQLVersion();
|
|
1010
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
1002
1011
|
const config2 = {
|
|
1003
1012
|
root: configManager.spaRootPath,
|
|
1004
1013
|
base: `/${basePath ? `${(0, import_normalize_path2.default)(basePath)}/` : ""}${(0, import_normalize_path2.default)(
|
|
@@ -1014,7 +1023,7 @@ var createConfig = async ({
|
|
|
1014
1023
|
"process.platform": `"${process.platform}"`,
|
|
1015
1024
|
__API_URL__: `"${apiURL}"`,
|
|
1016
1025
|
__BASE_PATH__: `"${((_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.basePath) || ""}"`,
|
|
1017
|
-
__TINA_GRAPHQL_VERSION__:
|
|
1026
|
+
__TINA_GRAPHQL_VERSION__: version2
|
|
1018
1027
|
},
|
|
1019
1028
|
logLevel: "error",
|
|
1020
1029
|
optimizeDeps: {
|
|
@@ -1788,7 +1797,8 @@ var Codegen = class {
|
|
|
1788
1797
|
const branch = (_a = this.configManager.config) == null ? void 0 : _a.branch;
|
|
1789
1798
|
const clientId = (_b = this.configManager.config) == null ? void 0 : _b.clientId;
|
|
1790
1799
|
const token = (_c = this.configManager.config) == null ? void 0 : _c.token;
|
|
1791
|
-
const
|
|
1800
|
+
const fullVersion = this.configManager.getTinaGraphQLVersion();
|
|
1801
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
1792
1802
|
const baseUrl = ((_d = this.configManager.config.tinaioConfig) == null ? void 0 : _d.contentApiUrlOverride) || `https://${TINA_HOST}`;
|
|
1793
1803
|
if ((!branch || !clientId || !token) && !this.port && !this.configManager.config.contentApiUrlOverride) {
|
|
1794
1804
|
const missing = [];
|
|
@@ -2582,7 +2592,7 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
2582
2592
|
// src/next/commands/build-command/index.ts
|
|
2583
2593
|
var import_schema_tools2 = require("@tinacms/schema-tools");
|
|
2584
2594
|
var import_graphql12 = require("graphql");
|
|
2585
|
-
var
|
|
2595
|
+
var import_core3 = require("@graphql-inspector/core");
|
|
2586
2596
|
|
|
2587
2597
|
// src/next/commands/build-command/waitForDB.ts
|
|
2588
2598
|
var import_progress = __toESM(require("progress"));
|
|
@@ -2684,6 +2694,20 @@ var waitForDB = async (config2, apiUrl, previewName, verbose) => {
|
|
|
2684
2694
|
|
|
2685
2695
|
// src/next/commands/build-command/index.ts
|
|
2686
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
|
|
2687
2711
|
var BuildCommand = class extends BaseCommand {
|
|
2688
2712
|
constructor() {
|
|
2689
2713
|
super(...arguments);
|
|
@@ -2811,7 +2835,7 @@ ${dangerText(e.message)}
|
|
|
2811
2835
|
}
|
|
2812
2836
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2813
2837
|
if (!skipCloudChecks) {
|
|
2814
|
-
const { hasUpstream } = await this.checkClientInfo(
|
|
2838
|
+
const { hasUpstream, timestamp } = await this.checkClientInfo(
|
|
2815
2839
|
configManager,
|
|
2816
2840
|
codegen2.productionUrl,
|
|
2817
2841
|
this.previewBaseBranch
|
|
@@ -2839,14 +2863,16 @@ ${dangerText(e.message)}
|
|
|
2839
2863
|
await this.checkGraphqlSchema(
|
|
2840
2864
|
configManager,
|
|
2841
2865
|
database,
|
|
2842
|
-
codegen2.productionUrl
|
|
2866
|
+
codegen2.productionUrl,
|
|
2867
|
+
timestamp
|
|
2843
2868
|
);
|
|
2844
2869
|
await this.checkTinaSchema(
|
|
2845
2870
|
configManager,
|
|
2846
2871
|
database,
|
|
2847
2872
|
codegen2.productionUrl,
|
|
2848
2873
|
this.previewName,
|
|
2849
|
-
this.verbose
|
|
2874
|
+
this.verbose,
|
|
2875
|
+
timestamp
|
|
2850
2876
|
);
|
|
2851
2877
|
}
|
|
2852
2878
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
@@ -2965,11 +2991,13 @@ ${dangerText(e.message)}
|
|
|
2965
2991
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
2966
2992
|
let branchKnown = false;
|
|
2967
2993
|
let hasUpstream = false;
|
|
2994
|
+
let timestamp;
|
|
2968
2995
|
try {
|
|
2969
2996
|
const res = await request({
|
|
2970
2997
|
token,
|
|
2971
2998
|
url
|
|
2972
2999
|
});
|
|
3000
|
+
timestamp = res.timestamp || 0;
|
|
2973
3001
|
bar2.tick({
|
|
2974
3002
|
prog: "\u2705"
|
|
2975
3003
|
});
|
|
@@ -3011,7 +3039,8 @@ ${dangerText(e.message)}
|
|
|
3011
3039
|
prog: "\u2705"
|
|
3012
3040
|
});
|
|
3013
3041
|
return {
|
|
3014
|
-
hasUpstream
|
|
3042
|
+
hasUpstream,
|
|
3043
|
+
timestamp
|
|
3015
3044
|
};
|
|
3016
3045
|
}
|
|
3017
3046
|
for (let i = 0; i <= 5; i++) {
|
|
@@ -3101,14 +3130,14 @@ ${dangerText(e.message)}
|
|
|
3101
3130
|
throw e;
|
|
3102
3131
|
}
|
|
3103
3132
|
}
|
|
3104
|
-
async checkGraphqlSchema(configManager, database, apiURL) {
|
|
3133
|
+
async checkGraphqlSchema(configManager, database, apiURL, timestamp) {
|
|
3105
3134
|
const bar2 = new import_progress2.default(
|
|
3106
3135
|
"Checking local GraphQL Schema matches server. :prog",
|
|
3107
3136
|
1
|
|
3108
3137
|
);
|
|
3109
3138
|
const { config: config2 } = configManager;
|
|
3110
3139
|
const token = config2.token;
|
|
3111
|
-
const remoteSchema = await fetchRemoteGraphqlSchema({
|
|
3140
|
+
const { remoteSchema, remoteProjectVersion } = await fetchRemoteGraphqlSchema({
|
|
3112
3141
|
url: apiURL,
|
|
3113
3142
|
token
|
|
3114
3143
|
});
|
|
@@ -3128,7 +3157,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3128
3157
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
3129
3158
|
const localGraphqlSchema = (0, import_graphql12.buildASTSchema)(localSchemaDocument);
|
|
3130
3159
|
try {
|
|
3131
|
-
const diffResult = await (0,
|
|
3160
|
+
const diffResult = await (0, import_core3.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
3132
3161
|
if (diffResult.length === 0) {
|
|
3133
3162
|
bar2.tick({
|
|
3134
3163
|
prog: "\u2705"
|
|
@@ -3137,12 +3166,30 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3137
3166
|
bar2.tick({
|
|
3138
3167
|
prog: "\u274C"
|
|
3139
3168
|
});
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
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 += `
|
|
3143
3177
|
|
|
3144
|
-
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
|
+
`;
|
|
3145
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
|
+
`;
|
|
3146
3193
|
throw new Error(errorMessage);
|
|
3147
3194
|
}
|
|
3148
3195
|
} catch (e) {
|
|
@@ -3157,7 +3204,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3157
3204
|
}
|
|
3158
3205
|
}
|
|
3159
3206
|
}
|
|
3160
|
-
async checkTinaSchema(configManager, database, apiURL, previewName, verbose) {
|
|
3207
|
+
async checkTinaSchema(configManager, database, apiURL, previewName, verbose, timestamp) {
|
|
3161
3208
|
const bar2 = new import_progress2.default(
|
|
3162
3209
|
"Checking local Tina Schema matches server. :prog",
|
|
3163
3210
|
1
|
|
@@ -3206,11 +3253,19 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3206
3253
|
prog: "\u274C"
|
|
3207
3254
|
});
|
|
3208
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.`;
|
|
3209
|
-
|
|
3210
|
-
errorMessage += `
|
|
3256
|
+
errorMessage += `
|
|
3211
3257
|
|
|
3212
|
-
Additional info:
|
|
3258
|
+
Additional info:
|
|
3259
|
+
|
|
3260
|
+
`;
|
|
3261
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3262
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3263
|
+
`;
|
|
3213
3264
|
}
|
|
3265
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3266
|
+
timestamp
|
|
3267
|
+
).toUTCString()}
|
|
3268
|
+
`;
|
|
3214
3269
|
throw new Error(errorMessage);
|
|
3215
3270
|
}
|
|
3216
3271
|
}
|
|
@@ -3280,7 +3335,11 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3280
3335
|
body
|
|
3281
3336
|
});
|
|
3282
3337
|
const data = await res.json();
|
|
3283
|
-
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
|
+
};
|
|
3284
3343
|
};
|
|
3285
3344
|
var fetchSchemaSha = async ({
|
|
3286
3345
|
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;
|
|
@@ -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/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": [
|
|
@@ -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",
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"vite": "^4.5.5",
|
|
85
85
|
"yup": "^1.4.0",
|
|
86
86
|
"zod": "^3.23.8",
|
|
87
|
-
"@tinacms/app": "
|
|
88
|
-
"@tinacms/graphql": "1.5.8",
|
|
89
|
-
"@tinacms/schema-tools": "1.6.8",
|
|
90
|
-
"@tinacms/search": "1.0.35",
|
|
87
|
+
"@tinacms/app": "2.1.14",
|
|
91
88
|
"@tinacms/metrics": "1.0.8",
|
|
92
|
-
"tinacms": "
|
|
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"
|