@tinacms/cli 1.5.19 → 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
|
|
|
@@ -543,14 +593,14 @@ var import_defaultTheme = __toESM(require("tailwindcss/defaultTheme.js"));
|
|
|
543
593
|
var import_typography = __toESM(require("@tailwindcss/typography"));
|
|
544
594
|
var import_aspect_ratio = __toESM(require("@tailwindcss/aspect-ratio"));
|
|
545
595
|
var import_path2 = __toESM(require("path"));
|
|
546
|
-
var tinaTailwind = (spaPath,
|
|
596
|
+
var tinaTailwind = (spaPath, prebuildFilePath) => {
|
|
547
597
|
return {
|
|
548
598
|
name: "vite-plugin-tina",
|
|
549
599
|
config: (viteConfig) => {
|
|
550
600
|
const plugins = [];
|
|
551
601
|
const content2 = [
|
|
552
602
|
import_path2.default.join(spaPath, "src/**/*.{vue,js,ts,jsx,tsx,svelte}"),
|
|
553
|
-
|
|
603
|
+
prebuildFilePath
|
|
554
604
|
];
|
|
555
605
|
const tw = (0, import_tailwindcss.default)({
|
|
556
606
|
important: ".tina-tailwind",
|
|
@@ -815,7 +865,7 @@ var createConfig = async ({
|
|
|
815
865
|
}
|
|
816
866
|
});
|
|
817
867
|
const alias = {
|
|
818
|
-
TINA_IMPORT: configManager.
|
|
868
|
+
TINA_IMPORT: configManager.prebuildFilePath,
|
|
819
869
|
SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath
|
|
820
870
|
};
|
|
821
871
|
if (configManager.shouldSkipSDK()) {
|
|
@@ -857,7 +907,11 @@ var createConfig = async ({
|
|
|
857
907
|
host: (_c = (_b = (_a = configManager.config) == null ? void 0 : _a.build) == null ? void 0 : _b.host) != null ? _c : false,
|
|
858
908
|
watch: noWatch ? {
|
|
859
909
|
ignored: ["**/*"]
|
|
860
|
-
} :
|
|
910
|
+
} : {
|
|
911
|
+
ignored: [
|
|
912
|
+
`${configManager.tinaFolderPath}/**/!(config.prebuild.jsx|_graphql.json)`
|
|
913
|
+
]
|
|
914
|
+
},
|
|
861
915
|
fs: {
|
|
862
916
|
strict: false
|
|
863
917
|
}
|
|
@@ -869,9 +923,13 @@ var createConfig = async ({
|
|
|
869
923
|
rollupOptions
|
|
870
924
|
},
|
|
871
925
|
plugins: [
|
|
872
|
-
(0, import_plugin_react.default)(
|
|
926
|
+
(0, import_plugin_react.default)({
|
|
927
|
+
babel: {
|
|
928
|
+
compact: true
|
|
929
|
+
}
|
|
930
|
+
}),
|
|
873
931
|
(0, import_vite.splitVendorChunkPlugin)(),
|
|
874
|
-
tinaTailwind(configManager.spaRootPath, configManager.
|
|
932
|
+
tinaTailwind(configManager.spaRootPath, configManager.prebuildFilePath),
|
|
875
933
|
...plugins
|
|
876
934
|
]
|
|
877
935
|
};
|
|
@@ -1053,6 +1111,7 @@ var createSearchIndexRouter = ({
|
|
|
1053
1111
|
const put = async (req, res) => {
|
|
1054
1112
|
const { docs } = req.body;
|
|
1055
1113
|
const result = await searchIndex.PUT(docs);
|
|
1114
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1056
1115
|
res.end(JSON.stringify({ result }));
|
|
1057
1116
|
};
|
|
1058
1117
|
const get = async (req, res) => {
|
|
@@ -1068,6 +1127,7 @@ var createSearchIndexRouter = ({
|
|
|
1068
1127
|
...JSON.parse(optionsParam)
|
|
1069
1128
|
};
|
|
1070
1129
|
}
|
|
1130
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1071
1131
|
if (query) {
|
|
1072
1132
|
const result = await searchIndex.QUERY(JSON.parse(query), options);
|
|
1073
1133
|
res.end(JSON.stringify(result));
|
|
@@ -1079,6 +1139,7 @@ var createSearchIndexRouter = ({
|
|
|
1079
1139
|
const requestURL = new URL(req.url, config3.apiURL);
|
|
1080
1140
|
const docId = requestURL.pathname.split("/").filter(Boolean).slice(1).join("/");
|
|
1081
1141
|
const result = await searchIndex.DELETE(docId);
|
|
1142
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1082
1143
|
res.end(JSON.stringify({ result }));
|
|
1083
1144
|
};
|
|
1084
1145
|
return { del, get, put };
|
|
@@ -1696,25 +1757,6 @@ var import_chalk4 = __toESM(require("chalk"));
|
|
|
1696
1757
|
|
|
1697
1758
|
// src/utils/start-subprocess.ts
|
|
1698
1759
|
var import_child_process = __toESM(require("child_process"));
|
|
1699
|
-
|
|
1700
|
-
// src/utils/theme.ts
|
|
1701
|
-
var import_chalk3 = __toESM(require("chalk"));
|
|
1702
|
-
var successText = import_chalk3.default.bold.green;
|
|
1703
|
-
var focusText = import_chalk3.default.bold;
|
|
1704
|
-
var dangerText = import_chalk3.default.bold.red;
|
|
1705
|
-
var neutralText = import_chalk3.default.bold.cyan;
|
|
1706
|
-
var linkText = import_chalk3.default.bold.cyan;
|
|
1707
|
-
var labelText = import_chalk3.default.bold;
|
|
1708
|
-
var cmdText = import_chalk3.default.inverse;
|
|
1709
|
-
var indentedCmd = (str) => {
|
|
1710
|
-
return ` \u2503 ` + str;
|
|
1711
|
-
};
|
|
1712
|
-
var logText = import_chalk3.default.italic.gray;
|
|
1713
|
-
var warnText = import_chalk3.default.yellowBright.bgBlack;
|
|
1714
|
-
var titleText = import_chalk3.default.bgHex("d2f1f8").hex("ec4816");
|
|
1715
|
-
var CONFIRMATION_TEXT = import_chalk3.default.dim("enter to confirm");
|
|
1716
|
-
|
|
1717
|
-
// src/utils/start-subprocess.ts
|
|
1718
1760
|
var startSubprocess2 = async ({ command }) => {
|
|
1719
1761
|
if (typeof command === "string") {
|
|
1720
1762
|
const commands = command.split(" ");
|
|
@@ -1875,7 +1917,6 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
1875
1917
|
};
|
|
1876
1918
|
|
|
1877
1919
|
// src/next/commands/dev-command/index.ts
|
|
1878
|
-
var import_memory_level2 = require("memory-level");
|
|
1879
1920
|
var import_search = require("@tinacms/search");
|
|
1880
1921
|
var DevCommand = class extends BaseCommand {
|
|
1881
1922
|
constructor() {
|
|
@@ -1886,6 +1927,9 @@ var DevCommand = class extends BaseCommand {
|
|
|
1886
1927
|
this.noWatch = import_clipanion2.Option.Boolean("--noWatch", false, {
|
|
1887
1928
|
description: "Don't regenerate config on file changes"
|
|
1888
1929
|
});
|
|
1930
|
+
this.outputSearchIndexPath = import_clipanion2.Option.String("--outputSearchIndexPath", {
|
|
1931
|
+
description: "Path to write the search index to"
|
|
1932
|
+
});
|
|
1889
1933
|
}
|
|
1890
1934
|
async catch(error) {
|
|
1891
1935
|
logger.error("Error occured during tinacms dev");
|
|
@@ -1901,7 +1945,7 @@ var DevCommand = class extends BaseCommand {
|
|
|
1901
1945
|
}
|
|
1902
1946
|
}
|
|
1903
1947
|
async execute() {
|
|
1904
|
-
var _a, _b, _c, _d;
|
|
1948
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1905
1949
|
const configManager = new ConfigManager({
|
|
1906
1950
|
rootPath: this.rootPath,
|
|
1907
1951
|
legacyNoSDK: this.noSDK
|
|
@@ -1913,63 +1957,70 @@ var DevCommand = class extends BaseCommand {
|
|
|
1913
1957
|
const setup = async ({ firstTime }) => {
|
|
1914
1958
|
try {
|
|
1915
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 };
|
|
1916
2008
|
} catch (e) {
|
|
1917
|
-
logger.error(e.message);
|
|
2009
|
+
logger.error(dangerText(e.message));
|
|
1918
2010
|
if (this.verbose) {
|
|
1919
2011
|
console.error(e);
|
|
1920
2012
|
}
|
|
1921
2013
|
if (firstTime) {
|
|
1922
2014
|
logger.error(
|
|
1923
|
-
|
|
2015
|
+
warnText(
|
|
2016
|
+
"Unable to start dev server, please fix your Tina config and try again"
|
|
2017
|
+
)
|
|
1924
2018
|
);
|
|
1925
2019
|
process.exit(1);
|
|
2020
|
+
} else {
|
|
2021
|
+
logger.error(warnText("Dev server has not been restarted"));
|
|
1926
2022
|
}
|
|
1927
2023
|
}
|
|
1928
|
-
if (firstTime) {
|
|
1929
|
-
database = await createAndInitializeDatabase(
|
|
1930
|
-
configManager,
|
|
1931
|
-
Number(this.datalayerPort)
|
|
1932
|
-
);
|
|
1933
|
-
} else {
|
|
1934
|
-
database.clearCache();
|
|
1935
|
-
}
|
|
1936
|
-
const { tinaSchema: tinaSchema2, graphQLSchema: graphQLSchema2, lookup, queryDoc, fragDoc } = await (0, import_graphql8.buildSchema)(configManager.config);
|
|
1937
|
-
const codegen2 = new Codegen({
|
|
1938
|
-
isLocal: true,
|
|
1939
|
-
configManager,
|
|
1940
|
-
port: Number(this.port),
|
|
1941
|
-
queryDoc,
|
|
1942
|
-
fragDoc,
|
|
1943
|
-
graphqlSchemaDoc: graphQLSchema2,
|
|
1944
|
-
tinaSchema: tinaSchema2,
|
|
1945
|
-
lookup
|
|
1946
|
-
});
|
|
1947
|
-
const apiURL2 = await codegen2.execute();
|
|
1948
|
-
if (!configManager.isUsingLegacyFolder) {
|
|
1949
|
-
delete require.cache[configManager.generatedSchemaJSONPath];
|
|
1950
|
-
delete require.cache[configManager.generatedLookupJSONPath];
|
|
1951
|
-
delete require.cache[configManager.generatedGraphQLJSONPath];
|
|
1952
|
-
const schemaObject = require(configManager.generatedSchemaJSONPath);
|
|
1953
|
-
const lookupObject = require(configManager.generatedLookupJSONPath);
|
|
1954
|
-
const graphqlSchemaObject = require(configManager.generatedGraphQLJSONPath);
|
|
1955
|
-
await import_fs_extra4.default.writeFileSync(
|
|
1956
|
-
import_path7.default.join(configManager.tinaFolderPath, "tina-lock.json"),
|
|
1957
|
-
JSON.stringify({
|
|
1958
|
-
schema: schemaObject,
|
|
1959
|
-
lookup: lookupObject,
|
|
1960
|
-
graphql: graphqlSchemaObject
|
|
1961
|
-
})
|
|
1962
|
-
);
|
|
1963
|
-
}
|
|
1964
|
-
if (!this.noWatch) {
|
|
1965
|
-
this.watchQueries(configManager, async () => await codegen2.execute());
|
|
1966
|
-
}
|
|
1967
|
-
await this.indexContentWithSpinner({
|
|
1968
|
-
database,
|
|
1969
|
-
graphQLSchema: graphQLSchema2,
|
|
1970
|
-
tinaSchema: tinaSchema2
|
|
1971
|
-
});
|
|
1972
|
-
return { apiURL: apiURL2, database, graphQLSchema: graphQLSchema2, tinaSchema: tinaSchema2 };
|
|
1973
2024
|
};
|
|
1974
2025
|
const { apiURL, graphQLSchema, tinaSchema } = await setup({
|
|
1975
2026
|
firstTime: true
|
|
@@ -1979,39 +2030,28 @@ var DevCommand = class extends BaseCommand {
|
|
|
1979
2030
|
configManager.outputGitignorePath,
|
|
1980
2031
|
"index.html\nassets/"
|
|
1981
2032
|
);
|
|
1982
|
-
const
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
(_b = (_a = configManager.config.search) == null ? void 0 : _a.tina) == null ? void 0 : _b.stopwordLanguages
|
|
1986
|
-
)
|
|
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
|
|
1987
2036
|
});
|
|
1988
|
-
|
|
2037
|
+
await searchIndexClient.onStartIndexing();
|
|
1989
2038
|
const server = await createDevServer(
|
|
1990
2039
|
configManager,
|
|
1991
2040
|
database,
|
|
1992
|
-
searchIndex,
|
|
2041
|
+
searchIndexClient.searchIndex,
|
|
1993
2042
|
apiURL,
|
|
1994
2043
|
this.noWatch
|
|
1995
2044
|
);
|
|
1996
2045
|
await server.listen(Number(this.port));
|
|
1997
2046
|
const searchIndexer = new import_search.SearchIndexer({
|
|
1998
|
-
batchSize: ((
|
|
2047
|
+
batchSize: ((_e = configManager.config.search) == null ? void 0 : _e.indexBatchSize) || 100,
|
|
1999
2048
|
bridge: new import_graphql8.FilesystemBridge(
|
|
2000
2049
|
configManager.rootPath,
|
|
2001
2050
|
configManager.contentRootPath
|
|
2002
2051
|
),
|
|
2003
2052
|
schema: tinaSchema,
|
|
2004
2053
|
client: searchIndexClient,
|
|
2005
|
-
textIndexLength: ((
|
|
2006
|
-
});
|
|
2007
|
-
await spin({
|
|
2008
|
-
waitFor: async () => {
|
|
2009
|
-
const res = await database.indexContent({
|
|
2010
|
-
graphQLSchema,
|
|
2011
|
-
tinaSchema
|
|
2012
|
-
});
|
|
2013
|
-
},
|
|
2014
|
-
text: "Indexing local files"
|
|
2054
|
+
textIndexLength: ((_f = configManager.config.search) == null ? void 0 : _f.maxSearchIndexFieldLength) || 100
|
|
2015
2055
|
});
|
|
2016
2056
|
if (configManager.config.search) {
|
|
2017
2057
|
await spin({
|
|
@@ -2020,6 +2060,9 @@ var DevCommand = class extends BaseCommand {
|
|
|
2020
2060
|
},
|
|
2021
2061
|
text: "Building search index"
|
|
2022
2062
|
});
|
|
2063
|
+
if (this.outputSearchIndexPath) {
|
|
2064
|
+
await searchIndexClient.export(this.outputSearchIndexPath);
|
|
2065
|
+
}
|
|
2023
2066
|
}
|
|
2024
2067
|
if (!this.noWatch) {
|
|
2025
2068
|
this.watchContentFiles(
|
|
@@ -2027,24 +2070,12 @@ var DevCommand = class extends BaseCommand {
|
|
|
2027
2070
|
database,
|
|
2028
2071
|
configManager.config.search && searchIndexer
|
|
2029
2072
|
);
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
if (changedPath.includes("__generated__")) {
|
|
2033
|
-
return;
|
|
2034
|
-
}
|
|
2035
|
-
if (changedPath.includes("@tinacms/app")) {
|
|
2036
|
-
return;
|
|
2037
|
-
}
|
|
2038
|
-
if (changedPath.includes("tinacms/dist")) {
|
|
2039
|
-
return;
|
|
2040
|
-
}
|
|
2041
|
-
try {
|
|
2042
|
-
logger.info("Tina config updated");
|
|
2073
|
+
import_chokidar.default.watch(configManager.watchList).on("change", async () => {
|
|
2074
|
+
logger.info(`Tina config change detected, rebuilding`);
|
|
2043
2075
|
await setup({ firstTime: false });
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
});
|
|
2076
|
+
server.ws.send({ type: "full-reload", path: "*" });
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2048
2079
|
const subItems = [];
|
|
2049
2080
|
if (configManager.hasSeparateContentRoot()) {
|
|
2050
2081
|
subItems.push({
|
|
@@ -2270,11 +2301,11 @@ var waitForDB = async (config3, apiUrl, verbose) => {
|
|
|
2270
2301
|
await sleepAndCallFunc({ fn: pollForStatus, ms: POLLING_INTERVAL });
|
|
2271
2302
|
} else if (status === STATUS_FAILED) {
|
|
2272
2303
|
throw new IndexFailedError(
|
|
2273
|
-
`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}`
|
|
2274
2305
|
);
|
|
2275
2306
|
} else {
|
|
2276
2307
|
throw new IndexFailedError(
|
|
2277
|
-
`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}`
|
|
2278
2309
|
);
|
|
2279
2310
|
}
|
|
2280
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",
|