@tinacms/cli 0.0.0-bcdf830-20241023064032 → 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 +191 -66
- package/dist/next/commands/build-command/index.d.ts +10 -1
- 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,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.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");
|
|
@@ -977,17 +977,14 @@ var createConfig = async ({
|
|
|
977
977
|
} else {
|
|
978
978
|
await import_fs_extra2.default.outputFile(staticMediaPath, `[]`);
|
|
979
979
|
}
|
|
980
|
-
const isBrowser = typeof window !== "undefined";
|
|
981
980
|
const alias = {
|
|
982
981
|
TINA_IMPORT: configManager.prebuildFilePath,
|
|
983
982
|
SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath,
|
|
984
983
|
STATIC_MEDIA_IMPORT: staticMediaPath,
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
path: import_node_path2.default.join(configManager.spaRootPath, "src", "dummy-client.ts")
|
|
990
|
-
}
|
|
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")
|
|
991
988
|
};
|
|
992
989
|
if (configManager.shouldSkipSDK()) {
|
|
993
990
|
alias["CLIENT_IMPORT"] = import_node_path2.default.join(
|
|
@@ -2212,7 +2209,7 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
2212
2209
|
pathFilter
|
|
2213
2210
|
});
|
|
2214
2211
|
const tinaPathUpdates = modified.filter(
|
|
2215
|
-
(
|
|
2212
|
+
(path14) => path14.startsWith(".tina/__generated__/_schema.json") || path14.startsWith("tina/tina-lock.json")
|
|
2216
2213
|
);
|
|
2217
2214
|
if (tinaPathUpdates.length > 0) {
|
|
2218
2215
|
res = await database.indexContent({
|
|
@@ -2540,6 +2537,8 @@ DevCommand.usage = import_clipanion2.Command.Usage({
|
|
|
2540
2537
|
var import_clipanion3 = require("clipanion");
|
|
2541
2538
|
var import_progress2 = __toESM(require("progress"));
|
|
2542
2539
|
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
2540
|
+
var import_crypto = __toESM(require("crypto"));
|
|
2541
|
+
var import_path6 = __toESM(require("path"));
|
|
2543
2542
|
var import_graphql11 = require("@tinacms/graphql");
|
|
2544
2543
|
|
|
2545
2544
|
// src/next/commands/build-command/server.ts
|
|
@@ -2583,7 +2582,7 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
2583
2582
|
// src/next/commands/build-command/index.ts
|
|
2584
2583
|
var import_schema_tools2 = require("@tinacms/schema-tools");
|
|
2585
2584
|
var import_graphql12 = require("graphql");
|
|
2586
|
-
var
|
|
2585
|
+
var import_core3 = require("@graphql-inspector/core");
|
|
2587
2586
|
|
|
2588
2587
|
// src/next/commands/build-command/waitForDB.ts
|
|
2589
2588
|
var import_progress = __toESM(require("progress"));
|
|
@@ -2685,6 +2684,20 @@ var waitForDB = async (config2, apiUrl, previewName, verbose) => {
|
|
|
2685
2684
|
|
|
2686
2685
|
// src/next/commands/build-command/index.ts
|
|
2687
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
|
|
2688
2701
|
var BuildCommand = class extends BaseCommand {
|
|
2689
2702
|
constructor() {
|
|
2690
2703
|
super(...arguments);
|
|
@@ -2812,7 +2825,7 @@ ${dangerText(e.message)}
|
|
|
2812
2825
|
}
|
|
2813
2826
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2814
2827
|
if (!skipCloudChecks) {
|
|
2815
|
-
const { hasUpstream } = await this.checkClientInfo(
|
|
2828
|
+
const { hasUpstream, timestamp } = await this.checkClientInfo(
|
|
2816
2829
|
configManager,
|
|
2817
2830
|
codegen2.productionUrl,
|
|
2818
2831
|
this.previewBaseBranch
|
|
@@ -2840,7 +2853,16 @@ ${dangerText(e.message)}
|
|
|
2840
2853
|
await this.checkGraphqlSchema(
|
|
2841
2854
|
configManager,
|
|
2842
2855
|
database,
|
|
2843
|
-
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
|
|
2844
2866
|
);
|
|
2845
2867
|
}
|
|
2846
2868
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
@@ -2959,11 +2981,13 @@ ${dangerText(e.message)}
|
|
|
2959
2981
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
2960
2982
|
let branchKnown = false;
|
|
2961
2983
|
let hasUpstream = false;
|
|
2984
|
+
let timestamp;
|
|
2962
2985
|
try {
|
|
2963
2986
|
const res = await request({
|
|
2964
2987
|
token,
|
|
2965
2988
|
url
|
|
2966
2989
|
});
|
|
2990
|
+
timestamp = res.timestamp || 0;
|
|
2967
2991
|
bar2.tick({
|
|
2968
2992
|
prog: "\u2705"
|
|
2969
2993
|
});
|
|
@@ -3005,7 +3029,8 @@ ${dangerText(e.message)}
|
|
|
3005
3029
|
prog: "\u2705"
|
|
3006
3030
|
});
|
|
3007
3031
|
return {
|
|
3008
|
-
hasUpstream
|
|
3032
|
+
hasUpstream,
|
|
3033
|
+
timestamp
|
|
3009
3034
|
};
|
|
3010
3035
|
}
|
|
3011
3036
|
for (let i = 0; i <= 5; i++) {
|
|
@@ -3095,14 +3120,14 @@ ${dangerText(e.message)}
|
|
|
3095
3120
|
throw e;
|
|
3096
3121
|
}
|
|
3097
3122
|
}
|
|
3098
|
-
async checkGraphqlSchema(configManager, database, apiURL) {
|
|
3123
|
+
async checkGraphqlSchema(configManager, database, apiURL, timestamp) {
|
|
3099
3124
|
const bar2 = new import_progress2.default(
|
|
3100
3125
|
"Checking local GraphQL Schema matches server. :prog",
|
|
3101
3126
|
1
|
|
3102
3127
|
);
|
|
3103
3128
|
const { config: config2 } = configManager;
|
|
3104
3129
|
const token = config2.token;
|
|
3105
|
-
const remoteSchema = await fetchRemoteGraphqlSchema({
|
|
3130
|
+
const { remoteSchema, remoteVersion } = await fetchRemoteGraphqlSchema({
|
|
3106
3131
|
url: apiURL,
|
|
3107
3132
|
token
|
|
3108
3133
|
});
|
|
@@ -3122,7 +3147,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3122
3147
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
3123
3148
|
const localGraphqlSchema = (0, import_graphql12.buildASTSchema)(localSchemaDocument);
|
|
3124
3149
|
try {
|
|
3125
|
-
const diffResult = await (0,
|
|
3150
|
+
const diffResult = await (0, import_core3.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
3126
3151
|
if (diffResult.length === 0) {
|
|
3127
3152
|
bar2.tick({
|
|
3128
3153
|
prog: "\u2705"
|
|
@@ -3131,12 +3156,29 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3131
3156
|
bar2.tick({
|
|
3132
3157
|
prog: "\u274C"
|
|
3133
3158
|
});
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
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 += `
|
|
3137
3166
|
|
|
3138
|
-
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
|
+
`;
|
|
3139
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
|
+
`;
|
|
3140
3182
|
throw new Error(errorMessage);
|
|
3141
3183
|
}
|
|
3142
3184
|
} catch (e) {
|
|
@@ -3151,6 +3193,71 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3151
3193
|
}
|
|
3152
3194
|
}
|
|
3153
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
|
+
}
|
|
3154
3261
|
};
|
|
3155
3262
|
BuildCommand.paths = [["build"]];
|
|
3156
3263
|
BuildCommand.usage = import_clipanion3.Command.Usage({
|
|
@@ -3217,7 +3324,25 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3217
3324
|
body
|
|
3218
3325
|
});
|
|
3219
3326
|
const data = await res.json();
|
|
3220
|
-
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();
|
|
3221
3346
|
};
|
|
3222
3347
|
|
|
3223
3348
|
// src/next/commands/audit-command/index.ts
|
|
@@ -3472,25 +3597,25 @@ var import_clipanion6 = require("clipanion");
|
|
|
3472
3597
|
|
|
3473
3598
|
// src/cmds/init/detectEnvironment.ts
|
|
3474
3599
|
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
3475
|
-
var
|
|
3600
|
+
var import_path7 = __toESM(require("path"));
|
|
3476
3601
|
var checkGitignoreForItem = async ({
|
|
3477
3602
|
baseDir,
|
|
3478
3603
|
line
|
|
3479
3604
|
}) => {
|
|
3480
|
-
const gitignoreContent = import_fs_extra8.default.readFileSync(
|
|
3605
|
+
const gitignoreContent = import_fs_extra8.default.readFileSync(import_path7.default.join(baseDir, ".gitignore")).toString();
|
|
3481
3606
|
return gitignoreContent.split("\n").some((item) => item === line);
|
|
3482
3607
|
};
|
|
3483
3608
|
var makeGeneratedFile = async (name2, generatedFileType, parentPath, opts) => {
|
|
3484
3609
|
const result = {
|
|
3485
|
-
fullPathTS:
|
|
3610
|
+
fullPathTS: import_path7.default.join(
|
|
3486
3611
|
parentPath,
|
|
3487
3612
|
`${name2}.${(opts == null ? void 0 : opts.typescriptSuffix) || (opts == null ? void 0 : opts.extensionOverride) || "ts"}`
|
|
3488
3613
|
),
|
|
3489
|
-
fullPathJS:
|
|
3614
|
+
fullPathJS: import_path7.default.join(
|
|
3490
3615
|
parentPath,
|
|
3491
3616
|
`${name2}.${(opts == null ? void 0 : opts.extensionOverride) || "js"}`
|
|
3492
3617
|
),
|
|
3493
|
-
fullPathOverride: (opts == null ? void 0 : opts.extensionOverride) ?
|
|
3618
|
+
fullPathOverride: (opts == null ? void 0 : opts.extensionOverride) ? import_path7.default.join(parentPath, `${name2}.${opts == null ? void 0 : opts.extensionOverride}`) : "",
|
|
3494
3619
|
generatedFileType,
|
|
3495
3620
|
name: name2,
|
|
3496
3621
|
parentPath,
|
|
@@ -3520,16 +3645,16 @@ var detectEnvironment = async ({
|
|
|
3520
3645
|
}) => {
|
|
3521
3646
|
var _a;
|
|
3522
3647
|
const hasForestryConfig = await import_fs_extra8.default.pathExists(
|
|
3523
|
-
|
|
3648
|
+
import_path7.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
3524
3649
|
);
|
|
3525
|
-
const sampleContentPath =
|
|
3650
|
+
const sampleContentPath = import_path7.default.join(
|
|
3526
3651
|
baseDir,
|
|
3527
3652
|
"content",
|
|
3528
3653
|
"posts",
|
|
3529
3654
|
"hello-world.md"
|
|
3530
3655
|
);
|
|
3531
|
-
const usingSrc = import_fs_extra8.default.pathExistsSync(
|
|
3532
|
-
const tinaFolder =
|
|
3656
|
+
const usingSrc = import_fs_extra8.default.pathExistsSync(import_path7.default.join(baseDir, "src")) && (import_fs_extra8.default.pathExistsSync(import_path7.default.join(baseDir, "src", "app")) || import_fs_extra8.default.pathExistsSync(import_path7.default.join(baseDir, "src", "pages")));
|
|
3657
|
+
const tinaFolder = import_path7.default.join(baseDir, "tina");
|
|
3533
3658
|
const tinaConfigExists = Boolean(
|
|
3534
3659
|
await import_fs_extra8.default.pathExists(tinaFolder) && (await import_fs_extra8.default.readdir(tinaFolder)).find((x) => x.includes("config"))
|
|
3535
3660
|
);
|
|
@@ -3543,12 +3668,12 @@ var detectEnvironment = async ({
|
|
|
3543
3668
|
"next-api-handler": await makeGeneratedFile(
|
|
3544
3669
|
"[...routes]",
|
|
3545
3670
|
"next-api-handler",
|
|
3546
|
-
|
|
3671
|
+
import_path7.default.join(...pagesDir, "api", "tina")
|
|
3547
3672
|
),
|
|
3548
3673
|
"reactive-example": await makeGeneratedFile(
|
|
3549
3674
|
"[filename]",
|
|
3550
3675
|
"reactive-example",
|
|
3551
|
-
|
|
3676
|
+
import_path7.default.join(...pagesDir, "demo", "blog"),
|
|
3552
3677
|
{
|
|
3553
3678
|
typescriptSuffix: "tsx"
|
|
3554
3679
|
}
|
|
@@ -3556,13 +3681,13 @@ var detectEnvironment = async ({
|
|
|
3556
3681
|
"users-json": await makeGeneratedFile(
|
|
3557
3682
|
"index",
|
|
3558
3683
|
"users-json",
|
|
3559
|
-
|
|
3684
|
+
import_path7.default.join(baseDir, "content", "users"),
|
|
3560
3685
|
{ extensionOverride: "json" }
|
|
3561
3686
|
),
|
|
3562
3687
|
"sample-content": await makeGeneratedFile(
|
|
3563
3688
|
"hello-world",
|
|
3564
3689
|
"sample-content",
|
|
3565
|
-
|
|
3690
|
+
import_path7.default.join(baseDir, "content", "posts"),
|
|
3566
3691
|
{ extensionOverride: "md" }
|
|
3567
3692
|
)
|
|
3568
3693
|
};
|
|
@@ -3588,13 +3713,13 @@ var detectEnvironment = async ({
|
|
|
3588
3713
|
);
|
|
3589
3714
|
}
|
|
3590
3715
|
}
|
|
3591
|
-
const hasGitIgnore = await import_fs_extra8.default.pathExists(
|
|
3716
|
+
const hasGitIgnore = await import_fs_extra8.default.pathExists(import_path7.default.join(".gitignore"));
|
|
3592
3717
|
const hasGitIgnoreNodeModules = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: "node_modules" });
|
|
3593
3718
|
const hasEnvTina = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env.tina" });
|
|
3594
3719
|
const hasGitIgnoreEnv = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env" });
|
|
3595
3720
|
let frontMatterFormat;
|
|
3596
3721
|
if (hasForestryConfig) {
|
|
3597
|
-
const hugoConfigPath =
|
|
3722
|
+
const hugoConfigPath = import_path7.default.join(rootPath, "config.toml");
|
|
3598
3723
|
if (await import_fs_extra8.default.pathExists(hugoConfigPath)) {
|
|
3599
3724
|
const hugoConfig = await import_fs_extra8.default.readFile(hugoConfigPath, "utf8");
|
|
3600
3725
|
const metaDataFormat = (_a = hugoConfig.match(/metaDataFormat = "(.*)"/)) == null ? void 0 : _a[1];
|
|
@@ -4202,18 +4327,18 @@ var CLICommand = class {
|
|
|
4202
4327
|
};
|
|
4203
4328
|
|
|
4204
4329
|
// src/cmds/init/apply.ts
|
|
4205
|
-
var
|
|
4330
|
+
var import_path11 = __toESM(require("path"));
|
|
4206
4331
|
|
|
4207
4332
|
// src/cmds/forestry-migrate/index.ts
|
|
4208
4333
|
var import_fs_extra10 = __toESM(require("fs-extra"));
|
|
4209
|
-
var
|
|
4334
|
+
var import_path9 = __toESM(require("path"));
|
|
4210
4335
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
|
4211
4336
|
var import_minimatch = __toESM(require("minimatch"));
|
|
4212
4337
|
var import_graphql16 = require("@tinacms/graphql");
|
|
4213
4338
|
|
|
4214
4339
|
// src/cmds/forestry-migrate/util/index.ts
|
|
4215
4340
|
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
4216
|
-
var
|
|
4341
|
+
var import_path8 = __toESM(require("path"));
|
|
4217
4342
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
4218
4343
|
var import_zod = __toESM(require("zod"));
|
|
4219
4344
|
|
|
@@ -4624,7 +4749,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4624
4749
|
return tinaFields;
|
|
4625
4750
|
};
|
|
4626
4751
|
var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false }) => {
|
|
4627
|
-
const templatePath =
|
|
4752
|
+
const templatePath = import_path8.default.join(
|
|
4628
4753
|
pathToForestryConfig,
|
|
4629
4754
|
".forestry",
|
|
4630
4755
|
"front_matter",
|
|
@@ -4699,8 +4824,8 @@ var generateAllTemplates = async ({
|
|
|
4699
4824
|
pathToForestryConfig
|
|
4700
4825
|
}) => {
|
|
4701
4826
|
const allTemplates = (await import_fs_extra10.default.readdir(
|
|
4702
|
-
|
|
4703
|
-
)).map((tem) =>
|
|
4827
|
+
import_path9.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
|
|
4828
|
+
)).map((tem) => import_path9.default.basename(tem, ".yml"));
|
|
4704
4829
|
const templateMap = /* @__PURE__ */ new Map();
|
|
4705
4830
|
const proms = allTemplates.map(async (tem) => {
|
|
4706
4831
|
try {
|
|
@@ -4842,9 +4967,9 @@ var generateCollectionFromForestrySection = (args) => {
|
|
|
4842
4967
|
return c;
|
|
4843
4968
|
} else if (section.type === "document") {
|
|
4844
4969
|
const filePath = section.path;
|
|
4845
|
-
const extname =
|
|
4846
|
-
const fileName =
|
|
4847
|
-
const dir =
|
|
4970
|
+
const extname = import_path9.default.extname(filePath);
|
|
4971
|
+
const fileName = import_path9.default.basename(filePath, extname);
|
|
4972
|
+
const dir = import_path9.default.dirname(filePath);
|
|
4848
4973
|
const ext = checkExt(extname);
|
|
4849
4974
|
if (ext) {
|
|
4850
4975
|
const fields = [];
|
|
@@ -4907,7 +5032,7 @@ var generateCollections = async ({
|
|
|
4907
5032
|
usingTypescript
|
|
4908
5033
|
});
|
|
4909
5034
|
const forestryConfig = await import_fs_extra10.default.readFile(
|
|
4910
|
-
|
|
5035
|
+
import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
4911
5036
|
);
|
|
4912
5037
|
rewriteTemplateKeysInDocs({
|
|
4913
5038
|
templateMap,
|
|
@@ -4938,11 +5063,11 @@ var rewriteTemplateKeysInDocs = (args) => {
|
|
|
4938
5063
|
const { templateObj } = templateMap.get(templateKey);
|
|
4939
5064
|
(_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
|
|
4940
5065
|
try {
|
|
4941
|
-
const filePath =
|
|
5066
|
+
const filePath = import_path9.default.join(page);
|
|
4942
5067
|
if (import_fs_extra10.default.lstatSync(filePath).isDirectory()) {
|
|
4943
5068
|
return;
|
|
4944
5069
|
}
|
|
4945
|
-
const extname =
|
|
5070
|
+
const extname = import_path9.default.extname(filePath);
|
|
4946
5071
|
const fileContent = import_fs_extra10.default.readFileSync(filePath).toString();
|
|
4947
5072
|
const content = (0, import_graphql16.parseFile)(
|
|
4948
5073
|
fileContent,
|
|
@@ -4974,7 +5099,7 @@ var import_fs_extra13 = __toESM(require("fs-extra"));
|
|
|
4974
5099
|
// src/next/commands/codemod-command/index.ts
|
|
4975
5100
|
var import_clipanion5 = require("clipanion");
|
|
4976
5101
|
var import_fs_extra11 = __toESM(require("fs-extra"));
|
|
4977
|
-
var
|
|
5102
|
+
var import_path10 = __toESM(require("path"));
|
|
4978
5103
|
var CodemodCommand = class extends import_clipanion5.Command {
|
|
4979
5104
|
constructor() {
|
|
4980
5105
|
super(...arguments);
|
|
@@ -5018,7 +5143,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
5018
5143
|
logger.error(e.message);
|
|
5019
5144
|
process.exit(1);
|
|
5020
5145
|
}
|
|
5021
|
-
const tinaDestination =
|
|
5146
|
+
const tinaDestination = import_path10.default.join(configManager.rootPath, "tina");
|
|
5022
5147
|
if (await import_fs_extra11.default.existsSync(tinaDestination)) {
|
|
5023
5148
|
logger.info(
|
|
5024
5149
|
`Folder already exists at ${tinaDestination}. Either delete this folder to complete the codemod, or ensure you have properly copied your config from the ".tina" folder.`
|
|
@@ -5033,7 +5158,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
5033
5158
|
};
|
|
5034
5159
|
var writeGitignore = async (rootPath) => {
|
|
5035
5160
|
await import_fs_extra11.default.outputFileSync(
|
|
5036
|
-
|
|
5161
|
+
import_path10.default.join(rootPath, "tina", ".gitignore"),
|
|
5037
5162
|
"__generated__"
|
|
5038
5163
|
);
|
|
5039
5164
|
};
|
|
@@ -5871,8 +5996,8 @@ async function apply({
|
|
|
5871
5996
|
await addConfigFile({
|
|
5872
5997
|
configArgs: {
|
|
5873
5998
|
config: config2,
|
|
5874
|
-
publicFolder:
|
|
5875
|
-
|
|
5999
|
+
publicFolder: import_path11.default.join(
|
|
6000
|
+
import_path11.default.relative(process.cwd(), pathToForestryConfig),
|
|
5876
6001
|
config2.publicFolder
|
|
5877
6002
|
),
|
|
5878
6003
|
collections,
|
|
@@ -5939,18 +6064,18 @@ var createPackageJSON = async () => {
|
|
|
5939
6064
|
};
|
|
5940
6065
|
var createGitignore = async ({ baseDir }) => {
|
|
5941
6066
|
logger.info(logText("No .gitignore found, creating one"));
|
|
5942
|
-
import_fs_extra13.default.outputFileSync(
|
|
6067
|
+
import_fs_extra13.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
|
|
5943
6068
|
};
|
|
5944
6069
|
var updateGitIgnore = async ({
|
|
5945
6070
|
baseDir,
|
|
5946
6071
|
items
|
|
5947
6072
|
}) => {
|
|
5948
6073
|
logger.info(logText(`Adding ${items.join(",")} to .gitignore`));
|
|
5949
|
-
const gitignoreContent = import_fs_extra13.default.readFileSync(
|
|
6074
|
+
const gitignoreContent = import_fs_extra13.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
|
|
5950
6075
|
const newGitignoreContent = [...gitignoreContent.split("\n"), ...items].join(
|
|
5951
6076
|
"\n"
|
|
5952
6077
|
);
|
|
5953
|
-
await import_fs_extra13.default.writeFile(
|
|
6078
|
+
await import_fs_extra13.default.writeFile(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
|
|
5954
6079
|
};
|
|
5955
6080
|
var addDependencies = async (config2, env, params) => {
|
|
5956
6081
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -6020,22 +6145,22 @@ var writeGeneratedFile = async ({
|
|
|
6020
6145
|
content,
|
|
6021
6146
|
typescript
|
|
6022
6147
|
}) => {
|
|
6023
|
-
const { exists, path:
|
|
6148
|
+
const { exists, path: path14, parentPath } = generatedFile.resolve(typescript);
|
|
6024
6149
|
if (exists) {
|
|
6025
6150
|
if (overwrite) {
|
|
6026
|
-
logger.info(`Overwriting file at ${
|
|
6027
|
-
import_fs_extra13.default.outputFileSync(
|
|
6151
|
+
logger.info(`Overwriting file at ${path14}... \u2705`);
|
|
6152
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6028
6153
|
} else {
|
|
6029
|
-
logger.info(`Not overwriting file at ${
|
|
6154
|
+
logger.info(`Not overwriting file at ${path14}.`);
|
|
6030
6155
|
logger.info(
|
|
6031
|
-
logText(`Please add the following to ${
|
|
6156
|
+
logText(`Please add the following to ${path14}:
|
|
6032
6157
|
${indentText(content)}}`)
|
|
6033
6158
|
);
|
|
6034
6159
|
}
|
|
6035
6160
|
} else {
|
|
6036
|
-
logger.info(`Adding file at ${
|
|
6161
|
+
logger.info(`Adding file at ${path14}... \u2705`);
|
|
6037
6162
|
await import_fs_extra13.default.ensureDir(parentPath);
|
|
6038
|
-
import_fs_extra13.default.outputFileSync(
|
|
6163
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6039
6164
|
}
|
|
6040
6165
|
};
|
|
6041
6166
|
var addConfigFile = async ({
|
|
@@ -6118,7 +6243,7 @@ var addContentFile = async ({
|
|
|
6118
6243
|
return () => ({
|
|
6119
6244
|
exists: env.sampleContentExists,
|
|
6120
6245
|
path: env.sampleContentPath,
|
|
6121
|
-
parentPath:
|
|
6246
|
+
parentPath: import_path11.default.dirname(env.sampleContentPath)
|
|
6122
6247
|
});
|
|
6123
6248
|
}
|
|
6124
6249
|
},
|
|
@@ -6141,7 +6266,7 @@ ${titleText(" TinaCMS ")} backend initialized!`));
|
|
|
6141
6266
|
return `${x.key}=${x.value || "***"}`;
|
|
6142
6267
|
}).join("\n") + `
|
|
6143
6268
|
TINA_PUBLIC_IS_LOCAL=true`;
|
|
6144
|
-
const envFile =
|
|
6269
|
+
const envFile = import_path11.default.join(process.cwd(), ".env");
|
|
6145
6270
|
if (!import_fs_extra13.default.existsSync(envFile)) {
|
|
6146
6271
|
logger.info(`Adding .env file to your project... \u2705`);
|
|
6147
6272
|
import_fs_extra13.default.writeFileSync(envFile, envFileText);
|
|
@@ -6205,7 +6330,7 @@ var addReactiveFile = {
|
|
|
6205
6330
|
dataLayer
|
|
6206
6331
|
}) => {
|
|
6207
6332
|
var _a, _b;
|
|
6208
|
-
const packageJsonPath =
|
|
6333
|
+
const packageJsonPath = import_path11.default.join(baseDir, "package.json");
|
|
6209
6334
|
await writeGeneratedFile({
|
|
6210
6335
|
generatedFile,
|
|
6211
6336
|
typescript: config2.typescript,
|
|
@@ -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>;
|
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.3.
|
|
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"
|