@tinacms/cli 1.5.19 → 1.5.21
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.
|
@@ -77,7 +77,7 @@ declare const forestryFieldWithoutField: z.ZodObject<{
|
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
79
|
name?: string;
|
|
80
|
-
type?: "number" | "boolean" | "file" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks"
|
|
80
|
+
type?: "number" | "boolean" | "file" | "color" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks";
|
|
81
81
|
label?: string;
|
|
82
82
|
template_types?: string[];
|
|
83
83
|
template?: string;
|
|
@@ -97,7 +97,7 @@ declare const forestryFieldWithoutField: z.ZodObject<{
|
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
name?: string;
|
|
100
|
-
type?: "number" | "boolean" | "file" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks"
|
|
100
|
+
type?: "number" | "boolean" | "file" | "color" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks";
|
|
101
101
|
label?: string;
|
|
102
102
|
template_types?: string[];
|
|
103
103
|
template?: string;
|
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.21";
|
|
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
|
+
packages: "external",
|
|
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",
|
|
@@ -767,10 +817,7 @@ var tinaTailwind = (spaPath, configFilePath) => {
|
|
|
767
817
|
}
|
|
768
818
|
},
|
|
769
819
|
content: content2,
|
|
770
|
-
plugins: [
|
|
771
|
-
(0, import_typography.default)({ className: "tina-prose" }),
|
|
772
|
-
import_aspect_ratio.default
|
|
773
|
-
]
|
|
820
|
+
plugins: [(0, import_typography.default)({ className: "tina-prose" }), import_aspect_ratio.default]
|
|
774
821
|
});
|
|
775
822
|
plugins.push(import_nesting.default);
|
|
776
823
|
plugins.push(import_postcss_nested.default);
|
|
@@ -815,7 +862,7 @@ var createConfig = async ({
|
|
|
815
862
|
}
|
|
816
863
|
});
|
|
817
864
|
const alias = {
|
|
818
|
-
TINA_IMPORT: configManager.
|
|
865
|
+
TINA_IMPORT: configManager.prebuildFilePath,
|
|
819
866
|
SCHEMA_IMPORT: configManager.generatedGraphQLJSONPath
|
|
820
867
|
};
|
|
821
868
|
if (configManager.shouldSkipSDK()) {
|
|
@@ -857,7 +904,11 @@ var createConfig = async ({
|
|
|
857
904
|
host: (_c = (_b = (_a = configManager.config) == null ? void 0 : _a.build) == null ? void 0 : _b.host) != null ? _c : false,
|
|
858
905
|
watch: noWatch ? {
|
|
859
906
|
ignored: ["**/*"]
|
|
860
|
-
} :
|
|
907
|
+
} : {
|
|
908
|
+
ignored: [
|
|
909
|
+
`${configManager.tinaFolderPath}/**/!(config.prebuild.jsx|_graphql.json)`
|
|
910
|
+
]
|
|
911
|
+
},
|
|
861
912
|
fs: {
|
|
862
913
|
strict: false
|
|
863
914
|
}
|
|
@@ -869,9 +920,13 @@ var createConfig = async ({
|
|
|
869
920
|
rollupOptions
|
|
870
921
|
},
|
|
871
922
|
plugins: [
|
|
872
|
-
(0, import_plugin_react.default)(
|
|
923
|
+
(0, import_plugin_react.default)({
|
|
924
|
+
babel: {
|
|
925
|
+
compact: true
|
|
926
|
+
}
|
|
927
|
+
}),
|
|
873
928
|
(0, import_vite.splitVendorChunkPlugin)(),
|
|
874
|
-
tinaTailwind(configManager.spaRootPath, configManager.
|
|
929
|
+
tinaTailwind(configManager.spaRootPath, configManager.prebuildFilePath),
|
|
875
930
|
...plugins
|
|
876
931
|
]
|
|
877
932
|
};
|
|
@@ -1053,6 +1108,7 @@ var createSearchIndexRouter = ({
|
|
|
1053
1108
|
const put = async (req, res) => {
|
|
1054
1109
|
const { docs } = req.body;
|
|
1055
1110
|
const result = await searchIndex.PUT(docs);
|
|
1111
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1056
1112
|
res.end(JSON.stringify({ result }));
|
|
1057
1113
|
};
|
|
1058
1114
|
const get = async (req, res) => {
|
|
@@ -1068,6 +1124,7 @@ var createSearchIndexRouter = ({
|
|
|
1068
1124
|
...JSON.parse(optionsParam)
|
|
1069
1125
|
};
|
|
1070
1126
|
}
|
|
1127
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1071
1128
|
if (query) {
|
|
1072
1129
|
const result = await searchIndex.QUERY(JSON.parse(query), options);
|
|
1073
1130
|
res.end(JSON.stringify(result));
|
|
@@ -1079,6 +1136,7 @@ var createSearchIndexRouter = ({
|
|
|
1079
1136
|
const requestURL = new URL(req.url, config3.apiURL);
|
|
1080
1137
|
const docId = requestURL.pathname.split("/").filter(Boolean).slice(1).join("/");
|
|
1081
1138
|
const result = await searchIndex.DELETE(docId);
|
|
1139
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1082
1140
|
res.end(JSON.stringify({ result }));
|
|
1083
1141
|
};
|
|
1084
1142
|
return { del, get, put };
|
|
@@ -1696,25 +1754,6 @@ var import_chalk4 = __toESM(require("chalk"));
|
|
|
1696
1754
|
|
|
1697
1755
|
// src/utils/start-subprocess.ts
|
|
1698
1756
|
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
1757
|
var startSubprocess2 = async ({ command }) => {
|
|
1719
1758
|
if (typeof command === "string") {
|
|
1720
1759
|
const commands = command.split(" ");
|
|
@@ -1875,7 +1914,6 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
1875
1914
|
};
|
|
1876
1915
|
|
|
1877
1916
|
// src/next/commands/dev-command/index.ts
|
|
1878
|
-
var import_memory_level2 = require("memory-level");
|
|
1879
1917
|
var import_search = require("@tinacms/search");
|
|
1880
1918
|
var DevCommand = class extends BaseCommand {
|
|
1881
1919
|
constructor() {
|
|
@@ -1886,6 +1924,9 @@ var DevCommand = class extends BaseCommand {
|
|
|
1886
1924
|
this.noWatch = import_clipanion2.Option.Boolean("--noWatch", false, {
|
|
1887
1925
|
description: "Don't regenerate config on file changes"
|
|
1888
1926
|
});
|
|
1927
|
+
this.outputSearchIndexPath = import_clipanion2.Option.String("--outputSearchIndexPath", {
|
|
1928
|
+
description: "Path to write the search index to"
|
|
1929
|
+
});
|
|
1889
1930
|
}
|
|
1890
1931
|
async catch(error) {
|
|
1891
1932
|
logger.error("Error occured during tinacms dev");
|
|
@@ -1901,7 +1942,7 @@ var DevCommand = class extends BaseCommand {
|
|
|
1901
1942
|
}
|
|
1902
1943
|
}
|
|
1903
1944
|
async execute() {
|
|
1904
|
-
var _a, _b, _c, _d;
|
|
1945
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1905
1946
|
const configManager = new ConfigManager({
|
|
1906
1947
|
rootPath: this.rootPath,
|
|
1907
1948
|
legacyNoSDK: this.noSDK
|
|
@@ -1913,63 +1954,70 @@ var DevCommand = class extends BaseCommand {
|
|
|
1913
1954
|
const setup = async ({ firstTime }) => {
|
|
1914
1955
|
try {
|
|
1915
1956
|
await configManager.processConfig();
|
|
1957
|
+
if (firstTime) {
|
|
1958
|
+
database = await createAndInitializeDatabase(
|
|
1959
|
+
configManager,
|
|
1960
|
+
Number(this.datalayerPort)
|
|
1961
|
+
);
|
|
1962
|
+
} else {
|
|
1963
|
+
database.clearCache();
|
|
1964
|
+
}
|
|
1965
|
+
const { tinaSchema: tinaSchema2, graphQLSchema: graphQLSchema2, lookup, queryDoc, fragDoc } = await (0, import_graphql8.buildSchema)(configManager.config);
|
|
1966
|
+
const codegen2 = new Codegen({
|
|
1967
|
+
isLocal: true,
|
|
1968
|
+
configManager,
|
|
1969
|
+
port: Number(this.port),
|
|
1970
|
+
queryDoc,
|
|
1971
|
+
fragDoc,
|
|
1972
|
+
graphqlSchemaDoc: graphQLSchema2,
|
|
1973
|
+
tinaSchema: tinaSchema2,
|
|
1974
|
+
lookup
|
|
1975
|
+
});
|
|
1976
|
+
const apiURL2 = await codegen2.execute();
|
|
1977
|
+
if (!configManager.isUsingLegacyFolder) {
|
|
1978
|
+
delete require.cache[configManager.generatedSchemaJSONPath];
|
|
1979
|
+
delete require.cache[configManager.generatedLookupJSONPath];
|
|
1980
|
+
delete require.cache[configManager.generatedGraphQLJSONPath];
|
|
1981
|
+
const schemaObject = require(configManager.generatedSchemaJSONPath);
|
|
1982
|
+
const lookupObject = require(configManager.generatedLookupJSONPath);
|
|
1983
|
+
const graphqlSchemaObject = require(configManager.generatedGraphQLJSONPath);
|
|
1984
|
+
await import_fs_extra4.default.writeFileSync(
|
|
1985
|
+
import_path7.default.join(configManager.tinaFolderPath, "tina-lock.json"),
|
|
1986
|
+
JSON.stringify({
|
|
1987
|
+
schema: schemaObject,
|
|
1988
|
+
lookup: lookupObject,
|
|
1989
|
+
graphql: graphqlSchemaObject
|
|
1990
|
+
})
|
|
1991
|
+
);
|
|
1992
|
+
}
|
|
1993
|
+
if (!this.noWatch) {
|
|
1994
|
+
this.watchQueries(configManager, async () => await codegen2.execute());
|
|
1995
|
+
}
|
|
1996
|
+
await this.indexContentWithSpinner({
|
|
1997
|
+
database,
|
|
1998
|
+
graphQLSchema: graphQLSchema2,
|
|
1999
|
+
tinaSchema: tinaSchema2
|
|
2000
|
+
});
|
|
2001
|
+
if (!firstTime) {
|
|
2002
|
+
logger.error("Re-index complete");
|
|
2003
|
+
}
|
|
2004
|
+
return { apiURL: apiURL2, database, graphQLSchema: graphQLSchema2, tinaSchema: tinaSchema2 };
|
|
1916
2005
|
} catch (e) {
|
|
1917
|
-
logger.error(e.message);
|
|
2006
|
+
logger.error(dangerText(e.message));
|
|
1918
2007
|
if (this.verbose) {
|
|
1919
2008
|
console.error(e);
|
|
1920
2009
|
}
|
|
1921
2010
|
if (firstTime) {
|
|
1922
2011
|
logger.error(
|
|
1923
|
-
|
|
2012
|
+
warnText(
|
|
2013
|
+
"Unable to start dev server, please fix your Tina config and try again"
|
|
2014
|
+
)
|
|
1924
2015
|
);
|
|
1925
2016
|
process.exit(1);
|
|
2017
|
+
} else {
|
|
2018
|
+
logger.error(warnText("Dev server has not been restarted"));
|
|
1926
2019
|
}
|
|
1927
2020
|
}
|
|
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
2021
|
};
|
|
1974
2022
|
const { apiURL, graphQLSchema, tinaSchema } = await setup({
|
|
1975
2023
|
firstTime: true
|
|
@@ -1979,39 +2027,28 @@ var DevCommand = class extends BaseCommand {
|
|
|
1979
2027
|
configManager.outputGitignorePath,
|
|
1980
2028
|
"index.html\nassets/"
|
|
1981
2029
|
);
|
|
1982
|
-
const
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
(_b = (_a = configManager.config.search) == null ? void 0 : _a.tina) == null ? void 0 : _b.stopwordLanguages
|
|
1986
|
-
)
|
|
2030
|
+
const searchIndexClient = new import_search.LocalSearchIndexClient({
|
|
2031
|
+
stopwordLanguages: (_b = (_a = configManager.config.search) == null ? void 0 : _a.tina) == null ? void 0 : _b.stopwordLanguages,
|
|
2032
|
+
tokenSplitRegex: (_d = (_c = configManager.config.search) == null ? void 0 : _c.tina) == null ? void 0 : _d.tokenSplitRegex
|
|
1987
2033
|
});
|
|
1988
|
-
|
|
2034
|
+
await searchIndexClient.onStartIndexing();
|
|
1989
2035
|
const server = await createDevServer(
|
|
1990
2036
|
configManager,
|
|
1991
2037
|
database,
|
|
1992
|
-
searchIndex,
|
|
2038
|
+
searchIndexClient.searchIndex,
|
|
1993
2039
|
apiURL,
|
|
1994
2040
|
this.noWatch
|
|
1995
2041
|
);
|
|
1996
2042
|
await server.listen(Number(this.port));
|
|
1997
2043
|
const searchIndexer = new import_search.SearchIndexer({
|
|
1998
|
-
batchSize: ((
|
|
2044
|
+
batchSize: ((_e = configManager.config.search) == null ? void 0 : _e.indexBatchSize) || 100,
|
|
1999
2045
|
bridge: new import_graphql8.FilesystemBridge(
|
|
2000
2046
|
configManager.rootPath,
|
|
2001
2047
|
configManager.contentRootPath
|
|
2002
2048
|
),
|
|
2003
2049
|
schema: tinaSchema,
|
|
2004
2050
|
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"
|
|
2051
|
+
textIndexLength: ((_f = configManager.config.search) == null ? void 0 : _f.maxSearchIndexFieldLength) || 100
|
|
2015
2052
|
});
|
|
2016
2053
|
if (configManager.config.search) {
|
|
2017
2054
|
await spin({
|
|
@@ -2020,6 +2057,9 @@ var DevCommand = class extends BaseCommand {
|
|
|
2020
2057
|
},
|
|
2021
2058
|
text: "Building search index"
|
|
2022
2059
|
});
|
|
2060
|
+
if (this.outputSearchIndexPath) {
|
|
2061
|
+
await searchIndexClient.export(this.outputSearchIndexPath);
|
|
2062
|
+
}
|
|
2023
2063
|
}
|
|
2024
2064
|
if (!this.noWatch) {
|
|
2025
2065
|
this.watchContentFiles(
|
|
@@ -2027,24 +2067,12 @@ var DevCommand = class extends BaseCommand {
|
|
|
2027
2067
|
database,
|
|
2028
2068
|
configManager.config.search && searchIndexer
|
|
2029
2069
|
);
|
|
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");
|
|
2070
|
+
import_chokidar.default.watch(configManager.watchList).on("change", async () => {
|
|
2071
|
+
logger.info(`Tina config change detected, rebuilding`);
|
|
2043
2072
|
await setup({ firstTime: false });
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
});
|
|
2073
|
+
server.ws.send({ type: "full-reload", path: "*" });
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2048
2076
|
const subItems = [];
|
|
2049
2077
|
if (configManager.hasSeparateContentRoot()) {
|
|
2050
2078
|
subItems.push({
|
|
@@ -2270,11 +2298,11 @@ var waitForDB = async (config3, apiUrl, verbose) => {
|
|
|
2270
2298
|
await sleepAndCallFunc({ fn: pollForStatus, ms: POLLING_INTERVAL });
|
|
2271
2299
|
} else if (status === STATUS_FAILED) {
|
|
2272
2300
|
throw new IndexFailedError(
|
|
2273
|
-
`Attempting to index but responded with status 'failed'
|
|
2301
|
+
`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
2302
|
);
|
|
2275
2303
|
} else {
|
|
2276
2304
|
throw new IndexFailedError(
|
|
2277
|
-
`Attempting to index but responded with status 'unknown'
|
|
2305
|
+
`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
2306
|
);
|
|
2279
2307
|
}
|
|
2280
2308
|
} 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.21",
|
|
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.19",
|
|
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",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"clipanion": "^3.2.0",
|
|
78
78
|
"cors": "^2.8.5",
|
|
79
79
|
"dotenv": "^16.0.1",
|
|
80
|
-
"esbuild": "^0.
|
|
80
|
+
"esbuild": "^0.18.10",
|
|
81
81
|
"express": "^4.17.1",
|
|
82
82
|
"fast-glob": "^3.2.4",
|
|
83
83
|
"fs-extra": "^9.0.1",
|