@tinacms/cli 1.6.11 → 1.6.13
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 +163 -56
- package/dist/next/commands/build-command/index.d.ts +10 -1
- package/dist/server/server.d.ts +1 -1
- package/package.json +13 -14
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");
|
|
@@ -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({
|
|
@@ -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
|
|
@@ -2809,7 +2811,7 @@ ${dangerText(e.message)}
|
|
|
2809
2811
|
}
|
|
2810
2812
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2811
2813
|
if (!skipCloudChecks) {
|
|
2812
|
-
const { hasUpstream } = await this.checkClientInfo(
|
|
2814
|
+
const { hasUpstream, timestamp } = await this.checkClientInfo(
|
|
2813
2815
|
configManager,
|
|
2814
2816
|
codegen2.productionUrl,
|
|
2815
2817
|
this.previewBaseBranch
|
|
@@ -2837,7 +2839,16 @@ ${dangerText(e.message)}
|
|
|
2837
2839
|
await this.checkGraphqlSchema(
|
|
2838
2840
|
configManager,
|
|
2839
2841
|
database,
|
|
2840
|
-
codegen2.productionUrl
|
|
2842
|
+
codegen2.productionUrl,
|
|
2843
|
+
timestamp
|
|
2844
|
+
);
|
|
2845
|
+
await this.checkTinaSchema(
|
|
2846
|
+
configManager,
|
|
2847
|
+
database,
|
|
2848
|
+
codegen2.productionUrl,
|
|
2849
|
+
this.previewName,
|
|
2850
|
+
this.verbose,
|
|
2851
|
+
timestamp
|
|
2841
2852
|
);
|
|
2842
2853
|
}
|
|
2843
2854
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
@@ -2956,11 +2967,13 @@ ${dangerText(e.message)}
|
|
|
2956
2967
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
2957
2968
|
let branchKnown = false;
|
|
2958
2969
|
let hasUpstream = false;
|
|
2970
|
+
let timestamp;
|
|
2959
2971
|
try {
|
|
2960
2972
|
const res = await request({
|
|
2961
2973
|
token,
|
|
2962
2974
|
url
|
|
2963
2975
|
});
|
|
2976
|
+
timestamp = res.timestamp || 0;
|
|
2964
2977
|
bar2.tick({
|
|
2965
2978
|
prog: "\u2705"
|
|
2966
2979
|
});
|
|
@@ -3002,7 +3015,8 @@ ${dangerText(e.message)}
|
|
|
3002
3015
|
prog: "\u2705"
|
|
3003
3016
|
});
|
|
3004
3017
|
return {
|
|
3005
|
-
hasUpstream
|
|
3018
|
+
hasUpstream,
|
|
3019
|
+
timestamp
|
|
3006
3020
|
};
|
|
3007
3021
|
}
|
|
3008
3022
|
for (let i = 0; i <= 5; i++) {
|
|
@@ -3092,14 +3106,14 @@ ${dangerText(e.message)}
|
|
|
3092
3106
|
throw e;
|
|
3093
3107
|
}
|
|
3094
3108
|
}
|
|
3095
|
-
async checkGraphqlSchema(configManager, database, apiURL) {
|
|
3109
|
+
async checkGraphqlSchema(configManager, database, apiURL, timestamp) {
|
|
3096
3110
|
const bar2 = new import_progress2.default(
|
|
3097
3111
|
"Checking local GraphQL Schema matches server. :prog",
|
|
3098
3112
|
1
|
|
3099
3113
|
);
|
|
3100
3114
|
const { config: config2 } = configManager;
|
|
3101
3115
|
const token = config2.token;
|
|
3102
|
-
const remoteSchema = await fetchRemoteGraphqlSchema({
|
|
3116
|
+
const { remoteSchema, remoteVersion } = await fetchRemoteGraphqlSchema({
|
|
3103
3117
|
url: apiURL,
|
|
3104
3118
|
token
|
|
3105
3119
|
});
|
|
@@ -3129,11 +3143,21 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3129
3143
|
prog: "\u274C"
|
|
3130
3144
|
});
|
|
3131
3145
|
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.`;
|
|
3132
|
-
|
|
3133
|
-
errorMessage += `
|
|
3146
|
+
errorMessage += `
|
|
3134
3147
|
|
|
3135
|
-
Additional info:
|
|
3148
|
+
Additional info:
|
|
3149
|
+
|
|
3150
|
+
`;
|
|
3151
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3152
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3153
|
+
`;
|
|
3136
3154
|
}
|
|
3155
|
+
errorMessage += ` Local GraphQL version: ${configManager.getTinaGraphQLVersion()} / Remote GraphQL version: ${remoteVersion}
|
|
3156
|
+
`;
|
|
3157
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3158
|
+
timestamp
|
|
3159
|
+
).toUTCString()}
|
|
3160
|
+
`;
|
|
3137
3161
|
throw new Error(errorMessage);
|
|
3138
3162
|
}
|
|
3139
3163
|
} catch (e) {
|
|
@@ -3148,6 +3172,71 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3148
3172
|
}
|
|
3149
3173
|
}
|
|
3150
3174
|
}
|
|
3175
|
+
async checkTinaSchema(configManager, database, apiURL, previewName, verbose, timestamp) {
|
|
3176
|
+
const bar2 = new import_progress2.default(
|
|
3177
|
+
"Checking local Tina Schema matches server. :prog",
|
|
3178
|
+
1
|
|
3179
|
+
);
|
|
3180
|
+
const { config: config2 } = configManager;
|
|
3181
|
+
const token = config2.token;
|
|
3182
|
+
const { clientId, branch, isLocalClient, host } = (0, import_schema_tools2.parseURL)(apiURL);
|
|
3183
|
+
if (isLocalClient || !host || !clientId || !branch) {
|
|
3184
|
+
if (verbose) {
|
|
3185
|
+
logger.info(logText("Not using Tina Cloud, skipping Tina Schema check"));
|
|
3186
|
+
}
|
|
3187
|
+
return;
|
|
3188
|
+
}
|
|
3189
|
+
const { tinaSchema: remoteTinaSchemaSha } = await fetchSchemaSha({
|
|
3190
|
+
url: `https://${host}/db/${clientId}/${previewName || branch}/schemaSha`,
|
|
3191
|
+
token
|
|
3192
|
+
});
|
|
3193
|
+
if (!remoteTinaSchemaSha) {
|
|
3194
|
+
bar2.tick({
|
|
3195
|
+
prog: "\u274C"
|
|
3196
|
+
});
|
|
3197
|
+
let errorMessage = `The remote Tina schema does not exist. Check indexing for this branch.`;
|
|
3198
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3199
|
+
errorMessage += `
|
|
3200
|
+
|
|
3201
|
+
Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
3202
|
+
}
|
|
3203
|
+
throw new Error(errorMessage);
|
|
3204
|
+
}
|
|
3205
|
+
if (!database.bridge) {
|
|
3206
|
+
throw new Error(`No bridge configured`);
|
|
3207
|
+
}
|
|
3208
|
+
const localTinaSchema = JSON.parse(
|
|
3209
|
+
await database.bridge.get(
|
|
3210
|
+
import_path6.default.join(database.tinaDirectory, "__generated__", "_schema.json")
|
|
3211
|
+
)
|
|
3212
|
+
);
|
|
3213
|
+
localTinaSchema.version = void 0;
|
|
3214
|
+
const localTinaSchemaSha = import_crypto.default.createHash("sha256").update(JSON.stringify(localTinaSchema)).digest("hex");
|
|
3215
|
+
if (localTinaSchemaSha === remoteTinaSchemaSha) {
|
|
3216
|
+
bar2.tick({
|
|
3217
|
+
prog: "\u2705"
|
|
3218
|
+
});
|
|
3219
|
+
} else {
|
|
3220
|
+
bar2.tick({
|
|
3221
|
+
prog: "\u274C"
|
|
3222
|
+
});
|
|
3223
|
+
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.`;
|
|
3224
|
+
errorMessage += `
|
|
3225
|
+
|
|
3226
|
+
Additional info:
|
|
3227
|
+
|
|
3228
|
+
`;
|
|
3229
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3230
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3231
|
+
`;
|
|
3232
|
+
}
|
|
3233
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3234
|
+
timestamp
|
|
3235
|
+
).toUTCString()}
|
|
3236
|
+
`;
|
|
3237
|
+
throw new Error(errorMessage);
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3151
3240
|
};
|
|
3152
3241
|
BuildCommand.paths = [["build"]];
|
|
3153
3242
|
BuildCommand.usage = import_clipanion3.Command.Usage({
|
|
@@ -3214,7 +3303,25 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3214
3303
|
body
|
|
3215
3304
|
});
|
|
3216
3305
|
const data = await res.json();
|
|
3217
|
-
return
|
|
3306
|
+
return {
|
|
3307
|
+
remoteSchema: data == null ? void 0 : data.data,
|
|
3308
|
+
remoteVersion: res.headers.get("tinacms-grapqhl-version")
|
|
3309
|
+
};
|
|
3310
|
+
};
|
|
3311
|
+
var fetchSchemaSha = async ({
|
|
3312
|
+
url,
|
|
3313
|
+
token
|
|
3314
|
+
}) => {
|
|
3315
|
+
const headers = new Headers();
|
|
3316
|
+
if (token) {
|
|
3317
|
+
headers.append("X-API-KEY", token);
|
|
3318
|
+
}
|
|
3319
|
+
const res = await fetch(url, {
|
|
3320
|
+
method: "GET",
|
|
3321
|
+
headers,
|
|
3322
|
+
cache: "no-cache"
|
|
3323
|
+
});
|
|
3324
|
+
return res.json();
|
|
3218
3325
|
};
|
|
3219
3326
|
|
|
3220
3327
|
// src/next/commands/audit-command/index.ts
|
|
@@ -3469,25 +3576,25 @@ var import_clipanion6 = require("clipanion");
|
|
|
3469
3576
|
|
|
3470
3577
|
// src/cmds/init/detectEnvironment.ts
|
|
3471
3578
|
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
3472
|
-
var
|
|
3579
|
+
var import_path7 = __toESM(require("path"));
|
|
3473
3580
|
var checkGitignoreForItem = async ({
|
|
3474
3581
|
baseDir,
|
|
3475
3582
|
line
|
|
3476
3583
|
}) => {
|
|
3477
|
-
const gitignoreContent = import_fs_extra8.default.readFileSync(
|
|
3584
|
+
const gitignoreContent = import_fs_extra8.default.readFileSync(import_path7.default.join(baseDir, ".gitignore")).toString();
|
|
3478
3585
|
return gitignoreContent.split("\n").some((item) => item === line);
|
|
3479
3586
|
};
|
|
3480
3587
|
var makeGeneratedFile = async (name2, generatedFileType, parentPath, opts) => {
|
|
3481
3588
|
const result = {
|
|
3482
|
-
fullPathTS:
|
|
3589
|
+
fullPathTS: import_path7.default.join(
|
|
3483
3590
|
parentPath,
|
|
3484
3591
|
`${name2}.${(opts == null ? void 0 : opts.typescriptSuffix) || (opts == null ? void 0 : opts.extensionOverride) || "ts"}`
|
|
3485
3592
|
),
|
|
3486
|
-
fullPathJS:
|
|
3593
|
+
fullPathJS: import_path7.default.join(
|
|
3487
3594
|
parentPath,
|
|
3488
3595
|
`${name2}.${(opts == null ? void 0 : opts.extensionOverride) || "js"}`
|
|
3489
3596
|
),
|
|
3490
|
-
fullPathOverride: (opts == null ? void 0 : opts.extensionOverride) ?
|
|
3597
|
+
fullPathOverride: (opts == null ? void 0 : opts.extensionOverride) ? import_path7.default.join(parentPath, `${name2}.${opts == null ? void 0 : opts.extensionOverride}`) : "",
|
|
3491
3598
|
generatedFileType,
|
|
3492
3599
|
name: name2,
|
|
3493
3600
|
parentPath,
|
|
@@ -3517,16 +3624,16 @@ var detectEnvironment = async ({
|
|
|
3517
3624
|
}) => {
|
|
3518
3625
|
var _a;
|
|
3519
3626
|
const hasForestryConfig = await import_fs_extra8.default.pathExists(
|
|
3520
|
-
|
|
3627
|
+
import_path7.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
3521
3628
|
);
|
|
3522
|
-
const sampleContentPath =
|
|
3629
|
+
const sampleContentPath = import_path7.default.join(
|
|
3523
3630
|
baseDir,
|
|
3524
3631
|
"content",
|
|
3525
3632
|
"posts",
|
|
3526
3633
|
"hello-world.md"
|
|
3527
3634
|
);
|
|
3528
|
-
const usingSrc = import_fs_extra8.default.pathExistsSync(
|
|
3529
|
-
const tinaFolder =
|
|
3635
|
+
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")));
|
|
3636
|
+
const tinaFolder = import_path7.default.join(baseDir, "tina");
|
|
3530
3637
|
const tinaConfigExists = Boolean(
|
|
3531
3638
|
await import_fs_extra8.default.pathExists(tinaFolder) && (await import_fs_extra8.default.readdir(tinaFolder)).find((x) => x.includes("config"))
|
|
3532
3639
|
);
|
|
@@ -3540,12 +3647,12 @@ var detectEnvironment = async ({
|
|
|
3540
3647
|
"next-api-handler": await makeGeneratedFile(
|
|
3541
3648
|
"[...routes]",
|
|
3542
3649
|
"next-api-handler",
|
|
3543
|
-
|
|
3650
|
+
import_path7.default.join(...pagesDir, "api", "tina")
|
|
3544
3651
|
),
|
|
3545
3652
|
"reactive-example": await makeGeneratedFile(
|
|
3546
3653
|
"[filename]",
|
|
3547
3654
|
"reactive-example",
|
|
3548
|
-
|
|
3655
|
+
import_path7.default.join(...pagesDir, "demo", "blog"),
|
|
3549
3656
|
{
|
|
3550
3657
|
typescriptSuffix: "tsx"
|
|
3551
3658
|
}
|
|
@@ -3553,13 +3660,13 @@ var detectEnvironment = async ({
|
|
|
3553
3660
|
"users-json": await makeGeneratedFile(
|
|
3554
3661
|
"index",
|
|
3555
3662
|
"users-json",
|
|
3556
|
-
|
|
3663
|
+
import_path7.default.join(baseDir, "content", "users"),
|
|
3557
3664
|
{ extensionOverride: "json" }
|
|
3558
3665
|
),
|
|
3559
3666
|
"sample-content": await makeGeneratedFile(
|
|
3560
3667
|
"hello-world",
|
|
3561
3668
|
"sample-content",
|
|
3562
|
-
|
|
3669
|
+
import_path7.default.join(baseDir, "content", "posts"),
|
|
3563
3670
|
{ extensionOverride: "md" }
|
|
3564
3671
|
)
|
|
3565
3672
|
};
|
|
@@ -3585,13 +3692,13 @@ var detectEnvironment = async ({
|
|
|
3585
3692
|
);
|
|
3586
3693
|
}
|
|
3587
3694
|
}
|
|
3588
|
-
const hasGitIgnore = await import_fs_extra8.default.pathExists(
|
|
3695
|
+
const hasGitIgnore = await import_fs_extra8.default.pathExists(import_path7.default.join(".gitignore"));
|
|
3589
3696
|
const hasGitIgnoreNodeModules = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: "node_modules" });
|
|
3590
3697
|
const hasEnvTina = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env.tina" });
|
|
3591
3698
|
const hasGitIgnoreEnv = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env" });
|
|
3592
3699
|
let frontMatterFormat;
|
|
3593
3700
|
if (hasForestryConfig) {
|
|
3594
|
-
const hugoConfigPath =
|
|
3701
|
+
const hugoConfigPath = import_path7.default.join(rootPath, "config.toml");
|
|
3595
3702
|
if (await import_fs_extra8.default.pathExists(hugoConfigPath)) {
|
|
3596
3703
|
const hugoConfig = await import_fs_extra8.default.readFile(hugoConfigPath, "utf8");
|
|
3597
3704
|
const metaDataFormat = (_a = hugoConfig.match(/metaDataFormat = "(.*)"/)) == null ? void 0 : _a[1];
|
|
@@ -4199,18 +4306,18 @@ var CLICommand = class {
|
|
|
4199
4306
|
};
|
|
4200
4307
|
|
|
4201
4308
|
// src/cmds/init/apply.ts
|
|
4202
|
-
var
|
|
4309
|
+
var import_path11 = __toESM(require("path"));
|
|
4203
4310
|
|
|
4204
4311
|
// src/cmds/forestry-migrate/index.ts
|
|
4205
4312
|
var import_fs_extra10 = __toESM(require("fs-extra"));
|
|
4206
|
-
var
|
|
4313
|
+
var import_path9 = __toESM(require("path"));
|
|
4207
4314
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
|
4208
4315
|
var import_minimatch = __toESM(require("minimatch"));
|
|
4209
4316
|
var import_graphql16 = require("@tinacms/graphql");
|
|
4210
4317
|
|
|
4211
4318
|
// src/cmds/forestry-migrate/util/index.ts
|
|
4212
4319
|
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
4213
|
-
var
|
|
4320
|
+
var import_path8 = __toESM(require("path"));
|
|
4214
4321
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
4215
4322
|
var import_zod = __toESM(require("zod"));
|
|
4216
4323
|
|
|
@@ -4621,7 +4728,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4621
4728
|
return tinaFields;
|
|
4622
4729
|
};
|
|
4623
4730
|
var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false }) => {
|
|
4624
|
-
const templatePath =
|
|
4731
|
+
const templatePath = import_path8.default.join(
|
|
4625
4732
|
pathToForestryConfig,
|
|
4626
4733
|
".forestry",
|
|
4627
4734
|
"front_matter",
|
|
@@ -4696,8 +4803,8 @@ var generateAllTemplates = async ({
|
|
|
4696
4803
|
pathToForestryConfig
|
|
4697
4804
|
}) => {
|
|
4698
4805
|
const allTemplates = (await import_fs_extra10.default.readdir(
|
|
4699
|
-
|
|
4700
|
-
)).map((tem) =>
|
|
4806
|
+
import_path9.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
|
|
4807
|
+
)).map((tem) => import_path9.default.basename(tem, ".yml"));
|
|
4701
4808
|
const templateMap = /* @__PURE__ */ new Map();
|
|
4702
4809
|
const proms = allTemplates.map(async (tem) => {
|
|
4703
4810
|
try {
|
|
@@ -4839,9 +4946,9 @@ var generateCollectionFromForestrySection = (args) => {
|
|
|
4839
4946
|
return c;
|
|
4840
4947
|
} else if (section.type === "document") {
|
|
4841
4948
|
const filePath = section.path;
|
|
4842
|
-
const extname =
|
|
4843
|
-
const fileName =
|
|
4844
|
-
const dir =
|
|
4949
|
+
const extname = import_path9.default.extname(filePath);
|
|
4950
|
+
const fileName = import_path9.default.basename(filePath, extname);
|
|
4951
|
+
const dir = import_path9.default.dirname(filePath);
|
|
4845
4952
|
const ext = checkExt(extname);
|
|
4846
4953
|
if (ext) {
|
|
4847
4954
|
const fields = [];
|
|
@@ -4904,7 +5011,7 @@ var generateCollections = async ({
|
|
|
4904
5011
|
usingTypescript
|
|
4905
5012
|
});
|
|
4906
5013
|
const forestryConfig = await import_fs_extra10.default.readFile(
|
|
4907
|
-
|
|
5014
|
+
import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
4908
5015
|
);
|
|
4909
5016
|
rewriteTemplateKeysInDocs({
|
|
4910
5017
|
templateMap,
|
|
@@ -4935,11 +5042,11 @@ var rewriteTemplateKeysInDocs = (args) => {
|
|
|
4935
5042
|
const { templateObj } = templateMap.get(templateKey);
|
|
4936
5043
|
(_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
|
|
4937
5044
|
try {
|
|
4938
|
-
const filePath =
|
|
5045
|
+
const filePath = import_path9.default.join(page);
|
|
4939
5046
|
if (import_fs_extra10.default.lstatSync(filePath).isDirectory()) {
|
|
4940
5047
|
return;
|
|
4941
5048
|
}
|
|
4942
|
-
const extname =
|
|
5049
|
+
const extname = import_path9.default.extname(filePath);
|
|
4943
5050
|
const fileContent = import_fs_extra10.default.readFileSync(filePath).toString();
|
|
4944
5051
|
const content = (0, import_graphql16.parseFile)(
|
|
4945
5052
|
fileContent,
|
|
@@ -4971,7 +5078,7 @@ var import_fs_extra13 = __toESM(require("fs-extra"));
|
|
|
4971
5078
|
// src/next/commands/codemod-command/index.ts
|
|
4972
5079
|
var import_clipanion5 = require("clipanion");
|
|
4973
5080
|
var import_fs_extra11 = __toESM(require("fs-extra"));
|
|
4974
|
-
var
|
|
5081
|
+
var import_path10 = __toESM(require("path"));
|
|
4975
5082
|
var CodemodCommand = class extends import_clipanion5.Command {
|
|
4976
5083
|
constructor() {
|
|
4977
5084
|
super(...arguments);
|
|
@@ -5015,7 +5122,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
5015
5122
|
logger.error(e.message);
|
|
5016
5123
|
process.exit(1);
|
|
5017
5124
|
}
|
|
5018
|
-
const tinaDestination =
|
|
5125
|
+
const tinaDestination = import_path10.default.join(configManager.rootPath, "tina");
|
|
5019
5126
|
if (await import_fs_extra11.default.existsSync(tinaDestination)) {
|
|
5020
5127
|
logger.info(
|
|
5021
5128
|
`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.`
|
|
@@ -5030,7 +5137,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
5030
5137
|
};
|
|
5031
5138
|
var writeGitignore = async (rootPath) => {
|
|
5032
5139
|
await import_fs_extra11.default.outputFileSync(
|
|
5033
|
-
|
|
5140
|
+
import_path10.default.join(rootPath, "tina", ".gitignore"),
|
|
5034
5141
|
"__generated__"
|
|
5035
5142
|
);
|
|
5036
5143
|
};
|
|
@@ -5868,8 +5975,8 @@ async function apply({
|
|
|
5868
5975
|
await addConfigFile({
|
|
5869
5976
|
configArgs: {
|
|
5870
5977
|
config: config2,
|
|
5871
|
-
publicFolder:
|
|
5872
|
-
|
|
5978
|
+
publicFolder: import_path11.default.join(
|
|
5979
|
+
import_path11.default.relative(process.cwd(), pathToForestryConfig),
|
|
5873
5980
|
config2.publicFolder
|
|
5874
5981
|
),
|
|
5875
5982
|
collections,
|
|
@@ -5936,18 +6043,18 @@ var createPackageJSON = async () => {
|
|
|
5936
6043
|
};
|
|
5937
6044
|
var createGitignore = async ({ baseDir }) => {
|
|
5938
6045
|
logger.info(logText("No .gitignore found, creating one"));
|
|
5939
|
-
import_fs_extra13.default.outputFileSync(
|
|
6046
|
+
import_fs_extra13.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
|
|
5940
6047
|
};
|
|
5941
6048
|
var updateGitIgnore = async ({
|
|
5942
6049
|
baseDir,
|
|
5943
6050
|
items
|
|
5944
6051
|
}) => {
|
|
5945
6052
|
logger.info(logText(`Adding ${items.join(",")} to .gitignore`));
|
|
5946
|
-
const gitignoreContent = import_fs_extra13.default.readFileSync(
|
|
6053
|
+
const gitignoreContent = import_fs_extra13.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
|
|
5947
6054
|
const newGitignoreContent = [...gitignoreContent.split("\n"), ...items].join(
|
|
5948
6055
|
"\n"
|
|
5949
6056
|
);
|
|
5950
|
-
await import_fs_extra13.default.writeFile(
|
|
6057
|
+
await import_fs_extra13.default.writeFile(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
|
|
5951
6058
|
};
|
|
5952
6059
|
var addDependencies = async (config2, env, params) => {
|
|
5953
6060
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -6017,22 +6124,22 @@ var writeGeneratedFile = async ({
|
|
|
6017
6124
|
content,
|
|
6018
6125
|
typescript
|
|
6019
6126
|
}) => {
|
|
6020
|
-
const { exists, path:
|
|
6127
|
+
const { exists, path: path14, parentPath } = generatedFile.resolve(typescript);
|
|
6021
6128
|
if (exists) {
|
|
6022
6129
|
if (overwrite) {
|
|
6023
|
-
logger.info(`Overwriting file at ${
|
|
6024
|
-
import_fs_extra13.default.outputFileSync(
|
|
6130
|
+
logger.info(`Overwriting file at ${path14}... \u2705`);
|
|
6131
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6025
6132
|
} else {
|
|
6026
|
-
logger.info(`Not overwriting file at ${
|
|
6133
|
+
logger.info(`Not overwriting file at ${path14}.`);
|
|
6027
6134
|
logger.info(
|
|
6028
|
-
logText(`Please add the following to ${
|
|
6135
|
+
logText(`Please add the following to ${path14}:
|
|
6029
6136
|
${indentText(content)}}`)
|
|
6030
6137
|
);
|
|
6031
6138
|
}
|
|
6032
6139
|
} else {
|
|
6033
|
-
logger.info(`Adding file at ${
|
|
6140
|
+
logger.info(`Adding file at ${path14}... \u2705`);
|
|
6034
6141
|
await import_fs_extra13.default.ensureDir(parentPath);
|
|
6035
|
-
import_fs_extra13.default.outputFileSync(
|
|
6142
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6036
6143
|
}
|
|
6037
6144
|
};
|
|
6038
6145
|
var addConfigFile = async ({
|
|
@@ -6115,7 +6222,7 @@ var addContentFile = async ({
|
|
|
6115
6222
|
return () => ({
|
|
6116
6223
|
exists: env.sampleContentExists,
|
|
6117
6224
|
path: env.sampleContentPath,
|
|
6118
|
-
parentPath:
|
|
6225
|
+
parentPath: import_path11.default.dirname(env.sampleContentPath)
|
|
6119
6226
|
});
|
|
6120
6227
|
}
|
|
6121
6228
|
},
|
|
@@ -6138,7 +6245,7 @@ ${titleText(" TinaCMS ")} backend initialized!`));
|
|
|
6138
6245
|
return `${x.key}=${x.value || "***"}`;
|
|
6139
6246
|
}).join("\n") + `
|
|
6140
6247
|
TINA_PUBLIC_IS_LOCAL=true`;
|
|
6141
|
-
const envFile =
|
|
6248
|
+
const envFile = import_path11.default.join(process.cwd(), ".env");
|
|
6142
6249
|
if (!import_fs_extra13.default.existsSync(envFile)) {
|
|
6143
6250
|
logger.info(`Adding .env file to your project... \u2705`);
|
|
6144
6251
|
import_fs_extra13.default.writeFileSync(envFile, envFileText);
|
|
@@ -6202,7 +6309,7 @@ var addReactiveFile = {
|
|
|
6202
6309
|
dataLayer
|
|
6203
6310
|
}) => {
|
|
6204
6311
|
var _a, _b;
|
|
6205
|
-
const packageJsonPath =
|
|
6312
|
+
const packageJsonPath = import_path11.default.join(baseDir, "package.json");
|
|
6206
6313
|
await writeGeneratedFile({
|
|
6207
6314
|
generatedFile,
|
|
6208
6315
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,6 @@
|
|
|
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
30
|
"@types/fs-extra": "^11.0.4",
|
|
32
31
|
"@types/jest": "26.0.4",
|
|
@@ -38,18 +37,18 @@
|
|
|
38
37
|
"@types/prompts": "^2.4.9",
|
|
39
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
85
|
"yup": "^1.4.0",
|
|
87
86
|
"zod": "^3.23.8",
|
|
88
|
-
"@tinacms/
|
|
89
|
-
"@tinacms/
|
|
90
|
-
"@tinacms/metrics": "1.0.
|
|
91
|
-
"@tinacms/schema-tools": "1.6.
|
|
92
|
-
"@tinacms/search": "1.0.
|
|
93
|
-
"tinacms": "2.
|
|
87
|
+
"@tinacms/graphql": "1.5.8",
|
|
88
|
+
"@tinacms/app": "2.1.13",
|
|
89
|
+
"@tinacms/metrics": "1.0.8",
|
|
90
|
+
"@tinacms/schema-tools": "1.6.8",
|
|
91
|
+
"@tinacms/search": "1.0.35",
|
|
92
|
+
"tinacms": "2.5.1"
|
|
94
93
|
},
|
|
95
94
|
"publishConfig": {
|
|
96
95
|
"registry": "https://registry.npmjs.org"
|