@tinacms/cli 1.5.18 → 1.5.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
31
|
var import_clipanion8 = require("clipanion");
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "1.5.
|
|
34
|
+
var version = "1.5.20";
|
|
35
35
|
|
|
36
36
|
// src/next/commands/dev-command/index.ts
|
|
37
37
|
var import_clipanion2 = require("clipanion");
|
|
@@ -270,10 +270,13 @@ var ConfigManager = class {
|
|
|
270
270
|
await import_fs_extra.default.outputFile(this.generatedClientJSFilePath, file);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
|
|
273
|
+
const { config: config3, prebuildPath, watchList } = await this.loadConfigFile(
|
|
274
274
|
this.generatedFolderPath,
|
|
275
275
|
this.tinaConfigFilePath
|
|
276
276
|
);
|
|
277
|
+
this.watchList = watchList;
|
|
278
|
+
this.config = config3;
|
|
279
|
+
this.prebuildFilePath = prebuildPath;
|
|
277
280
|
this.publicFolderPath = import_path.default.join(
|
|
278
281
|
this.rootPath,
|
|
279
282
|
this.config.build.publicFolder
|
|
@@ -361,6 +364,9 @@ var ConfigManager = class {
|
|
|
361
364
|
}
|
|
362
365
|
throw `No path provided to print`;
|
|
363
366
|
}
|
|
367
|
+
printPrebuildFilePath() {
|
|
368
|
+
return this.prebuildFilePath.replace(/\\/g, "/").replace(`${this.rootPath}/${this.tinaFolderPath}/`, "");
|
|
369
|
+
}
|
|
364
370
|
printContentRelativePath(filename) {
|
|
365
371
|
if (filename) {
|
|
366
372
|
return filename.replace(/\\/g, "/").replace(`${this.contentRootPath}/`, "");
|
|
@@ -400,14 +406,36 @@ var ConfigManager = class {
|
|
|
400
406
|
}
|
|
401
407
|
async loadConfigFile(generatedFolderPath, configFilePath) {
|
|
402
408
|
const tmpdir = import_path.default.join(import_os.default.tmpdir(), Date.now().toString());
|
|
409
|
+
const prebuild = import_path.default.join(this.generatedFolderPath, "config.prebuild.jsx");
|
|
403
410
|
const outfile = import_path.default.join(tmpdir, "config.build.jsx");
|
|
404
411
|
const outfile2 = import_path.default.join(tmpdir, "config.build.js");
|
|
405
412
|
const tempTSConfigFile = import_path.default.join(tmpdir, "tsconfig.json");
|
|
406
413
|
await import_fs_extra.default.outputFileSync(tempTSConfigFile, "{}");
|
|
414
|
+
const result2 = await esbuild.build({
|
|
415
|
+
entryPoints: [configFilePath],
|
|
416
|
+
bundle: true,
|
|
417
|
+
target: ["es2020"],
|
|
418
|
+
platform: "browser",
|
|
419
|
+
format: "esm",
|
|
420
|
+
logLevel: "silent",
|
|
421
|
+
external: ["tinacms", "react", "react-dom", "next"],
|
|
422
|
+
ignoreAnnotations: true,
|
|
423
|
+
outfile: prebuild,
|
|
424
|
+
loader: loaders,
|
|
425
|
+
metafile: true
|
|
426
|
+
});
|
|
427
|
+
const flattenedList = [];
|
|
428
|
+
Object.keys(result2.metafile.inputs).forEach((key) => {
|
|
429
|
+
if (key.includes("node_modules") || key.includes("__generated__")) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
flattenedList.push(key);
|
|
433
|
+
});
|
|
407
434
|
await esbuild.build({
|
|
408
435
|
entryPoints: [configFilePath],
|
|
409
436
|
bundle: true,
|
|
410
437
|
target: ["es2020"],
|
|
438
|
+
logLevel: "silent",
|
|
411
439
|
platform: "node",
|
|
412
440
|
outfile,
|
|
413
441
|
loader: loaders
|
|
@@ -415,6 +443,7 @@ var ConfigManager = class {
|
|
|
415
443
|
await esbuild.build({
|
|
416
444
|
entryPoints: [outfile],
|
|
417
445
|
bundle: true,
|
|
446
|
+
logLevel: "silent",
|
|
418
447
|
platform: "node",
|
|
419
448
|
outfile: outfile2,
|
|
420
449
|
loader: loaders
|
|
@@ -422,7 +451,11 @@ var ConfigManager = class {
|
|
|
422
451
|
const result = require(outfile2);
|
|
423
452
|
await import_fs_extra.default.removeSync(outfile);
|
|
424
453
|
await import_fs_extra.default.removeSync(outfile2);
|
|
425
|
-
return
|
|
454
|
+
return {
|
|
455
|
+
config: result.default,
|
|
456
|
+
prebuildPath: prebuild,
|
|
457
|
+
watchList: flattenedList
|
|
458
|
+
};
|
|
426
459
|
}
|
|
427
460
|
};
|
|
428
461
|
var loaders = {
|
|
@@ -527,6 +560,23 @@ var devHTML = (port) => `<!DOCTYPE html>
|
|
|
527
560
|
</body>
|
|
528
561
|
</html>`;
|
|
529
562
|
|
|
563
|
+
// src/utils/theme.ts
|
|
564
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
565
|
+
var successText = import_chalk3.default.bold.green;
|
|
566
|
+
var focusText = import_chalk3.default.bold;
|
|
567
|
+
var dangerText = import_chalk3.default.bold.red;
|
|
568
|
+
var neutralText = import_chalk3.default.bold.cyan;
|
|
569
|
+
var linkText = import_chalk3.default.bold.cyan;
|
|
570
|
+
var labelText = import_chalk3.default.bold;
|
|
571
|
+
var cmdText = import_chalk3.default.inverse;
|
|
572
|
+
var indentedCmd = (str) => {
|
|
573
|
+
return ` \u2503 ` + str;
|
|
574
|
+
};
|
|
575
|
+
var logText = import_chalk3.default.italic.gray;
|
|
576
|
+
var warnText = import_chalk3.default.yellowBright.bgBlack;
|
|
577
|
+
var titleText = import_chalk3.default.bgHex("d2f1f8").hex("ec4816");
|
|
578
|
+
var CONFIRMATION_TEXT = import_chalk3.default.dim("enter to confirm");
|
|
579
|
+
|
|
530
580
|
// src/next/commands/dev-command/server/index.ts
|
|
531
581
|
var import_vite3 = require("vite");
|
|
532
582
|
|
|
@@ -541,17 +591,16 @@ var import_postcss_nested = __toESM(require("postcss-nested/index.js"));
|
|
|
541
591
|
var import_nesting = __toESM(require("tailwindcss/nesting/index.js"));
|
|
542
592
|
var import_defaultTheme = __toESM(require("tailwindcss/defaultTheme.js"));
|
|
543
593
|
var import_typography = __toESM(require("@tailwindcss/typography"));
|
|
544
|
-
var import_line_clamp = __toESM(require("@tailwindcss/line-clamp"));
|
|
545
594
|
var import_aspect_ratio = __toESM(require("@tailwindcss/aspect-ratio"));
|
|
546
595
|
var import_path2 = __toESM(require("path"));
|
|
547
|
-
var tinaTailwind = (spaPath,
|
|
596
|
+
var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
548
597
|
return {
|
|
549
598
|
name: "vite-plugin-tina",
|
|
550
599
|
config: (viteConfig) => {
|
|
551
600
|
const plugins = [];
|
|
552
601
|
const content2 = [
|
|
553
602
|
import_path2.default.join(spaPath, "src/**/*.{vue,js,ts,jsx,tsx,svelte}"),
|
|
554
|
-
|
|
603
|
+
prebuildFilePath
|
|
555
604
|
];
|
|
556
605
|
const tw = (0, import_tailwindcss.default)({
|
|
557
606
|
important: ".tina-tailwind",
|
|
@@ -770,7 +819,6 @@ var tinaTailwind = (spaPath, configFilePath) => {
|
|
|
770
819
|
content: content2,
|
|
771
820
|
plugins: [
|
|
772
821
|
(0, import_typography.default)({ className: "tina-prose" }),
|
|
773
|
-
import_line_clamp.default,
|
|
774
822
|
import_aspect_ratio.default
|
|
775
823
|
]
|
|
776
824
|
});
|
|
@@ -817,7 +865,7 @@ var createConfig = async ({
|
|
|
817
865
|
}
|
|
818
866
|
});
|
|
819
867
|
const alias = {
|
|
820
|
-
TINA_IMPORT: configManager.
|
|
868
|
+
TINA_IMPORT: configManager.prebuildFilePath,
|
|
821
869
|
SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath
|
|
822
870
|
};
|
|
823
871
|
if (configManager.shouldSkipSDK()) {
|
|
@@ -859,7 +907,11 @@ var createConfig = async ({
|
|
|
859
907
|
host: (_c = (_b = (_a = configManager.config) == null ? void 0 : _a.build) == null ? void 0 : _b.host) != null ? _c : false,
|
|
860
908
|
watch: noWatch ? {
|
|
861
909
|
ignored: ["**/*"]
|
|
862
|
-
} :
|
|
910
|
+
} : {
|
|
911
|
+
ignored: [
|
|
912
|
+
`${configManager.tinaFolderPath}/**/!(config.prebuild.jsx|_graphql.json)`
|
|
913
|
+
]
|
|
914
|
+
},
|
|
863
915
|
fs: {
|
|
864
916
|
strict: false
|
|
865
917
|
}
|
|
@@ -871,9 +923,13 @@ var createConfig = async ({
|
|
|
871
923
|
rollupOptions
|
|
872
924
|
},
|
|
873
925
|
plugins: [
|
|
874
|
-
(0, import_plugin_react.default)(
|
|
926
|
+
(0, import_plugin_react.default)({
|
|
927
|
+
babel: {
|
|
928
|
+
compact: true
|
|
929
|
+
}
|
|
930
|
+
}),
|
|
875
931
|
(0, import_vite.splitVendorChunkPlugin)(),
|
|
876
|
-
tinaTailwind(configManager.spaRootPath, configManager.
|
|
932
|
+
tinaTailwind(configManager.spaRootPath, configManager.prebuildFilePath),
|
|
877
933
|
...plugins
|
|
878
934
|
]
|
|
879
935
|
};
|
|
@@ -1055,6 +1111,7 @@ var createSearchIndexRouter = ({
|
|
|
1055
1111
|
const put = async (req, res) => {
|
|
1056
1112
|
const { docs } = req.body;
|
|
1057
1113
|
const result = await searchIndex.PUT(docs);
|
|
1114
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1058
1115
|
res.end(JSON.stringify({ result }));
|
|
1059
1116
|
};
|
|
1060
1117
|
const get = async (req, res) => {
|
|
@@ -1070,6 +1127,7 @@ var createSearchIndexRouter = ({
|
|
|
1070
1127
|
...JSON.parse(optionsParam)
|
|
1071
1128
|
};
|
|
1072
1129
|
}
|
|
1130
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1073
1131
|
if (query) {
|
|
1074
1132
|
const result = await searchIndex.QUERY(JSON.parse(query), options);
|
|
1075
1133
|
res.end(JSON.stringify(result));
|
|
@@ -1081,6 +1139,7 @@ var createSearchIndexRouter = ({
|
|
|
1081
1139
|
const requestURL = new URL(req.url, config3.apiURL);
|
|
1082
1140
|
const docId = requestURL.pathname.split("/").filter(Boolean).slice(1).join("/");
|
|
1083
1141
|
const result = await searchIndex.DELETE(docId);
|
|
1142
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1084
1143
|
res.end(JSON.stringify({ result }));
|
|
1085
1144
|
};
|
|
1086
1145
|
return { del, get, put };
|
|
@@ -1698,25 +1757,6 @@ var import_chalk4 = __toESM(require("chalk"));
|
|
|
1698
1757
|
|
|
1699
1758
|
// src/utils/start-subprocess.ts
|
|
1700
1759
|
var import_child_process = __toESM(require("child_process"));
|
|
1701
|
-
|
|
1702
|
-
// src/utils/theme.ts
|
|
1703
|
-
var import_chalk3 = __toESM(require("chalk"));
|
|
1704
|
-
var successText = import_chalk3.default.bold.green;
|
|
1705
|
-
var focusText = import_chalk3.default.bold;
|
|
1706
|
-
var dangerText = import_chalk3.default.bold.red;
|
|
1707
|
-
var neutralText = import_chalk3.default.bold.cyan;
|
|
1708
|
-
var linkText = import_chalk3.default.bold.cyan;
|
|
1709
|
-
var labelText = import_chalk3.default.bold;
|
|
1710
|
-
var cmdText = import_chalk3.default.inverse;
|
|
1711
|
-
var indentedCmd = (str) => {
|
|
1712
|
-
return ` \u2503 ` + str;
|
|
1713
|
-
};
|
|
1714
|
-
var logText = import_chalk3.default.italic.gray;
|
|
1715
|
-
var warnText = import_chalk3.default.yellowBright.bgBlack;
|
|
1716
|
-
var titleText = import_chalk3.default.bgHex("d2f1f8").hex("ec4816");
|
|
1717
|
-
var CONFIRMATION_TEXT = import_chalk3.default.dim("enter to confirm");
|
|
1718
|
-
|
|
1719
|
-
// src/utils/start-subprocess.ts
|
|
1720
1760
|
var startSubprocess2 = async ({ command }) => {
|
|
1721
1761
|
if (typeof command === "string") {
|
|
1722
1762
|
const commands = command.split(" ");
|
|
@@ -1877,7 +1917,6 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
1877
1917
|
};
|
|
1878
1918
|
|
|
1879
1919
|
// src/next/commands/dev-command/index.ts
|
|
1880
|
-
var import_memory_level2 = require("memory-level");
|
|
1881
1920
|
var import_search = require("@tinacms/search");
|
|
1882
1921
|
var DevCommand = class extends BaseCommand {
|
|
1883
1922
|
constructor() {
|
|
@@ -1888,6 +1927,9 @@ var DevCommand = class extends BaseCommand {
|
|
|
1888
1927
|
this.noWatch = import_clipanion2.Option.Boolean("--noWatch", false, {
|
|
1889
1928
|
description: "Don't regenerate config on file changes"
|
|
1890
1929
|
});
|
|
1930
|
+
this.outputSearchIndexPath = import_clipanion2.Option.String("--outputSearchIndexPath", {
|
|
1931
|
+
description: "Path to write the search index to"
|
|
1932
|
+
});
|
|
1891
1933
|
}
|
|
1892
1934
|
async catch(error) {
|
|
1893
1935
|
logger.error("Error occured during tinacms dev");
|
|
@@ -1903,7 +1945,7 @@ var DevCommand = class extends BaseCommand {
|
|
|
1903
1945
|
}
|
|
1904
1946
|
}
|
|
1905
1947
|
async execute() {
|
|
1906
|
-
var _a, _b, _c, _d;
|
|
1948
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1907
1949
|
const configManager = new ConfigManager({
|
|
1908
1950
|
rootPath: this.rootPath,
|
|
1909
1951
|
legacyNoSDK: this.noSDK
|
|
@@ -1915,63 +1957,70 @@ var DevCommand = class extends BaseCommand {
|
|
|
1915
1957
|
const setup = async ({ firstTime }) => {
|
|
1916
1958
|
try {
|
|
1917
1959
|
await configManager.processConfig();
|
|
1960
|
+
if (firstTime) {
|
|
1961
|
+
database = await createAndInitializeDatabase(
|
|
1962
|
+
configManager,
|
|
1963
|
+
Number(this.datalayerPort)
|
|
1964
|
+
);
|
|
1965
|
+
} else {
|
|
1966
|
+
database.clearCache();
|
|
1967
|
+
}
|
|
1968
|
+
const { tinaSchema: tinaSchema2, graphQLSchema: graphQLSchema2, lookup, queryDoc, fragDoc } = await (0, import_graphql8.buildSchema)(configManager.config);
|
|
1969
|
+
const codegen2 = new Codegen({
|
|
1970
|
+
isLocal: true,
|
|
1971
|
+
configManager,
|
|
1972
|
+
port: Number(this.port),
|
|
1973
|
+
queryDoc,
|
|
1974
|
+
fragDoc,
|
|
1975
|
+
graphqlSchemaDoc: graphQLSchema2,
|
|
1976
|
+
tinaSchema: tinaSchema2,
|
|
1977
|
+
lookup
|
|
1978
|
+
});
|
|
1979
|
+
const apiURL2 = await codegen2.execute();
|
|
1980
|
+
if (!configManager.isUsingLegacyFolder) {
|
|
1981
|
+
delete require.cache[configManager.generatedSchemaJSONPath];
|
|
1982
|
+
delete require.cache[configManager.generatedLookupJSONPath];
|
|
1983
|
+
delete require.cache[configManager.generatedGraphQLJSONPath];
|
|
1984
|
+
const schemaObject = require(configManager.generatedSchemaJSONPath);
|
|
1985
|
+
const lookupObject = require(configManager.generatedLookupJSONPath);
|
|
1986
|
+
const graphqlSchemaObject = require(configManager.generatedGraphQLJSONPath);
|
|
1987
|
+
await import_fs_extra4.default.writeFileSync(
|
|
1988
|
+
import_path7.default.join(configManager.tinaFolderPath, "tina-lock.json"),
|
|
1989
|
+
JSON.stringify({
|
|
1990
|
+
schema: schemaObject,
|
|
1991
|
+
lookup: lookupObject,
|
|
1992
|
+
graphql: graphqlSchemaObject
|
|
1993
|
+
})
|
|
1994
|
+
);
|
|
1995
|
+
}
|
|
1996
|
+
if (!this.noWatch) {
|
|
1997
|
+
this.watchQueries(configManager, async () => await codegen2.execute());
|
|
1998
|
+
}
|
|
1999
|
+
await this.indexContentWithSpinner({
|
|
2000
|
+
database,
|
|
2001
|
+
graphQLSchema: graphQLSchema2,
|
|
2002
|
+
tinaSchema: tinaSchema2
|
|
2003
|
+
});
|
|
2004
|
+
if (!firstTime) {
|
|
2005
|
+
logger.error("Re-index complete");
|
|
2006
|
+
}
|
|
2007
|
+
return { apiURL: apiURL2, database, graphQLSchema: graphQLSchema2, tinaSchema: tinaSchema2 };
|
|
1918
2008
|
} catch (e) {
|
|
1919
|
-
logger.error(e.message);
|
|
2009
|
+
logger.error(dangerText(e.message));
|
|
1920
2010
|
if (this.verbose) {
|
|
1921
2011
|
console.error(e);
|
|
1922
2012
|
}
|
|
1923
2013
|
if (firstTime) {
|
|
1924
2014
|
logger.error(
|
|
1925
|
-
|
|
2015
|
+
warnText(
|
|
2016
|
+
"Unable to start dev server, please fix your Tina config and try again"
|
|
2017
|
+
)
|
|
1926
2018
|
);
|
|
1927
2019
|
process.exit(1);
|
|
2020
|
+
} else {
|
|
2021
|
+
logger.error(warnText("Dev server has not been restarted"));
|
|
1928
2022
|
}
|
|
1929
2023
|
}
|
|
1930
|
-
if (firstTime) {
|
|
1931
|
-
database = await createAndInitializeDatabase(
|
|
1932
|
-
configManager,
|
|
1933
|
-
Number(this.datalayerPort)
|
|
1934
|
-
);
|
|
1935
|
-
} else {
|
|
1936
|
-
database.clearCache();
|
|
1937
|
-
}
|
|
1938
|
-
const { tinaSchema: tinaSchema2, graphQLSchema: graphQLSchema2, lookup, queryDoc, fragDoc } = await (0, import_graphql8.buildSchema)(configManager.config);
|
|
1939
|
-
const codegen2 = new Codegen({
|
|
1940
|
-
isLocal: true,
|
|
1941
|
-
configManager,
|
|
1942
|
-
port: Number(this.port),
|
|
1943
|
-
queryDoc,
|
|
1944
|
-
fragDoc,
|
|
1945
|
-
graphqlSchemaDoc: graphQLSchema2,
|
|
1946
|
-
tinaSchema: tinaSchema2,
|
|
1947
|
-
lookup
|
|
1948
|
-
});
|
|
1949
|
-
const apiURL2 = await codegen2.execute();
|
|
1950
|
-
if (!configManager.isUsingLegacyFolder) {
|
|
1951
|
-
delete require.cache[configManager.generatedSchemaJSONPath];
|
|
1952
|
-
delete require.cache[configManager.generatedLookupJSONPath];
|
|
1953
|
-
delete require.cache[configManager.generatedGraphQLJSONPath];
|
|
1954
|
-
const schemaObject = require(configManager.generatedSchemaJSONPath);
|
|
1955
|
-
const lookupObject = require(configManager.generatedLookupJSONPath);
|
|
1956
|
-
const graphqlSchemaObject = require(configManager.generatedGraphQLJSONPath);
|
|
1957
|
-
await import_fs_extra4.default.writeFileSync(
|
|
1958
|
-
import_path7.default.join(configManager.tinaFolderPath, "tina-lock.json"),
|
|
1959
|
-
JSON.stringify({
|
|
1960
|
-
schema: schemaObject,
|
|
1961
|
-
lookup: lookupObject,
|
|
1962
|
-
graphql: graphqlSchemaObject
|
|
1963
|
-
})
|
|
1964
|
-
);
|
|
1965
|
-
}
|
|
1966
|
-
if (!this.noWatch) {
|
|
1967
|
-
this.watchQueries(configManager, async () => await codegen2.execute());
|
|
1968
|
-
}
|
|
1969
|
-
await this.indexContentWithSpinner({
|
|
1970
|
-
database,
|
|
1971
|
-
graphQLSchema: graphQLSchema2,
|
|
1972
|
-
tinaSchema: tinaSchema2
|
|
1973
|
-
});
|
|
1974
|
-
return { apiURL: apiURL2, database, graphQLSchema: graphQLSchema2, tinaSchema: tinaSchema2 };
|
|
1975
2024
|
};
|
|
1976
2025
|
const { apiURL, graphQLSchema, tinaSchema } = await setup({
|
|
1977
2026
|
firstTime: true
|
|
@@ -1981,39 +2030,28 @@ var DevCommand = class extends BaseCommand {
|
|
|
1981
2030
|
configManager.outputGitignorePath,
|
|
1982
2031
|
"index.html\nassets/"
|
|
1983
2032
|
);
|
|
1984
|
-
const
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
(_b = (_a = configManager.config.search) == null ? void 0 : _a.tina) == null ? void 0 : _b.stopwordLanguages
|
|
1988
|
-
)
|
|
2033
|
+
const searchIndexClient = new import_search.LocalSearchIndexClient({
|
|
2034
|
+
stopwordLanguages: (_b = (_a = configManager.config.search) == null ? void 0 : _a.tina) == null ? void 0 : _b.stopwordLanguages,
|
|
2035
|
+
tokenSplitRegex: (_d = (_c = configManager.config.search) == null ? void 0 : _c.tina) == null ? void 0 : _d.tokenSplitRegex
|
|
1989
2036
|
});
|
|
1990
|
-
|
|
2037
|
+
await searchIndexClient.onStartIndexing();
|
|
1991
2038
|
const server = await createDevServer(
|
|
1992
2039
|
configManager,
|
|
1993
2040
|
database,
|
|
1994
|
-
searchIndex,
|
|
2041
|
+
searchIndexClient.searchIndex,
|
|
1995
2042
|
apiURL,
|
|
1996
2043
|
this.noWatch
|
|
1997
2044
|
);
|
|
1998
2045
|
await server.listen(Number(this.port));
|
|
1999
2046
|
const searchIndexer = new import_search.SearchIndexer({
|
|
2000
|
-
batchSize: ((
|
|
2047
|
+
batchSize: ((_e = configManager.config.search) == null ? void 0 : _e.indexBatchSize) || 100,
|
|
2001
2048
|
bridge: new import_graphql8.FilesystemBridge(
|
|
2002
2049
|
configManager.rootPath,
|
|
2003
2050
|
configManager.contentRootPath
|
|
2004
2051
|
),
|
|
2005
2052
|
schema: tinaSchema,
|
|
2006
2053
|
client: searchIndexClient,
|
|
2007
|
-
textIndexLength: ((
|
|
2008
|
-
});
|
|
2009
|
-
await spin({
|
|
2010
|
-
waitFor: async () => {
|
|
2011
|
-
const res = await database.indexContent({
|
|
2012
|
-
graphQLSchema,
|
|
2013
|
-
tinaSchema
|
|
2014
|
-
});
|
|
2015
|
-
},
|
|
2016
|
-
text: "Indexing local files"
|
|
2054
|
+
textIndexLength: ((_f = configManager.config.search) == null ? void 0 : _f.maxSearchIndexFieldLength) || 100
|
|
2017
2055
|
});
|
|
2018
2056
|
if (configManager.config.search) {
|
|
2019
2057
|
await spin({
|
|
@@ -2022,6 +2060,9 @@ var DevCommand = class extends BaseCommand {
|
|
|
2022
2060
|
},
|
|
2023
2061
|
text: "Building search index"
|
|
2024
2062
|
});
|
|
2063
|
+
if (this.outputSearchIndexPath) {
|
|
2064
|
+
await searchIndexClient.export(this.outputSearchIndexPath);
|
|
2065
|
+
}
|
|
2025
2066
|
}
|
|
2026
2067
|
if (!this.noWatch) {
|
|
2027
2068
|
this.watchContentFiles(
|
|
@@ -2029,24 +2070,12 @@ var DevCommand = class extends BaseCommand {
|
|
|
2029
2070
|
database,
|
|
2030
2071
|
configManager.config.search && searchIndexer
|
|
2031
2072
|
);
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
if (changedPath.includes("__generated__")) {
|
|
2035
|
-
return;
|
|
2036
|
-
}
|
|
2037
|
-
if (changedPath.includes("@tinacms/app")) {
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
if (changedPath.includes("tinacms/dist")) {
|
|
2041
|
-
return;
|
|
2042
|
-
}
|
|
2043
|
-
try {
|
|
2044
|
-
logger.info("Tina config updated");
|
|
2073
|
+
import_chokidar.default.watch(configManager.watchList).on("change", async () => {
|
|
2074
|
+
logger.info(`Tina config change detected, rebuilding`);
|
|
2045
2075
|
await setup({ firstTime: false });
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
});
|
|
2076
|
+
server.ws.send({ type: "full-reload", path: "*" });
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2050
2079
|
const subItems = [];
|
|
2051
2080
|
if (configManager.hasSeparateContentRoot()) {
|
|
2052
2081
|
subItems.push({
|
|
@@ -2272,11 +2301,11 @@ var waitForDB = async (config3, apiUrl, verbose) => {
|
|
|
2272
2301
|
await sleepAndCallFunc({ fn: pollForStatus, ms: POLLING_INTERVAL });
|
|
2273
2302
|
} else if (status === STATUS_FAILED) {
|
|
2274
2303
|
throw new IndexFailedError(
|
|
2275
|
-
`Attempting to index but responded with status 'failed'
|
|
2304
|
+
`Attempting to index but responded with status 'failed'. To retry the indexing process, click the "Reindex" button for '${branch}' in the Tina Cloud configuration for this project. ${error}`
|
|
2276
2305
|
);
|
|
2277
2306
|
} else {
|
|
2278
2307
|
throw new IndexFailedError(
|
|
2279
|
-
`Attempting to index but responded with status 'unknown'
|
|
2308
|
+
`Attempting to index but responded with status 'unknown'. To retry the indexing process, click the "Reindex" button for '${branch}' in the Tina Cloud configuration for this project. ${error}`
|
|
2280
2309
|
);
|
|
2281
2310
|
}
|
|
2282
2311
|
} catch (e) {
|
|
@@ -6,6 +6,7 @@ export declare class DevCommand extends BaseCommand {
|
|
|
6
6
|
static paths: string[][];
|
|
7
7
|
watchFolders: string;
|
|
8
8
|
noWatch: boolean;
|
|
9
|
+
outputSearchIndexPath: string;
|
|
9
10
|
static usage: import("clipanion").Usage;
|
|
10
11
|
catch(error: any): Promise<void>;
|
|
11
12
|
logDeprecationWarnings(): void;
|
|
@@ -32,11 +32,13 @@ export declare class ConfigManager {
|
|
|
32
32
|
outputHTMLFilePath: string;
|
|
33
33
|
outputGitignorePath: string;
|
|
34
34
|
selfHostedDatabaseFilePath?: string;
|
|
35
|
+
prebuildFilePath?: string;
|
|
35
36
|
spaRootPath: string;
|
|
36
37
|
spaMainPath: string;
|
|
37
38
|
spaHTMLPath: string;
|
|
38
39
|
tinaGraphQLVersionFromCLI?: string;
|
|
39
40
|
legacyNoSDK?: boolean;
|
|
41
|
+
watchList?: string[];
|
|
40
42
|
constructor({ rootPath, tinaGraphQLVersion, legacyNoSDK, }: {
|
|
41
43
|
rootPath: string;
|
|
42
44
|
tinaGraphQLVersion?: string;
|
|
@@ -53,13 +55,18 @@ export declare class ConfigManager {
|
|
|
53
55
|
printGeneratedTypesFilePath(): string;
|
|
54
56
|
printoutputHTMLFilePath(): string;
|
|
55
57
|
printRelativePath(filename: string): string;
|
|
58
|
+
printPrebuildFilePath(): string;
|
|
56
59
|
printContentRelativePath(filename: string): string;
|
|
57
60
|
/**
|
|
58
61
|
* Given a filepath without an extension, find the first match (eg. tsx, ts, jsx, js)
|
|
59
62
|
*/
|
|
60
63
|
getPathWithExtension(filepath: string): Promise<any>;
|
|
61
64
|
loadDatabaseFile(): Promise<any>;
|
|
62
|
-
loadConfigFile(generatedFolderPath: string, configFilePath: string): Promise<
|
|
65
|
+
loadConfigFile(generatedFolderPath: string, configFilePath: string): Promise<{
|
|
66
|
+
config: any;
|
|
67
|
+
prebuildPath: string;
|
|
68
|
+
watchList: any[];
|
|
69
|
+
}>;
|
|
63
70
|
}
|
|
64
71
|
export declare const loaders: {
|
|
65
72
|
[ext: string]: Loader;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
export declare const tinaTailwind: (spaPath: string,
|
|
2
|
+
export declare const tinaTailwind: (spaPath: string, prebuildFilePath: string) => Plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.20",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"@tailwindcss/aspect-ratio": "^0.4.0",
|
|
59
59
|
"@tailwindcss/line-clamp": "^0.3.1",
|
|
60
60
|
"@tailwindcss/typography": "^0.5.9",
|
|
61
|
-
"@tinacms/app": "1.2.
|
|
62
|
-
"@tinacms/datalayer": "1.2.
|
|
63
|
-
"@tinacms/graphql": "1.4.
|
|
61
|
+
"@tinacms/app": "1.2.18",
|
|
62
|
+
"@tinacms/datalayer": "1.2.18",
|
|
63
|
+
"@tinacms/graphql": "1.4.18",
|
|
64
64
|
"@tinacms/metrics": "1.0.2",
|
|
65
|
-
"@tinacms/schema-tools": "1.4.
|
|
66
|
-
"@tinacms/search": "1.0.
|
|
65
|
+
"@tinacms/schema-tools": "1.4.7",
|
|
66
|
+
"@tinacms/search": "1.0.3",
|
|
67
67
|
"@vitejs/plugin-react": "3.1.0",
|
|
68
68
|
"ajv": "^6.12.3",
|
|
69
69
|
"altair-express-middleware": "4.0.6",
|