@tinacms/cli 0.0.0-e70425b-20241028042614 → 0.0.0-ea9cd70-20250214011423
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
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -31,7 +35,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
35
|
var import_clipanion8 = require("clipanion");
|
|
32
36
|
|
|
33
37
|
// package.json
|
|
34
|
-
var version = "1.
|
|
38
|
+
var version = "1.8.4";
|
|
35
39
|
|
|
36
40
|
// src/next/commands/dev-command/index.ts
|
|
37
41
|
var import_clipanion2 = require("clipanion");
|
|
@@ -57,7 +61,10 @@ function isUnicodeSupported() {
|
|
|
57
61
|
if (process.platform !== "win32") {
|
|
58
62
|
return process.env.TERM !== "linux";
|
|
59
63
|
}
|
|
60
|
-
return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) ||
|
|
64
|
+
return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) || // Windows Terminal
|
|
65
|
+
Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
|
66
|
+
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
67
|
+
process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
// src/logger/index.ts
|
|
@@ -212,7 +219,7 @@ var ConfigManager = class {
|
|
|
212
219
|
this.generatedCachePath = import_path.default.join(
|
|
213
220
|
this.generatedFolderPath,
|
|
214
221
|
".cache",
|
|
215
|
-
String(new Date().getTime())
|
|
222
|
+
String((/* @__PURE__ */ new Date()).getTime())
|
|
216
223
|
);
|
|
217
224
|
this.generatedGraphQLGQLPath = import_path.default.join(
|
|
218
225
|
this.generatedFolderPath,
|
|
@@ -355,17 +362,22 @@ var ConfigManager = class {
|
|
|
355
362
|
);
|
|
356
363
|
}
|
|
357
364
|
getTinaGraphQLVersion() {
|
|
358
|
-
var _a, _b;
|
|
359
365
|
if (this.tinaGraphQLVersionFromCLI) {
|
|
360
|
-
|
|
366
|
+
const version2 = this.tinaGraphQLVersionFromCLI.split(".");
|
|
367
|
+
return {
|
|
368
|
+
fullVersion: this.tinaGraphQLVersionFromCLI,
|
|
369
|
+
major: version2[0] || "x",
|
|
370
|
+
minor: version2[1] || "x",
|
|
371
|
+
patch: version2[2] || "x"
|
|
372
|
+
};
|
|
361
373
|
}
|
|
362
374
|
const generatedSchema = import_fs_extra.default.readJSONSync(this.generatedSchemaJSONPath);
|
|
363
|
-
if (!generatedSchema || !(typeof (generatedSchema == null ? void 0 : generatedSchema.version) !== "undefined")
|
|
375
|
+
if (!generatedSchema || !(typeof (generatedSchema == null ? void 0 : generatedSchema.version) !== "undefined")) {
|
|
364
376
|
throw new Error(
|
|
365
377
|
`Can not find Tina GraphQL version in ${this.generatedSchemaJSONPath}`
|
|
366
378
|
);
|
|
367
379
|
}
|
|
368
|
-
return
|
|
380
|
+
return generatedSchema.version;
|
|
369
381
|
}
|
|
370
382
|
printGeneratedClientFilePath() {
|
|
371
383
|
if (this.isUsingTs()) {
|
|
@@ -394,6 +406,9 @@ var ConfigManager = class {
|
|
|
394
406
|
}
|
|
395
407
|
throw `No path provided to print`;
|
|
396
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Given a filepath without an extension, find the first match (eg. tsx, ts, jsx, js)
|
|
411
|
+
*/
|
|
397
412
|
async getPathWithExtension(filepath) {
|
|
398
413
|
const extensions = ["tsx", "ts", "jsx", "js"];
|
|
399
414
|
let result;
|
|
@@ -427,7 +442,10 @@ var ConfigManager = class {
|
|
|
427
442
|
}
|
|
428
443
|
async loadConfigFile(generatedFolderPath, configFilePath) {
|
|
429
444
|
const tmpdir = import_path.default.join(import_os.default.tmpdir(), Date.now().toString());
|
|
430
|
-
const
|
|
445
|
+
const preBuildConfigPath = import_path.default.join(
|
|
446
|
+
this.generatedFolderPath,
|
|
447
|
+
"config.prebuild.jsx"
|
|
448
|
+
);
|
|
431
449
|
const outfile = import_path.default.join(tmpdir, "config.build.jsx");
|
|
432
450
|
const outfile2 = import_path.default.join(tmpdir, "config.build.js");
|
|
433
451
|
const tempTSConfigFile = import_path.default.join(tmpdir, "tsconfig.json");
|
|
@@ -441,7 +459,7 @@ var ConfigManager = class {
|
|
|
441
459
|
logLevel: "silent",
|
|
442
460
|
packages: "external",
|
|
443
461
|
ignoreAnnotations: true,
|
|
444
|
-
outfile:
|
|
462
|
+
outfile: preBuildConfigPath,
|
|
445
463
|
loader: loaders,
|
|
446
464
|
metafile: true
|
|
447
465
|
});
|
|
@@ -464,6 +482,7 @@ var ConfigManager = class {
|
|
|
464
482
|
await esbuild.build({
|
|
465
483
|
entryPoints: [outfile],
|
|
466
484
|
bundle: true,
|
|
485
|
+
// Suppress warning about comparison with -0 from client module
|
|
467
486
|
logLevel: "silent",
|
|
468
487
|
platform: "node",
|
|
469
488
|
outfile: outfile2,
|
|
@@ -481,7 +500,7 @@ var ConfigManager = class {
|
|
|
481
500
|
import_fs_extra.default.removeSync(outfile2);
|
|
482
501
|
return {
|
|
483
502
|
config: result.default,
|
|
484
|
-
prebuildPath:
|
|
503
|
+
prebuildPath: preBuildConfigPath,
|
|
485
504
|
watchList: flattenedList
|
|
486
505
|
};
|
|
487
506
|
}
|
|
@@ -570,19 +589,19 @@ var devHTML = (port) => `<!DOCTYPE html>
|
|
|
570
589
|
window.$RefreshReg$ = () => {}
|
|
571
590
|
window.$RefreshSig$ = () => (type) => type
|
|
572
591
|
window.__vite_plugin_react_preamble_installed__ = true
|
|
573
|
-
|
|
574
|
-
<script type="module" src="http://localhost:${port}/@vite/client"
|
|
592
|
+
</script>
|
|
593
|
+
<script type="module" src="http://localhost:${port}/@vite/client"></script>
|
|
575
594
|
<script>
|
|
576
595
|
function handleLoadError() {
|
|
577
596
|
// Assets have failed to load
|
|
578
597
|
document.getElementById('root').innerHTML = '${errorHTML}';
|
|
579
598
|
}
|
|
580
|
-
|
|
599
|
+
</script>
|
|
581
600
|
<script
|
|
582
601
|
type="module"
|
|
583
602
|
src="http://localhost:${port}/src/main.tsx"
|
|
584
603
|
onerror="handleLoadError()"
|
|
585
|
-
|
|
604
|
+
></script>
|
|
586
605
|
<body class="tina-tailwind">
|
|
587
606
|
<div id="root"></div>
|
|
588
607
|
</body>
|
|
@@ -628,6 +647,7 @@ var import_defaultTheme = __toESM(require("tailwindcss/defaultTheme.js"));
|
|
|
628
647
|
var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
629
648
|
return {
|
|
630
649
|
name: "vite-plugin-tina",
|
|
650
|
+
// @ts-ignore
|
|
631
651
|
config: (viteConfig) => {
|
|
632
652
|
const plugins = [];
|
|
633
653
|
const content = [
|
|
@@ -939,7 +959,6 @@ async function listFilesRecursively({
|
|
|
939
959
|
}
|
|
940
960
|
var createConfig = async ({
|
|
941
961
|
configManager,
|
|
942
|
-
database,
|
|
943
962
|
apiURL,
|
|
944
963
|
plugins = [],
|
|
945
964
|
noWatch,
|
|
@@ -999,6 +1018,8 @@ var createConfig = async ({
|
|
|
999
1018
|
if (configManager.config.build.basePath) {
|
|
1000
1019
|
basePath = configManager.config.build.basePath;
|
|
1001
1020
|
}
|
|
1021
|
+
const fullVersion = configManager.getTinaGraphQLVersion();
|
|
1022
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
1002
1023
|
const config2 = {
|
|
1003
1024
|
root: configManager.spaRootPath,
|
|
1004
1025
|
base: `/${basePath ? `${(0, import_normalize_path2.default)(basePath)}/` : ""}${(0, import_normalize_path2.default)(
|
|
@@ -1010,15 +1031,33 @@ var createConfig = async ({
|
|
|
1010
1031
|
dedupe: ["graphql", "tinacms", "react", "react-dom", "react-router-dom"]
|
|
1011
1032
|
},
|
|
1012
1033
|
define: {
|
|
1034
|
+
/**
|
|
1035
|
+
* Since we prebuild the config.ts, it's possible for modules to be loaded which make
|
|
1036
|
+
* use of `process`. The main scenario where this is an issue is when co-locating schema
|
|
1037
|
+
* definitions with source files, and specifically source files which impor from NextJS.
|
|
1038
|
+
*
|
|
1039
|
+
* Some examples of what NextJS uses for `process.env` are:
|
|
1040
|
+
* - `process.env.__NEXT_TRAILING_SLASH`
|
|
1041
|
+
* - `process.env.__NEXT_CROSS_ORIGIN`
|
|
1042
|
+
* - `process.env.__NEXT_I18N_SUPPORT`
|
|
1043
|
+
*
|
|
1044
|
+
* Also, interestingly some of the advice for handling this doesn't work, references to replacing
|
|
1045
|
+
* `process.env` with `{}` are problematic, because browsers don't understand the `{}.` syntax,
|
|
1046
|
+
* but node does. This was a surprise, but using `new Object()` seems to do the trick.
|
|
1047
|
+
*/
|
|
1013
1048
|
"process.env": `new Object(${JSON.stringify(publicEnv)})`,
|
|
1049
|
+
// Used by picomatch https://github.com/micromatch/picomatch/blob/master/lib/utils.js#L4
|
|
1014
1050
|
"process.platform": `"${process.platform}"`,
|
|
1015
1051
|
__API_URL__: `"${apiURL}"`,
|
|
1016
1052
|
__BASE_PATH__: `"${((_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.basePath) || ""}"`,
|
|
1017
|
-
__TINA_GRAPHQL_VERSION__:
|
|
1053
|
+
__TINA_GRAPHQL_VERSION__: version2
|
|
1018
1054
|
},
|
|
1019
1055
|
logLevel: "error",
|
|
1056
|
+
// Vite import warnings are noisy
|
|
1020
1057
|
optimizeDeps: {
|
|
1021
1058
|
force: true,
|
|
1059
|
+
// Not 100% sure why this isn't being picked up automatically, this works from within the monorepo
|
|
1060
|
+
// but breaks externally
|
|
1022
1061
|
include: ["react/jsx-runtime", "react/jsx-dev-runtime"]
|
|
1023
1062
|
},
|
|
1024
1063
|
server: {
|
|
@@ -1026,6 +1065,7 @@ var createConfig = async ({
|
|
|
1026
1065
|
watch: noWatch ? {
|
|
1027
1066
|
ignored: ["**/*"]
|
|
1028
1067
|
} : {
|
|
1068
|
+
// Ignore everything except for the alias fields we specified above
|
|
1029
1069
|
ignored: [
|
|
1030
1070
|
`${configManager.tinaFolderPath}/**/!(config.prebuild.jsx|_graphql.json)`
|
|
1031
1071
|
]
|
|
@@ -1041,8 +1081,13 @@ var createConfig = async ({
|
|
|
1041
1081
|
rollupOptions
|
|
1042
1082
|
},
|
|
1043
1083
|
plugins: [
|
|
1084
|
+
/**
|
|
1085
|
+
* `splitVendorChunkPlugin` is needed because `tinacms` is quite large,
|
|
1086
|
+
* Vite's chunking strategy chokes on memory issues for smaller machines (ie. on CI).
|
|
1087
|
+
*/
|
|
1044
1088
|
(0, import_plugin_react.default)({
|
|
1045
1089
|
babel: {
|
|
1090
|
+
// Supresses the warning [NOTE] babel The code generator has deoptimised the styling of
|
|
1046
1091
|
compact: true
|
|
1047
1092
|
}
|
|
1048
1093
|
}),
|
|
@@ -1119,8 +1164,7 @@ var createMediaRouter = (config2) => {
|
|
|
1119
1164
|
};
|
|
1120
1165
|
var parseMediaFolder = (str) => {
|
|
1121
1166
|
let returnString = str;
|
|
1122
|
-
if (returnString.startsWith("/"))
|
|
1123
|
-
returnString = returnString.substr(1);
|
|
1167
|
+
if (returnString.startsWith("/")) returnString = returnString.substr(1);
|
|
1124
1168
|
if (returnString.endsWith("/"))
|
|
1125
1169
|
returnString = returnString.substr(0, returnString.length - 1);
|
|
1126
1170
|
return returnString;
|
|
@@ -1387,6 +1431,7 @@ function viteTransformExtension({
|
|
|
1387
1431
|
return {
|
|
1388
1432
|
code: res.code,
|
|
1389
1433
|
map: null
|
|
1434
|
+
// TODO:
|
|
1390
1435
|
};
|
|
1391
1436
|
}
|
|
1392
1437
|
}
|
|
@@ -1407,6 +1452,14 @@ var createDevServer = async (configManager, database, searchIndex, apiURL, noWat
|
|
|
1407
1452
|
apiURL,
|
|
1408
1453
|
plugins,
|
|
1409
1454
|
noWatch,
|
|
1455
|
+
/**
|
|
1456
|
+
* Ensure Vite's import scan uses the spaMainPath as the input
|
|
1457
|
+
* so it properly finds everything. This is for dev only, and when
|
|
1458
|
+
* running the server outside of this monorepo vite fails to find
|
|
1459
|
+
* and optimize the imports, so you get errors about it not being
|
|
1460
|
+
* able to find an export from a module, and it's always a CJS
|
|
1461
|
+
* module that Vite would usually transform to an ES module.
|
|
1462
|
+
*/
|
|
1410
1463
|
rollupOptions: {
|
|
1411
1464
|
input: configManager.spaMainPath,
|
|
1412
1465
|
onwarn(warning, warn) {
|
|
@@ -1532,6 +1585,7 @@ var GenericSdkVisitor = class extends import_visitor_plugin_common.ClientSideBas
|
|
|
1532
1585
|
node,
|
|
1533
1586
|
documentVariableName,
|
|
1534
1587
|
operationType,
|
|
1588
|
+
// This is the only line that is different
|
|
1535
1589
|
operationResultType: `{data: ${operationResultType}, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: ${operationVariablesTypes}, query: string}`,
|
|
1536
1590
|
operationVariablesTypes
|
|
1537
1591
|
});
|
|
@@ -1580,6 +1634,8 @@ var plugin = (schema, documents, config2) => {
|
|
|
1580
1634
|
const visitor = new GenericSdkVisitor(schema, allFragments, config2);
|
|
1581
1635
|
const visitorResult = (0, import_graphql3.visit)(allAst, { leave: visitor });
|
|
1582
1636
|
return {
|
|
1637
|
+
// We will take care of imports
|
|
1638
|
+
// prepend: visitor.getImports(),
|
|
1583
1639
|
content: [
|
|
1584
1640
|
visitor.fragments,
|
|
1585
1641
|
...visitorResult.definitions.filter((t) => typeof t === "string"),
|
|
@@ -1595,6 +1651,7 @@ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath =
|
|
|
1595
1651
|
docs = await loadGraphQLDocuments(queryPathGlob);
|
|
1596
1652
|
fragDocs = await loadGraphQLDocuments(fragDocPath);
|
|
1597
1653
|
const res = await (0, import_core.codegen)({
|
|
1654
|
+
// Filename is not used. This is because the typescript plugin returns a string instead of writing to a file.
|
|
1598
1655
|
filename: process.cwd(),
|
|
1599
1656
|
schema: (0, import_graphql5.parse)((0, import_graphql5.printSchema)(schema)),
|
|
1600
1657
|
documents: [...docs, ...fragDocs],
|
|
@@ -1629,9 +1686,12 @@ var loadGraphQLDocuments = async (globPath) => {
|
|
|
1629
1686
|
loaders: [new import_graphql_file_loader.GraphQLFileLoader()]
|
|
1630
1687
|
});
|
|
1631
1688
|
} catch (e) {
|
|
1632
|
-
if (
|
|
1633
|
-
|
|
1634
|
-
|
|
1689
|
+
if (
|
|
1690
|
+
// https://www.graphql-tools.com/docs/documents-loading#no-files-found
|
|
1691
|
+
(e.message || "").includes(
|
|
1692
|
+
"Unable to find any GraphQL type definitions for the following pointers:"
|
|
1693
|
+
)
|
|
1694
|
+
) {
|
|
1635
1695
|
} else {
|
|
1636
1696
|
throw e;
|
|
1637
1697
|
}
|
|
@@ -1788,16 +1848,14 @@ var Codegen = class {
|
|
|
1788
1848
|
const branch = (_a = this.configManager.config) == null ? void 0 : _a.branch;
|
|
1789
1849
|
const clientId = (_b = this.configManager.config) == null ? void 0 : _b.clientId;
|
|
1790
1850
|
const token = (_c = this.configManager.config) == null ? void 0 : _c.token;
|
|
1791
|
-
const
|
|
1851
|
+
const fullVersion = this.configManager.getTinaGraphQLVersion();
|
|
1852
|
+
const version2 = `${fullVersion.major}.${fullVersion.minor}`;
|
|
1792
1853
|
const baseUrl = ((_d = this.configManager.config.tinaioConfig) == null ? void 0 : _d.contentApiUrlOverride) || `https://${TINA_HOST}`;
|
|
1793
1854
|
if ((!branch || !clientId || !token) && !this.port && !this.configManager.config.contentApiUrlOverride) {
|
|
1794
1855
|
const missing = [];
|
|
1795
|
-
if (!branch)
|
|
1796
|
-
|
|
1797
|
-
if (!
|
|
1798
|
-
missing.push("clientId");
|
|
1799
|
-
if (!token)
|
|
1800
|
-
missing.push("token");
|
|
1856
|
+
if (!branch) missing.push("branch");
|
|
1857
|
+
if (!clientId) missing.push("clientId");
|
|
1858
|
+
if (!token) missing.push("token");
|
|
1801
1859
|
throw new Error(
|
|
1802
1860
|
`Client not configured properly. Missing ${missing.join(
|
|
1803
1861
|
", "
|
|
@@ -1951,7 +2009,11 @@ schema {
|
|
|
1951
2009
|
}
|
|
1952
2010
|
};
|
|
1953
2011
|
var maybeWarnFragmentSize = async (filepath) => {
|
|
1954
|
-
if (
|
|
2012
|
+
if (
|
|
2013
|
+
// is the file bigger than 100kb?
|
|
2014
|
+
(await import_fs_extra4.default.stat(filepath)).size > // convert to 100 kb to bytes
|
|
2015
|
+
100 * 1024
|
|
2016
|
+
) {
|
|
1955
2017
|
console.warn(
|
|
1956
2018
|
"Warning: frags.gql is very large (>100kb). Consider setting the reference depth to 1 or 0. See code snippet below."
|
|
1957
2019
|
);
|
|
@@ -1979,6 +2041,7 @@ var import_many_level = require("many-level");
|
|
|
1979
2041
|
var import_memory_level = require("memory-level");
|
|
1980
2042
|
var createDBServer = (port) => {
|
|
1981
2043
|
const levelHost = new import_many_level.ManyLevelHost(
|
|
2044
|
+
// @ts-ignore
|
|
1982
2045
|
new import_memory_level.MemoryLevel({
|
|
1983
2046
|
valueEncoding: "json"
|
|
1984
2047
|
})
|
|
@@ -2129,7 +2192,9 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
2129
2192
|
let subProc;
|
|
2130
2193
|
if (this.subCommand) {
|
|
2131
2194
|
subProc = await startSubprocess2({ command: this.subCommand });
|
|
2132
|
-
logger.info(
|
|
2195
|
+
logger.info(
|
|
2196
|
+
`Running web application with command: ${import_chalk4.default.cyan(this.subCommand)}`
|
|
2197
|
+
);
|
|
2133
2198
|
}
|
|
2134
2199
|
function exitHandler(options, exitCode) {
|
|
2135
2200
|
if (subProc) {
|
|
@@ -2209,7 +2274,7 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
2209
2274
|
pathFilter
|
|
2210
2275
|
});
|
|
2211
2276
|
const tinaPathUpdates = modified.filter(
|
|
2212
|
-
(
|
|
2277
|
+
(path14) => path14.startsWith(".tina/__generated__/_schema.json") || path14.startsWith("tina/tina-lock.json")
|
|
2213
2278
|
);
|
|
2214
2279
|
if (tinaPathUpdates.length > 0) {
|
|
2215
2280
|
res = await database.indexContent({
|
|
@@ -2253,6 +2318,7 @@ var import_search = require("@tinacms/search");
|
|
|
2253
2318
|
var DevCommand = class extends BaseCommand {
|
|
2254
2319
|
constructor() {
|
|
2255
2320
|
super(...arguments);
|
|
2321
|
+
// NOTE: camelCase commands for string options don't work if there's an `=` used https://github.com/arcanis/clipanion/issues/141
|
|
2256
2322
|
this.watchFolders = import_clipanion2.Option.String("-w,--watchFolders", {
|
|
2257
2323
|
description: "DEPRECATED - a list of folders (relative to where this is being run) that the cli will watch for changes"
|
|
2258
2324
|
});
|
|
@@ -2282,7 +2348,7 @@ var DevCommand = class extends BaseCommand {
|
|
|
2282
2348
|
rootPath: this.rootPath,
|
|
2283
2349
|
legacyNoSDK: this.noSDK
|
|
2284
2350
|
});
|
|
2285
|
-
logger.info("
|
|
2351
|
+
logger.info("\u{1F999} TinaCMS Dev Server is initializing...");
|
|
2286
2352
|
this.logDeprecationWarnings();
|
|
2287
2353
|
createDBServer(Number(this.datalayerPort));
|
|
2288
2354
|
let database = null;
|
|
@@ -2336,9 +2402,6 @@ var DevCommand = class extends BaseCommand {
|
|
|
2336
2402
|
await import_fs_extra6.default.outputFile(filePath, tinaLockContent);
|
|
2337
2403
|
}
|
|
2338
2404
|
}
|
|
2339
|
-
if (!this.noWatch) {
|
|
2340
|
-
this.watchQueries(configManager, async () => await codegen2.execute());
|
|
2341
|
-
}
|
|
2342
2405
|
await this.indexContentWithSpinner({
|
|
2343
2406
|
database,
|
|
2344
2407
|
graphQLSchema: graphQLSchema2,
|
|
@@ -2348,6 +2411,9 @@ var DevCommand = class extends BaseCommand {
|
|
|
2348
2411
|
if (!firstTime) {
|
|
2349
2412
|
logger.error("Re-index complete");
|
|
2350
2413
|
}
|
|
2414
|
+
if (!this.noWatch) {
|
|
2415
|
+
this.watchQueries(configManager, async () => await codegen2.execute());
|
|
2416
|
+
}
|
|
2351
2417
|
return { apiURL: apiURL2, database, graphQLSchema: graphQLSchema2, tinaSchema: tinaSchema2 };
|
|
2352
2418
|
} catch (e) {
|
|
2353
2419
|
logger.error(`
|
|
@@ -2418,7 +2484,7 @@ ${dangerText(e.message)}
|
|
|
2418
2484
|
configManager.config.search && searchIndexer
|
|
2419
2485
|
);
|
|
2420
2486
|
import_chokidar.default.watch(configManager.watchList).on("change", async () => {
|
|
2421
|
-
logger.info(`
|
|
2487
|
+
logger.info(`TinaCMS config change detected, rebuilding...`);
|
|
2422
2488
|
await setup({ firstTime: false });
|
|
2423
2489
|
server.ws.send({ type: "full-reload", path: "*" });
|
|
2424
2490
|
});
|
|
@@ -2433,7 +2499,7 @@ ${dangerText(e.message)}
|
|
|
2433
2499
|
const summaryItems = [
|
|
2434
2500
|
{
|
|
2435
2501
|
emoji: "\u{1F999}",
|
|
2436
|
-
heading: "
|
|
2502
|
+
heading: "TinaCMS URLs",
|
|
2437
2503
|
subItems: [
|
|
2438
2504
|
{
|
|
2439
2505
|
key: "CMS",
|
|
@@ -2468,9 +2534,23 @@ ${dangerText(e.message)}
|
|
|
2468
2534
|
});
|
|
2469
2535
|
}
|
|
2470
2536
|
summary({
|
|
2471
|
-
heading: "
|
|
2537
|
+
heading: "\u2705 \u{1F999} TinaCMS Dev Server is active:",
|
|
2472
2538
|
items: [
|
|
2473
2539
|
...summaryItems
|
|
2540
|
+
// {
|
|
2541
|
+
// emoji: '📚',
|
|
2542
|
+
// heading: 'Useful links',
|
|
2543
|
+
// subItems: [
|
|
2544
|
+
// {
|
|
2545
|
+
// key: 'Custom queries',
|
|
2546
|
+
// value: 'https://tina.io/querying',
|
|
2547
|
+
// },
|
|
2548
|
+
// {
|
|
2549
|
+
// key: 'Visual editing',
|
|
2550
|
+
// value: 'https://tina.io/visual-editing',
|
|
2551
|
+
// },
|
|
2552
|
+
// ],
|
|
2553
|
+
// },
|
|
2474
2554
|
]
|
|
2475
2555
|
});
|
|
2476
2556
|
await this.startSubCommand();
|
|
@@ -2537,6 +2617,8 @@ DevCommand.usage = import_clipanion2.Command.Usage({
|
|
|
2537
2617
|
var import_clipanion3 = require("clipanion");
|
|
2538
2618
|
var import_progress2 = __toESM(require("progress"));
|
|
2539
2619
|
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
2620
|
+
var import_crypto = __toESM(require("crypto"));
|
|
2621
|
+
var import_path6 = __toESM(require("path"));
|
|
2540
2622
|
var import_graphql11 = require("@tinacms/graphql");
|
|
2541
2623
|
|
|
2542
2624
|
// src/next/commands/build-command/server.ts
|
|
@@ -2580,7 +2662,7 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
2580
2662
|
// src/next/commands/build-command/index.ts
|
|
2581
2663
|
var import_schema_tools2 = require("@tinacms/schema-tools");
|
|
2582
2664
|
var import_graphql12 = require("graphql");
|
|
2583
|
-
var
|
|
2665
|
+
var import_core3 = require("@graphql-inspector/core");
|
|
2584
2666
|
|
|
2585
2667
|
// src/next/commands/build-command/waitForDB.ts
|
|
2586
2668
|
var import_progress = __toESM(require("progress"));
|
|
@@ -2682,6 +2764,20 @@ var waitForDB = async (config2, apiUrl, previewName, verbose) => {
|
|
|
2682
2764
|
|
|
2683
2765
|
// src/next/commands/build-command/index.ts
|
|
2684
2766
|
var import_search2 = require("@tinacms/search");
|
|
2767
|
+
|
|
2768
|
+
// src/utils/index.ts
|
|
2769
|
+
var import_core2 = require("@graphql-inspector/core");
|
|
2770
|
+
var getFaqLink = (type) => {
|
|
2771
|
+
switch (type) {
|
|
2772
|
+
case import_core2.ChangeType.FieldRemoved: {
|
|
2773
|
+
return "https://tina.io/docs/introduction/faq#how-do-i-resolve-the-local-graphql-schema-doesnt-match-the-remote-graphql-schema-errors";
|
|
2774
|
+
}
|
|
2775
|
+
default:
|
|
2776
|
+
return null;
|
|
2777
|
+
}
|
|
2778
|
+
};
|
|
2779
|
+
|
|
2780
|
+
// src/next/commands/build-command/index.ts
|
|
2685
2781
|
var BuildCommand = class extends BaseCommand {
|
|
2686
2782
|
constructor() {
|
|
2687
2783
|
super(...arguments);
|
|
@@ -2697,6 +2793,9 @@ var BuildCommand = class extends BaseCommand {
|
|
|
2697
2793
|
this.tinaGraphQLVersion = import_clipanion3.Option.String("--tina-graphql-version", {
|
|
2698
2794
|
description: "Specify the version of @tinacms/graphql to use (defaults to latest)"
|
|
2699
2795
|
});
|
|
2796
|
+
/**
|
|
2797
|
+
* This option allows the user to skip the tina cloud checks if they want to. This could be useful for mismatched GraphQL versions or if they want to build only using the local client and never connect to Tina Cloud
|
|
2798
|
+
*/
|
|
2700
2799
|
this.skipCloudChecks = import_clipanion3.Option.Boolean("--skip-cloud-checks", false, {
|
|
2701
2800
|
description: "Skips checking the provided cloud config."
|
|
2702
2801
|
});
|
|
@@ -2809,7 +2908,7 @@ ${dangerText(e.message)}
|
|
|
2809
2908
|
}
|
|
2810
2909
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2811
2910
|
if (!skipCloudChecks) {
|
|
2812
|
-
const { hasUpstream } = await this.checkClientInfo(
|
|
2911
|
+
const { hasUpstream, timestamp } = await this.checkClientInfo(
|
|
2813
2912
|
configManager,
|
|
2814
2913
|
codegen2.productionUrl,
|
|
2815
2914
|
this.previewBaseBranch
|
|
@@ -2837,7 +2936,16 @@ ${dangerText(e.message)}
|
|
|
2837
2936
|
await this.checkGraphqlSchema(
|
|
2838
2937
|
configManager,
|
|
2839
2938
|
database,
|
|
2840
|
-
codegen2.productionUrl
|
|
2939
|
+
codegen2.productionUrl,
|
|
2940
|
+
timestamp
|
|
2941
|
+
);
|
|
2942
|
+
await this.checkTinaSchema(
|
|
2943
|
+
configManager,
|
|
2944
|
+
database,
|
|
2945
|
+
codegen2.productionUrl,
|
|
2946
|
+
this.previewName,
|
|
2947
|
+
this.verbose,
|
|
2948
|
+
timestamp
|
|
2841
2949
|
);
|
|
2842
2950
|
}
|
|
2843
2951
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
@@ -2956,11 +3064,13 @@ ${dangerText(e.message)}
|
|
|
2956
3064
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
2957
3065
|
let branchKnown = false;
|
|
2958
3066
|
let hasUpstream = false;
|
|
3067
|
+
let timestamp;
|
|
2959
3068
|
try {
|
|
2960
3069
|
const res = await request({
|
|
2961
3070
|
token,
|
|
2962
3071
|
url
|
|
2963
3072
|
});
|
|
3073
|
+
timestamp = res.timestamp || 0;
|
|
2964
3074
|
bar2.tick({
|
|
2965
3075
|
prog: "\u2705"
|
|
2966
3076
|
});
|
|
@@ -3002,7 +3112,8 @@ ${dangerText(e.message)}
|
|
|
3002
3112
|
prog: "\u2705"
|
|
3003
3113
|
});
|
|
3004
3114
|
return {
|
|
3005
|
-
hasUpstream
|
|
3115
|
+
hasUpstream,
|
|
3116
|
+
timestamp
|
|
3006
3117
|
};
|
|
3007
3118
|
}
|
|
3008
3119
|
for (let i = 0; i <= 5; i++) {
|
|
@@ -3092,14 +3203,14 @@ ${dangerText(e.message)}
|
|
|
3092
3203
|
throw e;
|
|
3093
3204
|
}
|
|
3094
3205
|
}
|
|
3095
|
-
async checkGraphqlSchema(configManager, database, apiURL) {
|
|
3206
|
+
async checkGraphqlSchema(configManager, database, apiURL, timestamp) {
|
|
3096
3207
|
const bar2 = new import_progress2.default(
|
|
3097
3208
|
"Checking local GraphQL Schema matches server. :prog",
|
|
3098
3209
|
1
|
|
3099
3210
|
);
|
|
3100
3211
|
const { config: config2 } = configManager;
|
|
3101
3212
|
const token = config2.token;
|
|
3102
|
-
const remoteSchema = await fetchRemoteGraphqlSchema({
|
|
3213
|
+
const { remoteSchema, remoteProjectVersion } = await fetchRemoteGraphqlSchema({
|
|
3103
3214
|
url: apiURL,
|
|
3104
3215
|
token
|
|
3105
3216
|
});
|
|
@@ -3119,7 +3230,7 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3119
3230
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
3120
3231
|
const localGraphqlSchema = (0, import_graphql12.buildASTSchema)(localSchemaDocument);
|
|
3121
3232
|
try {
|
|
3122
|
-
const diffResult = await (0,
|
|
3233
|
+
const diffResult = await (0, import_core3.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
3123
3234
|
if (diffResult.length === 0) {
|
|
3124
3235
|
bar2.tick({
|
|
3125
3236
|
prog: "\u2705"
|
|
@@ -3128,12 +3239,30 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3128
3239
|
bar2.tick({
|
|
3129
3240
|
prog: "\u274C"
|
|
3130
3241
|
});
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3242
|
+
const type = diffResult[0].type;
|
|
3243
|
+
const reason = diffResult[0].message;
|
|
3244
|
+
const errorLevel = diffResult[0].criticality.level;
|
|
3245
|
+
const faqLink = getFaqLink(type);
|
|
3246
|
+
const tinaGraphQLVersion = configManager.getTinaGraphQLVersion();
|
|
3247
|
+
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 && `
|
|
3248
|
+
Check out '${faqLink}' for possible solutions.`}`;
|
|
3249
|
+
errorMessage += `
|
|
3134
3250
|
|
|
3135
|
-
Additional info:
|
|
3251
|
+
Additional info:
|
|
3252
|
+
|
|
3253
|
+
`;
|
|
3254
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3255
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3256
|
+
`;
|
|
3136
3257
|
}
|
|
3258
|
+
errorMessage += ` Local GraphQL version: ${tinaGraphQLVersion.fullVersion} / Remote GraphQL version: ${remoteProjectVersion}
|
|
3259
|
+
`;
|
|
3260
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3261
|
+
timestamp
|
|
3262
|
+
).toUTCString()}
|
|
3263
|
+
`;
|
|
3264
|
+
errorMessage += ` Reason: [${errorLevel} - ${type}] ${reason}
|
|
3265
|
+
`;
|
|
3137
3266
|
throw new Error(errorMessage);
|
|
3138
3267
|
}
|
|
3139
3268
|
} catch (e) {
|
|
@@ -3148,6 +3277,71 @@ Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
|
3148
3277
|
}
|
|
3149
3278
|
}
|
|
3150
3279
|
}
|
|
3280
|
+
async checkTinaSchema(configManager, database, apiURL, previewName, verbose, timestamp) {
|
|
3281
|
+
const bar2 = new import_progress2.default(
|
|
3282
|
+
"Checking local Tina Schema matches server. :prog",
|
|
3283
|
+
1
|
|
3284
|
+
);
|
|
3285
|
+
const { config: config2 } = configManager;
|
|
3286
|
+
const token = config2.token;
|
|
3287
|
+
const { clientId, branch, isLocalClient, host } = (0, import_schema_tools2.parseURL)(apiURL);
|
|
3288
|
+
if (isLocalClient || !host || !clientId || !branch) {
|
|
3289
|
+
if (verbose) {
|
|
3290
|
+
logger.info(logText("Not using Tina Cloud, skipping Tina Schema check"));
|
|
3291
|
+
}
|
|
3292
|
+
return;
|
|
3293
|
+
}
|
|
3294
|
+
const { tinaSchema: remoteTinaSchemaSha } = await fetchSchemaSha({
|
|
3295
|
+
url: `https://${host}/db/${clientId}/${previewName || branch}/schemaSha`,
|
|
3296
|
+
token
|
|
3297
|
+
});
|
|
3298
|
+
if (!remoteTinaSchemaSha) {
|
|
3299
|
+
bar2.tick({
|
|
3300
|
+
prog: "\u274C"
|
|
3301
|
+
});
|
|
3302
|
+
let errorMessage = `The remote Tina schema does not exist. Check indexing for this branch.`;
|
|
3303
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3304
|
+
errorMessage += `
|
|
3305
|
+
|
|
3306
|
+
Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
3307
|
+
}
|
|
3308
|
+
throw new Error(errorMessage);
|
|
3309
|
+
}
|
|
3310
|
+
if (!database.bridge) {
|
|
3311
|
+
throw new Error(`No bridge configured`);
|
|
3312
|
+
}
|
|
3313
|
+
const localTinaSchema = JSON.parse(
|
|
3314
|
+
await database.bridge.get(
|
|
3315
|
+
import_path6.default.join(database.tinaDirectory, "__generated__", "_schema.json")
|
|
3316
|
+
)
|
|
3317
|
+
);
|
|
3318
|
+
localTinaSchema.version = void 0;
|
|
3319
|
+
const localTinaSchemaSha = import_crypto.default.createHash("sha256").update(JSON.stringify(localTinaSchema)).digest("hex");
|
|
3320
|
+
if (localTinaSchemaSha === remoteTinaSchemaSha) {
|
|
3321
|
+
bar2.tick({
|
|
3322
|
+
prog: "\u2705"
|
|
3323
|
+
});
|
|
3324
|
+
} else {
|
|
3325
|
+
bar2.tick({
|
|
3326
|
+
prog: "\u274C"
|
|
3327
|
+
});
|
|
3328
|
+
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.`;
|
|
3329
|
+
errorMessage += `
|
|
3330
|
+
|
|
3331
|
+
Additional info:
|
|
3332
|
+
|
|
3333
|
+
`;
|
|
3334
|
+
if (config2 == null ? void 0 : config2.branch) {
|
|
3335
|
+
errorMessage += ` Branch: ${config2.branch}, Client ID: ${config2.clientId}
|
|
3336
|
+
`;
|
|
3337
|
+
}
|
|
3338
|
+
errorMessage += ` Last indexed at: ${new Date(
|
|
3339
|
+
timestamp
|
|
3340
|
+
).toUTCString()}
|
|
3341
|
+
`;
|
|
3342
|
+
throw new Error(errorMessage);
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3151
3345
|
};
|
|
3152
3346
|
BuildCommand.paths = [["build"]];
|
|
3153
3347
|
BuildCommand.usage = import_clipanion3.Command.Usage({
|
|
@@ -3214,7 +3408,26 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
3214
3408
|
body
|
|
3215
3409
|
});
|
|
3216
3410
|
const data = await res.json();
|
|
3217
|
-
return
|
|
3411
|
+
return {
|
|
3412
|
+
remoteSchema: data == null ? void 0 : data.data,
|
|
3413
|
+
remoteRuntimeVersion: res.headers.get("tinacms-grapqhl-version"),
|
|
3414
|
+
remoteProjectVersion: res.headers.get("tinacms-graphql-project-version")
|
|
3415
|
+
};
|
|
3416
|
+
};
|
|
3417
|
+
var fetchSchemaSha = async ({
|
|
3418
|
+
url,
|
|
3419
|
+
token
|
|
3420
|
+
}) => {
|
|
3421
|
+
const headers = new Headers();
|
|
3422
|
+
if (token) {
|
|
3423
|
+
headers.append("X-API-KEY", token);
|
|
3424
|
+
}
|
|
3425
|
+
const res = await fetch(url, {
|
|
3426
|
+
method: "GET",
|
|
3427
|
+
headers,
|
|
3428
|
+
cache: "no-cache"
|
|
3429
|
+
});
|
|
3430
|
+
return res.json();
|
|
3218
3431
|
};
|
|
3219
3432
|
|
|
3220
3433
|
// src/next/commands/audit-command/index.ts
|
|
@@ -3323,6 +3536,7 @@ var auditDocuments = async (args) => {
|
|
|
3323
3536
|
logger.error(import_chalk5.default.red(err.message));
|
|
3324
3537
|
if (err.originalError.originalError) {
|
|
3325
3538
|
logger.error(
|
|
3539
|
+
// @ts-ignore FIXME: this doesn't seem right
|
|
3326
3540
|
import_chalk5.default.red(` ${err.originalError.originalError.message}`)
|
|
3327
3541
|
);
|
|
3328
3542
|
}
|
|
@@ -3469,25 +3683,25 @@ var import_clipanion6 = require("clipanion");
|
|
|
3469
3683
|
|
|
3470
3684
|
// src/cmds/init/detectEnvironment.ts
|
|
3471
3685
|
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
3472
|
-
var
|
|
3686
|
+
var import_path7 = __toESM(require("path"));
|
|
3473
3687
|
var checkGitignoreForItem = async ({
|
|
3474
3688
|
baseDir,
|
|
3475
3689
|
line
|
|
3476
3690
|
}) => {
|
|
3477
|
-
const gitignoreContent = import_fs_extra8.default.readFileSync(
|
|
3691
|
+
const gitignoreContent = import_fs_extra8.default.readFileSync(import_path7.default.join(baseDir, ".gitignore")).toString();
|
|
3478
3692
|
return gitignoreContent.split("\n").some((item) => item === line);
|
|
3479
3693
|
};
|
|
3480
3694
|
var makeGeneratedFile = async (name2, generatedFileType, parentPath, opts) => {
|
|
3481
3695
|
const result = {
|
|
3482
|
-
fullPathTS:
|
|
3696
|
+
fullPathTS: import_path7.default.join(
|
|
3483
3697
|
parentPath,
|
|
3484
3698
|
`${name2}.${(opts == null ? void 0 : opts.typescriptSuffix) || (opts == null ? void 0 : opts.extensionOverride) || "ts"}`
|
|
3485
3699
|
),
|
|
3486
|
-
fullPathJS:
|
|
3700
|
+
fullPathJS: import_path7.default.join(
|
|
3487
3701
|
parentPath,
|
|
3488
3702
|
`${name2}.${(opts == null ? void 0 : opts.extensionOverride) || "js"}`
|
|
3489
3703
|
),
|
|
3490
|
-
fullPathOverride: (opts == null ? void 0 : opts.extensionOverride) ?
|
|
3704
|
+
fullPathOverride: (opts == null ? void 0 : opts.extensionOverride) ? import_path7.default.join(parentPath, `${name2}.${opts == null ? void 0 : opts.extensionOverride}`) : "",
|
|
3491
3705
|
generatedFileType,
|
|
3492
3706
|
name: name2,
|
|
3493
3707
|
parentPath,
|
|
@@ -3517,18 +3731,20 @@ var detectEnvironment = async ({
|
|
|
3517
3731
|
}) => {
|
|
3518
3732
|
var _a;
|
|
3519
3733
|
const hasForestryConfig = await import_fs_extra8.default.pathExists(
|
|
3520
|
-
|
|
3734
|
+
import_path7.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
3521
3735
|
);
|
|
3522
|
-
const sampleContentPath =
|
|
3736
|
+
const sampleContentPath = import_path7.default.join(
|
|
3523
3737
|
baseDir,
|
|
3524
3738
|
"content",
|
|
3525
3739
|
"posts",
|
|
3526
3740
|
"hello-world.md"
|
|
3527
3741
|
);
|
|
3528
|
-
const usingSrc = import_fs_extra8.default.pathExistsSync(
|
|
3529
|
-
const tinaFolder =
|
|
3742
|
+
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")));
|
|
3743
|
+
const tinaFolder = import_path7.default.join(baseDir, "tina");
|
|
3530
3744
|
const tinaConfigExists = Boolean(
|
|
3531
|
-
|
|
3745
|
+
// Does the tina folder exist?
|
|
3746
|
+
await import_fs_extra8.default.pathExists(tinaFolder) && // Does the tina folder contain a config file?
|
|
3747
|
+
(await import_fs_extra8.default.readdir(tinaFolder)).find((x) => x.includes("config"))
|
|
3532
3748
|
);
|
|
3533
3749
|
const pagesDir = [baseDir, usingSrc ? "src" : false, "pages"].filter(
|
|
3534
3750
|
Boolean
|
|
@@ -3540,12 +3756,12 @@ var detectEnvironment = async ({
|
|
|
3540
3756
|
"next-api-handler": await makeGeneratedFile(
|
|
3541
3757
|
"[...routes]",
|
|
3542
3758
|
"next-api-handler",
|
|
3543
|
-
|
|
3759
|
+
import_path7.default.join(...pagesDir, "api", "tina")
|
|
3544
3760
|
),
|
|
3545
3761
|
"reactive-example": await makeGeneratedFile(
|
|
3546
3762
|
"[filename]",
|
|
3547
3763
|
"reactive-example",
|
|
3548
|
-
|
|
3764
|
+
import_path7.default.join(...pagesDir, "demo", "blog"),
|
|
3549
3765
|
{
|
|
3550
3766
|
typescriptSuffix: "tsx"
|
|
3551
3767
|
}
|
|
@@ -3553,13 +3769,13 @@ var detectEnvironment = async ({
|
|
|
3553
3769
|
"users-json": await makeGeneratedFile(
|
|
3554
3770
|
"index",
|
|
3555
3771
|
"users-json",
|
|
3556
|
-
|
|
3772
|
+
import_path7.default.join(baseDir, "content", "users"),
|
|
3557
3773
|
{ extensionOverride: "json" }
|
|
3558
3774
|
),
|
|
3559
3775
|
"sample-content": await makeGeneratedFile(
|
|
3560
3776
|
"hello-world",
|
|
3561
3777
|
"sample-content",
|
|
3562
|
-
|
|
3778
|
+
import_path7.default.join(baseDir, "content", "posts"),
|
|
3563
3779
|
{ extensionOverride: "md" }
|
|
3564
3780
|
)
|
|
3565
3781
|
};
|
|
@@ -3585,13 +3801,13 @@ var detectEnvironment = async ({
|
|
|
3585
3801
|
);
|
|
3586
3802
|
}
|
|
3587
3803
|
}
|
|
3588
|
-
const hasGitIgnore = await import_fs_extra8.default.pathExists(
|
|
3804
|
+
const hasGitIgnore = await import_fs_extra8.default.pathExists(import_path7.default.join(".gitignore"));
|
|
3589
3805
|
const hasGitIgnoreNodeModules = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: "node_modules" });
|
|
3590
3806
|
const hasEnvTina = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env.tina" });
|
|
3591
3807
|
const hasGitIgnoreEnv = hasGitIgnore && await checkGitignoreForItem({ baseDir, line: ".env" });
|
|
3592
3808
|
let frontMatterFormat;
|
|
3593
3809
|
if (hasForestryConfig) {
|
|
3594
|
-
const hugoConfigPath =
|
|
3810
|
+
const hugoConfigPath = import_path7.default.join(rootPath, "config.toml");
|
|
3595
3811
|
if (await import_fs_extra8.default.pathExists(hugoConfigPath)) {
|
|
3596
3812
|
const hugoConfig = await import_fs_extra8.default.readFile(hugoConfigPath, "utf8");
|
|
3597
3813
|
const metaDataFormat = (_a = hugoConfig.match(/metaDataFormat = "(.*)"/)) == null ? void 0 : _a[1];
|
|
@@ -3763,6 +3979,7 @@ var supportedDatabaseAdapters = {
|
|
|
3763
3979
|
{
|
|
3764
3980
|
from: "mongodb",
|
|
3765
3981
|
imported: [],
|
|
3982
|
+
// not explicitly imported
|
|
3766
3983
|
packageName: "mongodb"
|
|
3767
3984
|
}
|
|
3768
3985
|
]
|
|
@@ -3835,6 +4052,10 @@ var chooseDatabaseAdapter = async ({
|
|
|
3835
4052
|
title: "MongoDB",
|
|
3836
4053
|
value: "mongodb"
|
|
3837
4054
|
}
|
|
4055
|
+
// {
|
|
4056
|
+
// title: "I'll create my own database adapter",
|
|
4057
|
+
// value: 'other',
|
|
4058
|
+
// },
|
|
3838
4059
|
]
|
|
3839
4060
|
}
|
|
3840
4061
|
]);
|
|
@@ -4112,6 +4333,7 @@ async function configure(env, opts) {
|
|
|
4112
4333
|
packageManager,
|
|
4113
4334
|
forestryMigrate: false,
|
|
4114
4335
|
isLocalEnvVarName: "TINA_PUBLIC_IS_LOCAL",
|
|
4336
|
+
// TODO: give this a better default
|
|
4115
4337
|
typescript: false
|
|
4116
4338
|
};
|
|
4117
4339
|
if (config2.framework.name === "next") {
|
|
@@ -4199,31 +4421,41 @@ var CLICommand = class {
|
|
|
4199
4421
|
};
|
|
4200
4422
|
|
|
4201
4423
|
// src/cmds/init/apply.ts
|
|
4202
|
-
var
|
|
4424
|
+
var import_path11 = __toESM(require("path"));
|
|
4203
4425
|
|
|
4204
4426
|
// src/cmds/forestry-migrate/index.ts
|
|
4205
4427
|
var import_fs_extra10 = __toESM(require("fs-extra"));
|
|
4206
|
-
var
|
|
4428
|
+
var import_path9 = __toESM(require("path"));
|
|
4207
4429
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
|
4208
4430
|
var import_minimatch = __toESM(require("minimatch"));
|
|
4209
4431
|
var import_graphql16 = require("@tinacms/graphql");
|
|
4210
4432
|
|
|
4211
4433
|
// src/cmds/forestry-migrate/util/index.ts
|
|
4212
4434
|
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
4213
|
-
var
|
|
4435
|
+
var import_path8 = __toESM(require("path"));
|
|
4214
4436
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
4215
4437
|
var import_zod = __toESM(require("zod"));
|
|
4216
4438
|
|
|
4217
4439
|
// src/cmds/forestry-migrate/util/errorSingleton.ts
|
|
4218
|
-
var ErrorSingleton = class {
|
|
4440
|
+
var ErrorSingleton = class _ErrorSingleton {
|
|
4441
|
+
/**
|
|
4442
|
+
* The Singleton's constructor should always be private to prevent direct
|
|
4443
|
+
* construction calls with the `new` operator.
|
|
4444
|
+
*/
|
|
4219
4445
|
constructor() {
|
|
4220
4446
|
}
|
|
4447
|
+
/**
|
|
4448
|
+
* The static method that controls the access to the singleton instance.
|
|
4449
|
+
*
|
|
4450
|
+
* This implementation let you subclass the Singleton class while keeping
|
|
4451
|
+
* just one instance of each subclass around.
|
|
4452
|
+
*/
|
|
4221
4453
|
static getInstance() {
|
|
4222
|
-
if (!
|
|
4223
|
-
|
|
4224
|
-
|
|
4454
|
+
if (!_ErrorSingleton.instance) {
|
|
4455
|
+
_ErrorSingleton.instance = new _ErrorSingleton();
|
|
4456
|
+
_ErrorSingleton.instance.collectionNameErrors = [];
|
|
4225
4457
|
}
|
|
4226
|
-
return
|
|
4458
|
+
return _ErrorSingleton.instance;
|
|
4227
4459
|
}
|
|
4228
4460
|
addErrorName(error) {
|
|
4229
4461
|
this.collectionNameErrors.push(error);
|
|
@@ -4266,8 +4498,7 @@ var makeFieldsWithInternalCode = ({
|
|
|
4266
4498
|
if (hasBody) {
|
|
4267
4499
|
return [bodyField, `__TINA_INTERNAL__:::...${field}():::`];
|
|
4268
4500
|
} else {
|
|
4269
|
-
if (spread)
|
|
4270
|
-
return `__TINA_INTERNAL__:::...${field}():::`;
|
|
4501
|
+
if (spread) return `__TINA_INTERNAL__:::...${field}():::`;
|
|
4271
4502
|
return `__TINA_INTERNAL__:::${field}():::`;
|
|
4272
4503
|
}
|
|
4273
4504
|
};
|
|
@@ -4351,6 +4582,7 @@ var forestryConfigSchema = import_zod.default.object({
|
|
|
4351
4582
|
)
|
|
4352
4583
|
});
|
|
4353
4584
|
var forestryFieldWithoutField = import_zod.default.object({
|
|
4585
|
+
// TODO: maybe better type this?
|
|
4354
4586
|
type: import_zod.default.union([
|
|
4355
4587
|
import_zod.default.literal("text"),
|
|
4356
4588
|
import_zod.default.literal("datetime"),
|
|
@@ -4374,6 +4606,7 @@ var forestryFieldWithoutField = import_zod.default.object({
|
|
|
4374
4606
|
default: import_zod.default.any().optional(),
|
|
4375
4607
|
template: import_zod.default.string().optional(),
|
|
4376
4608
|
config: import_zod.default.object({
|
|
4609
|
+
// min and max are used for lists
|
|
4377
4610
|
min: import_zod.default.number().optional().nullable(),
|
|
4378
4611
|
max: import_zod.default.number().optional().nullable(),
|
|
4379
4612
|
required: import_zod.default.boolean().optional().nullable(),
|
|
@@ -4387,6 +4620,7 @@ var forestryFieldWithoutField = import_zod.default.object({
|
|
|
4387
4620
|
import_zod.default.literal("pages"),
|
|
4388
4621
|
import_zod.default.literal("documents"),
|
|
4389
4622
|
import_zod.default.literal("simple"),
|
|
4623
|
+
// TODO: I want to ignore this key if its invalid
|
|
4390
4624
|
import_zod.default.string()
|
|
4391
4625
|
]).optional().nullable(),
|
|
4392
4626
|
section: import_zod.default.string().optional().nullable()
|
|
@@ -4422,6 +4656,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4422
4656
|
}
|
|
4423
4657
|
let field;
|
|
4424
4658
|
switch (forestryField2.type) {
|
|
4659
|
+
// Single filed types
|
|
4425
4660
|
case "text":
|
|
4426
4661
|
field = {
|
|
4427
4662
|
type: "string",
|
|
@@ -4501,6 +4736,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4501
4736
|
);
|
|
4502
4737
|
}
|
|
4503
4738
|
break;
|
|
4739
|
+
// List Types
|
|
4504
4740
|
case "list":
|
|
4505
4741
|
field = {
|
|
4506
4742
|
type: "string",
|
|
@@ -4523,6 +4759,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4523
4759
|
}
|
|
4524
4760
|
};
|
|
4525
4761
|
break;
|
|
4762
|
+
// Object (Group) types
|
|
4526
4763
|
case "field_group":
|
|
4527
4764
|
field = {
|
|
4528
4765
|
type: "object",
|
|
@@ -4563,6 +4800,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4563
4800
|
});
|
|
4564
4801
|
const fieldsString = stringifyLabelWithField(template2.label);
|
|
4565
4802
|
const t = {
|
|
4803
|
+
// @ts-ignore
|
|
4566
4804
|
fields: makeFieldsWithInternalCode({
|
|
4567
4805
|
hasBody: false,
|
|
4568
4806
|
field: fieldsString
|
|
@@ -4600,6 +4838,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4600
4838
|
spread: true
|
|
4601
4839
|
});
|
|
4602
4840
|
tinaFields.push(
|
|
4841
|
+
// @ts-ignore
|
|
4603
4842
|
field2
|
|
4604
4843
|
);
|
|
4605
4844
|
break;
|
|
@@ -4621,7 +4860,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
4621
4860
|
return tinaFields;
|
|
4622
4861
|
};
|
|
4623
4862
|
var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false }) => {
|
|
4624
|
-
const templatePath =
|
|
4863
|
+
const templatePath = import_path8.default.join(
|
|
4625
4864
|
pathToForestryConfig,
|
|
4626
4865
|
".forestry",
|
|
4627
4866
|
"front_matter",
|
|
@@ -4659,6 +4898,7 @@ var parseSections = ({ val }) => {
|
|
|
4659
4898
|
|
|
4660
4899
|
// src/cmds/forestry-migrate/index.ts
|
|
4661
4900
|
var BODY_FIELD = {
|
|
4901
|
+
// This is the body field
|
|
4662
4902
|
type: "rich-text",
|
|
4663
4903
|
name: "body",
|
|
4664
4904
|
label: "Body of Document",
|
|
@@ -4696,8 +4936,8 @@ var generateAllTemplates = async ({
|
|
|
4696
4936
|
pathToForestryConfig
|
|
4697
4937
|
}) => {
|
|
4698
4938
|
const allTemplates = (await import_fs_extra10.default.readdir(
|
|
4699
|
-
|
|
4700
|
-
)).map((tem) =>
|
|
4939
|
+
import_path9.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
|
|
4940
|
+
)).map((tem) => import_path9.default.basename(tem, ".yml"));
|
|
4701
4941
|
const templateMap = /* @__PURE__ */ new Map();
|
|
4702
4942
|
const proms = allTemplates.map(async (tem) => {
|
|
4703
4943
|
try {
|
|
@@ -4717,8 +4957,7 @@ var generateAllTemplates = async ({
|
|
|
4717
4957
|
};
|
|
4718
4958
|
var generateCollectionFromForestrySection = (args) => {
|
|
4719
4959
|
const { section, templateMap } = args;
|
|
4720
|
-
if (section.read_only)
|
|
4721
|
-
return;
|
|
4960
|
+
if (section.read_only) return;
|
|
4722
4961
|
let format3 = "md";
|
|
4723
4962
|
if (section.new_doc_ext) {
|
|
4724
4963
|
const ext = checkExt(section.new_doc_ext);
|
|
@@ -4785,12 +5024,14 @@ var generateCollectionFromForestrySection = (args) => {
|
|
|
4785
5024
|
if (((forestryTemplates == null ? void 0 : forestryTemplates.length) || 0) > 1) {
|
|
4786
5025
|
c = {
|
|
4787
5026
|
...baseCollection,
|
|
5027
|
+
// @ts-expect-error
|
|
4788
5028
|
templates: forestryTemplates.map((tem) => {
|
|
4789
5029
|
const currentTemplate = templateMap.get(tem);
|
|
4790
5030
|
const fieldsString = stringifyLabelWithField(
|
|
4791
5031
|
currentTemplate.templateObj.label
|
|
4792
5032
|
);
|
|
4793
5033
|
return {
|
|
5034
|
+
// fields: [BODY_FIELD],
|
|
4794
5035
|
fields: makeFieldsWithInternalCode({
|
|
4795
5036
|
hasBody,
|
|
4796
5037
|
field: fieldsString,
|
|
@@ -4808,6 +5049,8 @@ var generateCollectionFromForestrySection = (args) => {
|
|
|
4808
5049
|
const fieldsString = stringifyLabelWithField(template.templateObj.label);
|
|
4809
5050
|
c = {
|
|
4810
5051
|
...baseCollection,
|
|
5052
|
+
// fields: [BODY_FIELD],
|
|
5053
|
+
// @ts-expect-error
|
|
4811
5054
|
fields: makeFieldsWithInternalCode({
|
|
4812
5055
|
field: fieldsString,
|
|
4813
5056
|
hasBody,
|
|
@@ -4839,9 +5082,9 @@ var generateCollectionFromForestrySection = (args) => {
|
|
|
4839
5082
|
return c;
|
|
4840
5083
|
} else if (section.type === "document") {
|
|
4841
5084
|
const filePath = section.path;
|
|
4842
|
-
const extname =
|
|
4843
|
-
const fileName =
|
|
4844
|
-
const dir =
|
|
5085
|
+
const extname = import_path9.default.extname(filePath);
|
|
5086
|
+
const fileName = import_path9.default.basename(filePath, extname);
|
|
5087
|
+
const dir = import_path9.default.dirname(filePath);
|
|
4845
5088
|
const ext = checkExt(extname);
|
|
4846
5089
|
if (ext) {
|
|
4847
5090
|
const fields = [];
|
|
@@ -4904,7 +5147,7 @@ var generateCollections = async ({
|
|
|
4904
5147
|
usingTypescript
|
|
4905
5148
|
});
|
|
4906
5149
|
const forestryConfig = await import_fs_extra10.default.readFile(
|
|
4907
|
-
|
|
5150
|
+
import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
4908
5151
|
);
|
|
4909
5152
|
rewriteTemplateKeysInDocs({
|
|
4910
5153
|
templateMap,
|
|
@@ -4935,11 +5178,11 @@ var rewriteTemplateKeysInDocs = (args) => {
|
|
|
4935
5178
|
const { templateObj } = templateMap.get(templateKey);
|
|
4936
5179
|
(_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
|
|
4937
5180
|
try {
|
|
4938
|
-
const filePath =
|
|
5181
|
+
const filePath = import_path9.default.join(page);
|
|
4939
5182
|
if (import_fs_extra10.default.lstatSync(filePath).isDirectory()) {
|
|
4940
5183
|
return;
|
|
4941
5184
|
}
|
|
4942
|
-
const extname =
|
|
5185
|
+
const extname = import_path9.default.extname(filePath);
|
|
4943
5186
|
const fileContent = import_fs_extra10.default.readFileSync(filePath).toString();
|
|
4944
5187
|
const content = (0, import_graphql16.parseFile)(
|
|
4945
5188
|
fileContent,
|
|
@@ -4971,7 +5214,7 @@ var import_fs_extra13 = __toESM(require("fs-extra"));
|
|
|
4971
5214
|
// src/next/commands/codemod-command/index.ts
|
|
4972
5215
|
var import_clipanion5 = require("clipanion");
|
|
4973
5216
|
var import_fs_extra11 = __toESM(require("fs-extra"));
|
|
4974
|
-
var
|
|
5217
|
+
var import_path10 = __toESM(require("path"));
|
|
4975
5218
|
var CodemodCommand = class extends import_clipanion5.Command {
|
|
4976
5219
|
constructor() {
|
|
4977
5220
|
super(...arguments);
|
|
@@ -5015,7 +5258,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
5015
5258
|
logger.error(e.message);
|
|
5016
5259
|
process.exit(1);
|
|
5017
5260
|
}
|
|
5018
|
-
const tinaDestination =
|
|
5261
|
+
const tinaDestination = import_path10.default.join(configManager.rootPath, "tina");
|
|
5019
5262
|
if (await import_fs_extra11.default.existsSync(tinaDestination)) {
|
|
5020
5263
|
logger.info(
|
|
5021
5264
|
`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 +5273,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
5030
5273
|
};
|
|
5031
5274
|
var writeGitignore = async (rootPath) => {
|
|
5032
5275
|
await import_fs_extra11.default.outputFileSync(
|
|
5033
|
-
|
|
5276
|
+
import_path10.default.join(rootPath, "tina", ".gitignore"),
|
|
5034
5277
|
"__generated__"
|
|
5035
5278
|
);
|
|
5036
5279
|
};
|
|
@@ -5555,6 +5798,7 @@ var makeImportsVisitor = (sourceFile, importMap) => (ctx) => (node) => {
|
|
|
5555
5798
|
) : [];
|
|
5556
5799
|
const newImports = [
|
|
5557
5800
|
.../* @__PURE__ */ new Set([
|
|
5801
|
+
// we use Set to remove duplicates
|
|
5558
5802
|
...existingImports,
|
|
5559
5803
|
...imports
|
|
5560
5804
|
])
|
|
@@ -5709,6 +5953,7 @@ var addSelfHostedTinaAuthToConfig = async (config2, configFile) => {
|
|
|
5709
5953
|
);
|
|
5710
5954
|
const { configImports, configAuthProviderClass, extraTinaCollections } = config2.authProvider;
|
|
5711
5955
|
const importMap = {
|
|
5956
|
+
// iterate over configImports and add them to the import map
|
|
5712
5957
|
...configImports.reduce((acc, { from, imported }) => {
|
|
5713
5958
|
acc[from] = imported;
|
|
5714
5959
|
return acc;
|
|
@@ -5868,8 +6113,8 @@ async function apply({
|
|
|
5868
6113
|
await addConfigFile({
|
|
5869
6114
|
configArgs: {
|
|
5870
6115
|
config: config2,
|
|
5871
|
-
publicFolder:
|
|
5872
|
-
|
|
6116
|
+
publicFolder: import_path11.default.join(
|
|
6117
|
+
import_path11.default.relative(process.cwd(), pathToForestryConfig),
|
|
5873
6118
|
config2.publicFolder
|
|
5874
6119
|
),
|
|
5875
6120
|
collections,
|
|
@@ -5883,7 +6128,13 @@ async function apply({
|
|
|
5883
6128
|
config: config2
|
|
5884
6129
|
});
|
|
5885
6130
|
}
|
|
5886
|
-
if (
|
|
6131
|
+
if (
|
|
6132
|
+
// if the config was just generated we do not need to update the config file because it will be generated correctly
|
|
6133
|
+
env.tinaConfigExists && // Are we running tinacms init backend
|
|
6134
|
+
params.isBackendInit && // Do the user choose the 'self-host' option
|
|
6135
|
+
config2.hosting === "self-host" && // the user did not choose the 'tina-cloud' auth provider
|
|
6136
|
+
(((_a = config2.authProvider) == null ? void 0 : _a.name) || "") !== "tina-cloud"
|
|
6137
|
+
) {
|
|
5887
6138
|
await addSelfHostedTinaAuthToConfig(config2, env.generatedFiles["config"]);
|
|
5888
6139
|
}
|
|
5889
6140
|
logNextSteps({
|
|
@@ -5936,18 +6187,18 @@ var createPackageJSON = async () => {
|
|
|
5936
6187
|
};
|
|
5937
6188
|
var createGitignore = async ({ baseDir }) => {
|
|
5938
6189
|
logger.info(logText("No .gitignore found, creating one"));
|
|
5939
|
-
import_fs_extra13.default.outputFileSync(
|
|
6190
|
+
import_fs_extra13.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
|
|
5940
6191
|
};
|
|
5941
6192
|
var updateGitIgnore = async ({
|
|
5942
6193
|
baseDir,
|
|
5943
6194
|
items
|
|
5944
6195
|
}) => {
|
|
5945
6196
|
logger.info(logText(`Adding ${items.join(",")} to .gitignore`));
|
|
5946
|
-
const gitignoreContent = import_fs_extra13.default.readFileSync(
|
|
6197
|
+
const gitignoreContent = import_fs_extra13.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
|
|
5947
6198
|
const newGitignoreContent = [...gitignoreContent.split("\n"), ...items].join(
|
|
5948
6199
|
"\n"
|
|
5949
6200
|
);
|
|
5950
|
-
await import_fs_extra13.default.writeFile(
|
|
6201
|
+
await import_fs_extra13.default.writeFile(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
|
|
5951
6202
|
};
|
|
5952
6203
|
var addDependencies = async (config2, env, params) => {
|
|
5953
6204
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -6017,22 +6268,22 @@ var writeGeneratedFile = async ({
|
|
|
6017
6268
|
content,
|
|
6018
6269
|
typescript
|
|
6019
6270
|
}) => {
|
|
6020
|
-
const { exists, path:
|
|
6271
|
+
const { exists, path: path14, parentPath } = generatedFile.resolve(typescript);
|
|
6021
6272
|
if (exists) {
|
|
6022
6273
|
if (overwrite) {
|
|
6023
|
-
logger.info(`Overwriting file at ${
|
|
6024
|
-
import_fs_extra13.default.outputFileSync(
|
|
6274
|
+
logger.info(`Overwriting file at ${path14}... \u2705`);
|
|
6275
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6025
6276
|
} else {
|
|
6026
|
-
logger.info(`Not overwriting file at ${
|
|
6277
|
+
logger.info(`Not overwriting file at ${path14}.`);
|
|
6027
6278
|
logger.info(
|
|
6028
|
-
logText(`Please add the following to ${
|
|
6279
|
+
logText(`Please add the following to ${path14}:
|
|
6029
6280
|
${indentText(content)}}`)
|
|
6030
6281
|
);
|
|
6031
6282
|
}
|
|
6032
6283
|
} else {
|
|
6033
|
-
logger.info(`Adding file at ${
|
|
6284
|
+
logger.info(`Adding file at ${path14}... \u2705`);
|
|
6034
6285
|
await import_fs_extra13.default.ensureDir(parentPath);
|
|
6035
|
-
import_fs_extra13.default.outputFileSync(
|
|
6286
|
+
import_fs_extra13.default.outputFileSync(path14, content);
|
|
6036
6287
|
}
|
|
6037
6288
|
};
|
|
6038
6289
|
var addConfigFile = async ({
|
|
@@ -6115,7 +6366,7 @@ var addContentFile = async ({
|
|
|
6115
6366
|
return () => ({
|
|
6116
6367
|
exists: env.sampleContentExists,
|
|
6117
6368
|
path: env.sampleContentPath,
|
|
6118
|
-
parentPath:
|
|
6369
|
+
parentPath: import_path11.default.dirname(env.sampleContentPath)
|
|
6119
6370
|
});
|
|
6120
6371
|
}
|
|
6121
6372
|
},
|
|
@@ -6138,7 +6389,7 @@ ${titleText(" TinaCMS ")} backend initialized!`));
|
|
|
6138
6389
|
return `${x.key}=${x.value || "***"}`;
|
|
6139
6390
|
}).join("\n") + `
|
|
6140
6391
|
TINA_PUBLIC_IS_LOCAL=true`;
|
|
6141
|
-
const envFile =
|
|
6392
|
+
const envFile = import_path11.default.join(process.cwd(), ".env");
|
|
6142
6393
|
if (!import_fs_extra13.default.existsSync(envFile)) {
|
|
6143
6394
|
logger.info(`Adding .env file to your project... \u2705`);
|
|
6144
6395
|
import_fs_extra13.default.writeFileSync(envFile, envFileText);
|
|
@@ -6176,6 +6427,7 @@ var other = ({ packageManager }) => {
|
|
|
6176
6427
|
const packageManagers = {
|
|
6177
6428
|
pnpm: `pnpm`,
|
|
6178
6429
|
npm: `npx`,
|
|
6430
|
+
// npx is the way to run executables that aren't in your "scripts"
|
|
6179
6431
|
yarn: `yarn`
|
|
6180
6432
|
};
|
|
6181
6433
|
return `${packageManagers[packageManager]} tinacms dev -c "<your dev command>"`;
|
|
@@ -6188,6 +6440,7 @@ var frameworkDevCmds = {
|
|
|
6188
6440
|
const packageManagers = {
|
|
6189
6441
|
pnpm: `pnpm`,
|
|
6190
6442
|
npm: `npm run`,
|
|
6443
|
+
// npx is the way to run executables that aren't in your "scripts"
|
|
6191
6444
|
yarn: `yarn`
|
|
6192
6445
|
};
|
|
6193
6446
|
return `${packageManagers[packageManager]} dev`;
|
|
@@ -6202,7 +6455,7 @@ var addReactiveFile = {
|
|
|
6202
6455
|
dataLayer
|
|
6203
6456
|
}) => {
|
|
6204
6457
|
var _a, _b;
|
|
6205
|
-
const packageJsonPath =
|
|
6458
|
+
const packageJsonPath = import_path11.default.join(baseDir, "package.json");
|
|
6206
6459
|
await writeGeneratedFile({
|
|
6207
6460
|
generatedFile,
|
|
6208
6461
|
typescript: config2.typescript,
|
|
@@ -6445,5 +6698,3 @@ cli.register(import_clipanion8.Builtins.DefinitionsCommand);
|
|
|
6445
6698
|
cli.register(import_clipanion8.Builtins.HelpCommand);
|
|
6446
6699
|
cli.register(import_clipanion8.Builtins.VersionCommand);
|
|
6447
6700
|
var src_default = cli;
|
|
6448
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
6449
|
-
0 && (module.exports = {});
|
|
@@ -21,15 +21,25 @@ 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
|
+
remoteRuntimeVersion: string;
|
|
40
|
+
remoteProjectVersion: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const fetchSchemaSha: ({ url, token, }: {
|
|
43
|
+
url: string;
|
|
44
|
+
token?: string;
|
|
35
45
|
}) => Promise<any>;
|
|
@@ -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/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-ea9cd70-20250214011423",
|
|
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",
|
|
@@ -66,7 +65,7 @@
|
|
|
66
65
|
"cors": "^2.8.5",
|
|
67
66
|
"crypto-js": "^4.2.0",
|
|
68
67
|
"dotenv": "^16.4.5",
|
|
69
|
-
"esbuild": "^0.
|
|
68
|
+
"esbuild": "^0.24.0",
|
|
70
69
|
"fs-extra": "^11.2.0",
|
|
71
70
|
"graphql": "15.8.0",
|
|
72
71
|
"js-yaml": "^4.1.0",
|
|
@@ -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/app": "
|
|
89
|
-
"@tinacms/
|
|
90
|
-
"@tinacms/schema-tools": "
|
|
91
|
-
"@tinacms/
|
|
92
|
-
"@tinacms/search": "
|
|
93
|
-
"tinacms": "
|
|
87
|
+
"@tinacms/app": "2.1.19",
|
|
88
|
+
"@tinacms/graphql": "1.5.12",
|
|
89
|
+
"@tinacms/schema-tools": "1.7.0",
|
|
90
|
+
"@tinacms/metrics": "1.0.8",
|
|
91
|
+
"@tinacms/search": "1.0.39",
|
|
92
|
+
"tinacms": "2.6.4"
|
|
94
93
|
},
|
|
95
94
|
"publishConfig": {
|
|
96
95
|
"registry": "https://registry.npmjs.org"
|