@tinacms/cli 1.5.21 → 1.5.23
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" | "color" | "text" | "include" | "
|
|
80
|
+
type?: "number" | "boolean" | "file" | "color" | "text" | "include" | "datetime" | "list" | "select" | "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" | "color" | "text" | "include" | "
|
|
100
|
+
type?: "number" | "boolean" | "file" | "color" | "text" | "include" | "datetime" | "list" | "select" | "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,14 +31,14 @@ 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.23";
|
|
35
35
|
|
|
36
36
|
// src/next/commands/dev-command/index.ts
|
|
37
37
|
var import_clipanion2 = require("clipanion");
|
|
38
|
-
var
|
|
38
|
+
var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
39
39
|
var import_path7 = __toESM(require("path"));
|
|
40
40
|
var import_chokidar = __toESM(require("chokidar"));
|
|
41
|
-
var
|
|
41
|
+
var import_graphql9 = require("@tinacms/graphql");
|
|
42
42
|
|
|
43
43
|
// src/next/config-manager.ts
|
|
44
44
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
@@ -1819,6 +1819,8 @@ function spin({
|
|
|
1819
1819
|
}
|
|
1820
1820
|
|
|
1821
1821
|
// src/next/commands/baseCommands.ts
|
|
1822
|
+
var import_graphql8 = require("@tinacms/graphql");
|
|
1823
|
+
var import_fs_extra4 = __toESM(require("fs-extra"));
|
|
1822
1824
|
var BaseCommand = class extends import_clipanion.Command {
|
|
1823
1825
|
constructor() {
|
|
1824
1826
|
super(...arguments);
|
|
@@ -1890,17 +1892,76 @@ var BaseCommand = class extends import_clipanion.Command {
|
|
|
1890
1892
|
database,
|
|
1891
1893
|
graphQLSchema,
|
|
1892
1894
|
tinaSchema,
|
|
1895
|
+
configManager,
|
|
1896
|
+
partialReindex,
|
|
1893
1897
|
text
|
|
1894
1898
|
}) {
|
|
1895
1899
|
const textToUse = text || "Indexing local files";
|
|
1896
1900
|
const warnings = [];
|
|
1897
1901
|
await spin({
|
|
1898
1902
|
waitFor: async () => {
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1903
|
+
var _a, _b;
|
|
1904
|
+
const rootPath = configManager.rootPath;
|
|
1905
|
+
let sha;
|
|
1906
|
+
try {
|
|
1907
|
+
sha = await (0, import_graphql8.getSha)({ fs: import_fs_extra4.default, dir: rootPath });
|
|
1908
|
+
} catch (e) {
|
|
1909
|
+
if (partialReindex) {
|
|
1910
|
+
console.error(
|
|
1911
|
+
"Failed to get sha. NOTE: `--partial-reindex` only supported for git repositories"
|
|
1912
|
+
);
|
|
1913
|
+
throw e;
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
const lastSha = await database.getMetadata("lastSha");
|
|
1917
|
+
let res;
|
|
1918
|
+
if (partialReindex && lastSha && sha) {
|
|
1919
|
+
const pathFilter = {};
|
|
1920
|
+
if (configManager.isUsingLegacyFolder) {
|
|
1921
|
+
pathFilter[".tina/__generated__/_schema.json"] = {};
|
|
1922
|
+
} else {
|
|
1923
|
+
pathFilter["tina/tina-lock.json"] = {};
|
|
1924
|
+
}
|
|
1925
|
+
for (const collection of tinaSchema.getCollections()) {
|
|
1926
|
+
pathFilter[collection.path] = {
|
|
1927
|
+
matches: ((_a = collection.match) == null ? void 0 : _a.exclude) || ((_b = collection.match) == null ? void 0 : _b.include) ? tinaSchema.getMatches({ collection }) : void 0
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
const { added, modified, deleted } = await (0, import_graphql8.getChangedFiles)({
|
|
1931
|
+
fs: import_fs_extra4.default,
|
|
1932
|
+
dir: rootPath,
|
|
1933
|
+
from: lastSha,
|
|
1934
|
+
to: sha,
|
|
1935
|
+
pathFilter
|
|
1936
|
+
});
|
|
1937
|
+
const tinaPathUpdates = modified.filter(
|
|
1938
|
+
(path12) => path12.startsWith(".tina/__generated__/_schema.json") || path12.startsWith("tina/tina-lock.json")
|
|
1939
|
+
);
|
|
1940
|
+
if (tinaPathUpdates.length > 0) {
|
|
1941
|
+
res = await database.indexContent({
|
|
1942
|
+
graphQLSchema,
|
|
1943
|
+
tinaSchema
|
|
1944
|
+
});
|
|
1945
|
+
} else {
|
|
1946
|
+
if (added.length > 0 || modified.length > 0) {
|
|
1947
|
+
await database.indexContentByPaths([...added, ...modified]);
|
|
1948
|
+
}
|
|
1949
|
+
if (deleted.length > 0) {
|
|
1950
|
+
await database.deleteContentByPaths(deleted);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
} else {
|
|
1954
|
+
res = await database.indexContent({
|
|
1955
|
+
graphQLSchema,
|
|
1956
|
+
tinaSchema
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
if (sha) {
|
|
1960
|
+
await database.setMetadata("lastSha", sha);
|
|
1961
|
+
}
|
|
1962
|
+
if (res == null ? void 0 : res.warnings) {
|
|
1963
|
+
warnings.push(...res.warnings);
|
|
1964
|
+
}
|
|
1904
1965
|
},
|
|
1905
1966
|
text: textToUse
|
|
1906
1967
|
});
|
|
@@ -1962,7 +2023,7 @@ var DevCommand = class extends BaseCommand {
|
|
|
1962
2023
|
} else {
|
|
1963
2024
|
database.clearCache();
|
|
1964
2025
|
}
|
|
1965
|
-
const { tinaSchema: tinaSchema2, graphQLSchema: graphQLSchema2, lookup, queryDoc, fragDoc } = await (0,
|
|
2026
|
+
const { tinaSchema: tinaSchema2, graphQLSchema: graphQLSchema2, lookup, queryDoc, fragDoc } = await (0, import_graphql9.buildSchema)(configManager.config);
|
|
1966
2027
|
const codegen2 = new Codegen({
|
|
1967
2028
|
isLocal: true,
|
|
1968
2029
|
configManager,
|
|
@@ -1981,7 +2042,7 @@ var DevCommand = class extends BaseCommand {
|
|
|
1981
2042
|
const schemaObject = require(configManager.generatedSchemaJSONPath);
|
|
1982
2043
|
const lookupObject = require(configManager.generatedLookupJSONPath);
|
|
1983
2044
|
const graphqlSchemaObject = require(configManager.generatedGraphQLJSONPath);
|
|
1984
|
-
await
|
|
2045
|
+
await import_fs_extra5.default.writeFileSync(
|
|
1985
2046
|
import_path7.default.join(configManager.tinaFolderPath, "tina-lock.json"),
|
|
1986
2047
|
JSON.stringify({
|
|
1987
2048
|
schema: schemaObject,
|
|
@@ -1996,7 +2057,8 @@ var DevCommand = class extends BaseCommand {
|
|
|
1996
2057
|
await this.indexContentWithSpinner({
|
|
1997
2058
|
database,
|
|
1998
2059
|
graphQLSchema: graphQLSchema2,
|
|
1999
|
-
tinaSchema: tinaSchema2
|
|
2060
|
+
tinaSchema: tinaSchema2,
|
|
2061
|
+
configManager
|
|
2000
2062
|
});
|
|
2001
2063
|
if (!firstTime) {
|
|
2002
2064
|
logger.error("Re-index complete");
|
|
@@ -2022,8 +2084,8 @@ var DevCommand = class extends BaseCommand {
|
|
|
2022
2084
|
const { apiURL, graphQLSchema, tinaSchema } = await setup({
|
|
2023
2085
|
firstTime: true
|
|
2024
2086
|
});
|
|
2025
|
-
await
|
|
2026
|
-
await
|
|
2087
|
+
await import_fs_extra5.default.outputFile(configManager.outputHTMLFilePath, devHTML(this.port));
|
|
2088
|
+
await import_fs_extra5.default.outputFile(
|
|
2027
2089
|
configManager.outputGitignorePath,
|
|
2028
2090
|
"index.html\nassets/"
|
|
2029
2091
|
);
|
|
@@ -2042,7 +2104,7 @@ var DevCommand = class extends BaseCommand {
|
|
|
2042
2104
|
await server.listen(Number(this.port));
|
|
2043
2105
|
const searchIndexer = new import_search.SearchIndexer({
|
|
2044
2106
|
batchSize: ((_e = configManager.config.search) == null ? void 0 : _e.indexBatchSize) || 100,
|
|
2045
|
-
bridge: new
|
|
2107
|
+
bridge: new import_graphql9.FilesystemBridge(
|
|
2046
2108
|
configManager.rootPath,
|
|
2047
2109
|
configManager.contentRootPath
|
|
2048
2110
|
),
|
|
@@ -2187,8 +2249,8 @@ DevCommand.usage = import_clipanion2.Command.Usage({
|
|
|
2187
2249
|
var import_node_fetch2 = __toESM(require("node-fetch"));
|
|
2188
2250
|
var import_clipanion3 = require("clipanion");
|
|
2189
2251
|
var import_progress2 = __toESM(require("progress"));
|
|
2190
|
-
var
|
|
2191
|
-
var
|
|
2252
|
+
var import_fs_extra6 = __toESM(require("fs-extra"));
|
|
2253
|
+
var import_graphql10 = require("@tinacms/graphql");
|
|
2192
2254
|
|
|
2193
2255
|
// src/next/commands/build-command/server.ts
|
|
2194
2256
|
var import_vite5 = require("vite");
|
|
@@ -2222,7 +2284,7 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
2222
2284
|
|
|
2223
2285
|
// src/next/commands/build-command/index.ts
|
|
2224
2286
|
var import_schema_tools2 = require("@tinacms/schema-tools");
|
|
2225
|
-
var
|
|
2287
|
+
var import_graphql11 = require("graphql");
|
|
2226
2288
|
var import_core2 = require("@graphql-inspector/core");
|
|
2227
2289
|
|
|
2228
2290
|
// src/next/commands/build-command/waitForDB.ts
|
|
@@ -2335,6 +2397,9 @@ var BuildCommand = class extends BaseCommand {
|
|
|
2335
2397
|
this.skipIndexing = import_clipanion3.Option.Boolean("--skip-indexing", false, {
|
|
2336
2398
|
description: "Skips indexing the content. This can be used for building the site without indexing the content (defaults to false)"
|
|
2337
2399
|
});
|
|
2400
|
+
this.partialReindex = import_clipanion3.Option.Boolean("--partial-reindex", false, {
|
|
2401
|
+
description: "Re-indexes only the content that has changed since the last build (defaults to false). Not currently supported for separate content repos."
|
|
2402
|
+
});
|
|
2338
2403
|
this.tinaGraphQLVersion = import_clipanion3.Option.String("--tina-graphql-version", {
|
|
2339
2404
|
description: "Specify the version of @tinacms/graphql to use (defaults to latest)"
|
|
2340
2405
|
});
|
|
@@ -2371,7 +2436,7 @@ var BuildCommand = class extends BaseCommand {
|
|
|
2371
2436
|
configManager,
|
|
2372
2437
|
Number(this.datalayerPort)
|
|
2373
2438
|
);
|
|
2374
|
-
const { queryDoc, fragDoc, graphQLSchema, tinaSchema, lookup } = await (0,
|
|
2439
|
+
const { queryDoc, fragDoc, graphQLSchema, tinaSchema, lookup } = await (0, import_graphql10.buildSchema)(configManager.config);
|
|
2375
2440
|
const codegen2 = new Codegen({
|
|
2376
2441
|
configManager,
|
|
2377
2442
|
port: this.localOption ? Number(this.port) : void 0,
|
|
@@ -2389,7 +2454,9 @@ var BuildCommand = class extends BaseCommand {
|
|
|
2389
2454
|
text,
|
|
2390
2455
|
database,
|
|
2391
2456
|
graphQLSchema,
|
|
2392
|
-
tinaSchema
|
|
2457
|
+
tinaSchema,
|
|
2458
|
+
configManager,
|
|
2459
|
+
partialReindex: this.partialReindex
|
|
2393
2460
|
});
|
|
2394
2461
|
}
|
|
2395
2462
|
if (this.localOption) {
|
|
@@ -2414,7 +2481,7 @@ var BuildCommand = class extends BaseCommand {
|
|
|
2414
2481
|
);
|
|
2415
2482
|
}
|
|
2416
2483
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
2417
|
-
await
|
|
2484
|
+
await import_fs_extra6.default.outputFile(
|
|
2418
2485
|
configManager.outputGitignorePath,
|
|
2419
2486
|
"index.html\nassets/"
|
|
2420
2487
|
);
|
|
@@ -2455,7 +2522,7 @@ var BuildCommand = class extends BaseCommand {
|
|
|
2455
2522
|
}
|
|
2456
2523
|
const searchIndexer = new import_search2.SearchIndexer({
|
|
2457
2524
|
batchSize: ((_s = configManager.config.search) == null ? void 0 : _s.indexBatchSize) || 100,
|
|
2458
|
-
bridge: new
|
|
2525
|
+
bridge: new import_graphql10.FilesystemBridge(
|
|
2459
2526
|
configManager.rootPath,
|
|
2460
2527
|
configManager.contentRootPath
|
|
2461
2528
|
),
|
|
@@ -2621,9 +2688,9 @@ Additional info: Branch: ${config3.branch}, Client ID: ${config3.clientId} `;
|
|
|
2621
2688
|
}
|
|
2622
2689
|
throw new Error(errorMessage);
|
|
2623
2690
|
}
|
|
2624
|
-
const remoteGqlSchema = (0,
|
|
2691
|
+
const remoteGqlSchema = (0, import_graphql11.buildClientSchema)(remoteSchema);
|
|
2625
2692
|
const localSchemaDocument = await database.getGraphQLSchemaFromBridge();
|
|
2626
|
-
const localGraphqlSchema = (0,
|
|
2693
|
+
const localGraphqlSchema = (0, import_graphql11.buildASTSchema)(localSchemaDocument);
|
|
2627
2694
|
try {
|
|
2628
2695
|
const diffResult = await (0, import_core2.diff)(localGraphqlSchema, remoteGqlSchema);
|
|
2629
2696
|
if (diffResult.length === 0) {
|
|
@@ -2708,7 +2775,7 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
2708
2775
|
if (token) {
|
|
2709
2776
|
headers.append("X-API-KEY", token);
|
|
2710
2777
|
}
|
|
2711
|
-
const body = JSON.stringify({ query: (0,
|
|
2778
|
+
const body = JSON.stringify({ query: (0, import_graphql11.getIntrospectionQuery)(), variables: {} });
|
|
2712
2779
|
headers.append("Content-Type", "application/json");
|
|
2713
2780
|
const res = await (0, import_node_fetch2.default)(url, {
|
|
2714
2781
|
method: "POST",
|
|
@@ -2721,12 +2788,12 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
2721
2788
|
|
|
2722
2789
|
// src/next/commands/audit-command/index.ts
|
|
2723
2790
|
var import_clipanion4 = require("clipanion");
|
|
2724
|
-
var
|
|
2791
|
+
var import_graphql13 = require("@tinacms/graphql");
|
|
2725
2792
|
|
|
2726
2793
|
// src/next/commands/audit-command/audit.ts
|
|
2727
2794
|
var import_prompts = __toESM(require("prompts"));
|
|
2728
2795
|
var import_metrics = require("@tinacms/metrics");
|
|
2729
|
-
var
|
|
2796
|
+
var import_graphql12 = require("@tinacms/graphql");
|
|
2730
2797
|
var import_chalk5 = __toESM(require("chalk"));
|
|
2731
2798
|
var audit = async ({
|
|
2732
2799
|
database,
|
|
@@ -2811,7 +2878,7 @@ var auditDocuments = async (args) => {
|
|
|
2811
2878
|
}
|
|
2812
2879
|
}
|
|
2813
2880
|
}`;
|
|
2814
|
-
const docResult = await (0,
|
|
2881
|
+
const docResult = await (0, import_graphql12.resolve)({
|
|
2815
2882
|
database,
|
|
2816
2883
|
query: documentQuery,
|
|
2817
2884
|
variables: {},
|
|
@@ -2852,7 +2919,7 @@ var auditDocuments = async (args) => {
|
|
|
2852
2919
|
params: $params
|
|
2853
2920
|
){__typename}
|
|
2854
2921
|
}`;
|
|
2855
|
-
const mutationRes = await (0,
|
|
2922
|
+
const mutationRes = await (0, import_graphql12.resolve)({
|
|
2856
2923
|
database,
|
|
2857
2924
|
query: mutation,
|
|
2858
2925
|
variables: {
|
|
@@ -2884,7 +2951,7 @@ function filterObject(obj) {
|
|
|
2884
2951
|
}
|
|
2885
2952
|
|
|
2886
2953
|
// src/next/commands/audit-command/index.ts
|
|
2887
|
-
var
|
|
2954
|
+
var import_graphql14 = require("@tinacms/graphql");
|
|
2888
2955
|
var AuditCommand = class extends import_clipanion4.Command {
|
|
2889
2956
|
constructor() {
|
|
2890
2957
|
super(...arguments);
|
|
@@ -2927,9 +2994,9 @@ var AuditCommand = class extends import_clipanion4.Command {
|
|
|
2927
2994
|
const database = await createAndInitializeDatabase(
|
|
2928
2995
|
configManager,
|
|
2929
2996
|
Number(this.datalayerPort),
|
|
2930
|
-
this.clean ? void 0 : new
|
|
2997
|
+
this.clean ? void 0 : new import_graphql14.AuditFileSystemBridge(configManager.rootPath)
|
|
2931
2998
|
);
|
|
2932
|
-
const { tinaSchema, graphQLSchema, lookup } = await (0,
|
|
2999
|
+
const { tinaSchema, graphQLSchema, lookup } = await (0, import_graphql13.buildSchema)(
|
|
2933
3000
|
configManager.config
|
|
2934
3001
|
);
|
|
2935
3002
|
const warnings = [];
|
|
@@ -2972,7 +3039,7 @@ var import_clipanion6 = require("clipanion");
|
|
|
2972
3039
|
// src/cmds/init/index.ts
|
|
2973
3040
|
var import_path11 = __toESM(require("path"));
|
|
2974
3041
|
var import_prettier2 = require("prettier");
|
|
2975
|
-
var
|
|
3042
|
+
var import_fs_extra10 = __toESM(require("fs-extra"));
|
|
2976
3043
|
var import_prompts2 = __toESM(require("prompts"));
|
|
2977
3044
|
var import_metrics2 = require("@tinacms/metrics");
|
|
2978
3045
|
|
|
@@ -3324,14 +3391,14 @@ var configExamples = {
|
|
|
3324
3391
|
};
|
|
3325
3392
|
|
|
3326
3393
|
// src/cmds/forestry-migrate/index.ts
|
|
3327
|
-
var
|
|
3394
|
+
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
3328
3395
|
var import_path9 = __toESM(require("path"));
|
|
3329
3396
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
|
3330
3397
|
var import_minimatch = __toESM(require("minimatch"));
|
|
3331
|
-
var
|
|
3398
|
+
var import_graphql15 = require("@tinacms/graphql");
|
|
3332
3399
|
|
|
3333
3400
|
// src/cmds/forestry-migrate/util/index.ts
|
|
3334
|
-
var
|
|
3401
|
+
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
3335
3402
|
var import_path8 = __toESM(require("path"));
|
|
3336
3403
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
3337
3404
|
var import_zod = __toESM(require("zod"));
|
|
@@ -3752,7 +3819,7 @@ var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false })
|
|
|
3752
3819
|
);
|
|
3753
3820
|
let templateString = "";
|
|
3754
3821
|
try {
|
|
3755
|
-
templateString =
|
|
3822
|
+
templateString = import_fs_extra7.default.readFileSync(templatePath).toString();
|
|
3756
3823
|
} catch {
|
|
3757
3824
|
throw new Error(
|
|
3758
3825
|
`Could not find template ${tem} at ${templatePath}
|
|
@@ -3817,7 +3884,7 @@ function checkExt(ext) {
|
|
|
3817
3884
|
var generateAllTemplates = async ({
|
|
3818
3885
|
pathToForestryConfig
|
|
3819
3886
|
}) => {
|
|
3820
|
-
const allTemplates = (await
|
|
3887
|
+
const allTemplates = (await import_fs_extra8.default.readdir(
|
|
3821
3888
|
import_path9.default.join(pathToForestryConfig, ".forestry", "front_matter", "templates")
|
|
3822
3889
|
)).map((tem) => import_path9.default.basename(tem, ".yml"));
|
|
3823
3890
|
const templateMap = /* @__PURE__ */ new Map();
|
|
@@ -3885,7 +3952,7 @@ var generateCollectionFromForestrySection = (args) => {
|
|
|
3885
3952
|
}
|
|
3886
3953
|
const forestryTemplates = (section == null ? void 0 : section.templates) || [];
|
|
3887
3954
|
if (forestryTemplates.length === 0 && section.create === "all") {
|
|
3888
|
-
for (
|
|
3955
|
+
for (const templateKey of templateMap.keys()) {
|
|
3889
3956
|
const { templateObj } = templateMap.get(templateKey);
|
|
3890
3957
|
const pages = templateObj == null ? void 0 : templateObj.pages;
|
|
3891
3958
|
if (pages) {
|
|
@@ -3970,7 +4037,7 @@ var generateCollectionFromForestrySection = (args) => {
|
|
|
3970
4037
|
if (ext === "md" || ext === "mdx") {
|
|
3971
4038
|
fields.push(BODY_FIELD);
|
|
3972
4039
|
}
|
|
3973
|
-
for (
|
|
4040
|
+
for (const currentTemplateName of templateMap.keys()) {
|
|
3974
4041
|
const { templateObj, fields: additionalFields } = templateMap.get(currentTemplateName);
|
|
3975
4042
|
const pages = (templateObj == null ? void 0 : templateObj.pages) || [];
|
|
3976
4043
|
if (pages.includes(section.path)) {
|
|
@@ -4025,7 +4092,7 @@ var generateCollections = async ({
|
|
|
4025
4092
|
templateMap,
|
|
4026
4093
|
usingTypescript
|
|
4027
4094
|
});
|
|
4028
|
-
const forestryConfig = await
|
|
4095
|
+
const forestryConfig = await import_fs_extra8.default.readFile(
|
|
4029
4096
|
import_path9.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
4030
4097
|
);
|
|
4031
4098
|
rewriteTemplateKeysInDocs({
|
|
@@ -4058,12 +4125,12 @@ var rewriteTemplateKeysInDocs = (args) => {
|
|
|
4058
4125
|
(_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
|
|
4059
4126
|
try {
|
|
4060
4127
|
const filePath = import_path9.default.join(page);
|
|
4061
|
-
if (
|
|
4128
|
+
if (import_fs_extra8.default.lstatSync(filePath).isDirectory()) {
|
|
4062
4129
|
return;
|
|
4063
4130
|
}
|
|
4064
4131
|
const extname = import_path9.default.extname(filePath);
|
|
4065
|
-
const fileContent =
|
|
4066
|
-
const content2 = (0,
|
|
4132
|
+
const fileContent = import_fs_extra8.default.readFileSync(filePath).toString();
|
|
4133
|
+
const content2 = (0, import_graphql15.parseFile)(
|
|
4067
4134
|
fileContent,
|
|
4068
4135
|
extname,
|
|
4069
4136
|
(yup) => yup.object({}),
|
|
@@ -4073,9 +4140,9 @@ var rewriteTemplateKeysInDocs = (args) => {
|
|
|
4073
4140
|
_template: stringifyLabel(templateKey),
|
|
4074
4141
|
...content2
|
|
4075
4142
|
};
|
|
4076
|
-
|
|
4143
|
+
import_fs_extra8.default.writeFileSync(
|
|
4077
4144
|
filePath,
|
|
4078
|
-
(0,
|
|
4145
|
+
(0, import_graphql15.stringifyFile)(newContent, extname, true, markdownParseConfig)
|
|
4079
4146
|
);
|
|
4080
4147
|
} catch (error) {
|
|
4081
4148
|
console.log(
|
|
@@ -4088,7 +4155,7 @@ var rewriteTemplateKeysInDocs = (args) => {
|
|
|
4088
4155
|
|
|
4089
4156
|
// src/next/commands/codemod-command/index.ts
|
|
4090
4157
|
var import_clipanion5 = require("clipanion");
|
|
4091
|
-
var
|
|
4158
|
+
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
4092
4159
|
var import_path10 = __toESM(require("path"));
|
|
4093
4160
|
var CodemodCommand = class extends import_clipanion5.Command {
|
|
4094
4161
|
constructor() {
|
|
@@ -4134,12 +4201,12 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
4134
4201
|
process.exit(1);
|
|
4135
4202
|
}
|
|
4136
4203
|
const tinaDestination = import_path10.default.join(configManager.rootPath, "tina");
|
|
4137
|
-
if (await
|
|
4204
|
+
if (await import_fs_extra9.default.existsSync(tinaDestination)) {
|
|
4138
4205
|
logger.info(
|
|
4139
4206
|
`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.`
|
|
4140
4207
|
);
|
|
4141
4208
|
} else {
|
|
4142
|
-
await
|
|
4209
|
+
await import_fs_extra9.default.moveSync(configManager.tinaFolderPath, tinaDestination);
|
|
4143
4210
|
await writeGitignore(configManager.rootPath);
|
|
4144
4211
|
logger.info(
|
|
4145
4212
|
"Move to 'tina' folder complete. Be sure to update any imports of the autogenerated client!"
|
|
@@ -4147,7 +4214,7 @@ var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
|
4147
4214
|
}
|
|
4148
4215
|
};
|
|
4149
4216
|
var writeGitignore = async (rootPath) => {
|
|
4150
|
-
await
|
|
4217
|
+
await import_fs_extra9.default.outputFileSync(
|
|
4151
4218
|
import_path10.default.join(rootPath, "tina", ".gitignore"),
|
|
4152
4219
|
"__generated__"
|
|
4153
4220
|
);
|
|
@@ -4173,7 +4240,7 @@ async function initStaticTina({
|
|
|
4173
4240
|
let collections;
|
|
4174
4241
|
let templateCode;
|
|
4175
4242
|
let extraText;
|
|
4176
|
-
const hasForestryConfig = await
|
|
4243
|
+
const hasForestryConfig = await import_fs_extra10.default.pathExists(
|
|
4177
4244
|
import_path11.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
4178
4245
|
);
|
|
4179
4246
|
let isForestryMigration = false;
|
|
@@ -4196,11 +4263,11 @@ async function initStaticTina({
|
|
|
4196
4263
|
hasForestryConfig,
|
|
4197
4264
|
noTelemetry
|
|
4198
4265
|
});
|
|
4199
|
-
const hasPackageJSON = await
|
|
4266
|
+
const hasPackageJSON = await import_fs_extra10.default.pathExistsSync("package.json");
|
|
4200
4267
|
if (!hasPackageJSON) {
|
|
4201
4268
|
await createPackageJSON();
|
|
4202
4269
|
}
|
|
4203
|
-
const hasGitignore = await
|
|
4270
|
+
const hasGitignore = await import_fs_extra10.default.pathExistsSync(".gitignore");
|
|
4204
4271
|
if (!hasGitignore) {
|
|
4205
4272
|
await createGitignore({ baseDir: "" });
|
|
4206
4273
|
} else {
|
|
@@ -4365,7 +4432,7 @@ ${disclaimer}`
|
|
|
4365
4432
|
var getFrontmatterFormat = async (rootPath) => {
|
|
4366
4433
|
try {
|
|
4367
4434
|
const hugoConfigPath = import_path11.default.join(rootPath, "config.toml");
|
|
4368
|
-
const hugoConfig = await
|
|
4435
|
+
const hugoConfig = await import_fs_extra10.default.readFile(hugoConfigPath, "utf8");
|
|
4369
4436
|
const frontMatterFormat = hugoConfig.match(/metaDataFormat = "(.*)"/);
|
|
4370
4437
|
console.log({ frontMatterFormat });
|
|
4371
4438
|
if (frontMatterFormat && frontMatterFormat[1]) {
|
|
@@ -4412,22 +4479,22 @@ var createPackageJSON = async () => {
|
|
|
4412
4479
|
};
|
|
4413
4480
|
var createGitignore = async ({ baseDir }) => {
|
|
4414
4481
|
logger.info(logText("No .gitignore found, creating one"));
|
|
4415
|
-
await
|
|
4482
|
+
await import_fs_extra10.default.outputFileSync(import_path11.default.join(baseDir, ".gitignore"), "node_modules");
|
|
4416
4483
|
};
|
|
4417
4484
|
var checkGitignoreForNodeModules = async ({
|
|
4418
4485
|
baseDir
|
|
4419
4486
|
}) => {
|
|
4420
|
-
const gitignoreContent = await
|
|
4487
|
+
const gitignoreContent = await import_fs_extra10.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
|
|
4421
4488
|
return gitignoreContent.split("\n").some((item) => item === "node_modules");
|
|
4422
4489
|
};
|
|
4423
4490
|
var addNodeModulesToGitignore = async ({ baseDir }) => {
|
|
4424
4491
|
logger.info(logText("Adding node_modules to .gitignore"));
|
|
4425
|
-
const gitignoreContent = await
|
|
4492
|
+
const gitignoreContent = await import_fs_extra10.default.readFileSync(import_path11.default.join(baseDir, ".gitignore")).toString();
|
|
4426
4493
|
const newGitignoreContent = [
|
|
4427
4494
|
...gitignoreContent.split("\n"),
|
|
4428
4495
|
"node_modules"
|
|
4429
4496
|
].join("\n");
|
|
4430
|
-
await
|
|
4497
|
+
await import_fs_extra10.default.writeFileSync(import_path11.default.join(baseDir, ".gitignore"), newGitignoreContent);
|
|
4431
4498
|
};
|
|
4432
4499
|
var addDependencies = async (packageManager) => {
|
|
4433
4500
|
logger.info(logText("Adding dependencies, this might take a moment..."));
|
|
@@ -4447,7 +4514,7 @@ var addConfigFile = async (args) => {
|
|
|
4447
4514
|
`config.${usingTypescript ? "ts" : "js"}`
|
|
4448
4515
|
);
|
|
4449
4516
|
const fullConfigPath = import_path11.default.join(baseDir, configPath);
|
|
4450
|
-
if (
|
|
4517
|
+
if (import_fs_extra10.default.pathExistsSync(fullConfigPath)) {
|
|
4451
4518
|
const override = await (0, import_prompts2.default)({
|
|
4452
4519
|
name: "selection",
|
|
4453
4520
|
type: "confirm",
|
|
@@ -4455,7 +4522,7 @@ var addConfigFile = async (args) => {
|
|
|
4455
4522
|
});
|
|
4456
4523
|
if (override["selection"]) {
|
|
4457
4524
|
logger.info(logText(`Overriding file at ${configPath}.`));
|
|
4458
|
-
await
|
|
4525
|
+
await import_fs_extra10.default.outputFileSync(fullConfigPath, config2(args));
|
|
4459
4526
|
} else {
|
|
4460
4527
|
logger.info(logText(`Not overriding file at ${configPath}.`));
|
|
4461
4528
|
}
|
|
@@ -4465,7 +4532,7 @@ var addConfigFile = async (args) => {
|
|
|
4465
4532
|
`Adding config file at tina/config.${usingTypescript ? "ts" : "js"}`
|
|
4466
4533
|
)
|
|
4467
4534
|
);
|
|
4468
|
-
await
|
|
4535
|
+
await import_fs_extra10.default.outputFileSync(fullConfigPath, config2(args));
|
|
4469
4536
|
await writeGitignore(baseDir);
|
|
4470
4537
|
}
|
|
4471
4538
|
};
|
|
@@ -4476,7 +4543,7 @@ var addTemplateFile = async (args) => {
|
|
|
4476
4543
|
`templates.${usingTypescript ? "ts" : "js"}`
|
|
4477
4544
|
);
|
|
4478
4545
|
const fullTemplatesPath = import_path11.default.join(baseDir, templatesPath);
|
|
4479
|
-
if (
|
|
4546
|
+
if (import_fs_extra10.default.pathExistsSync(fullTemplatesPath)) {
|
|
4480
4547
|
const override = await (0, import_prompts2.default)({
|
|
4481
4548
|
name: "selection",
|
|
4482
4549
|
type: "confirm",
|
|
@@ -4484,19 +4551,19 @@ var addTemplateFile = async (args) => {
|
|
|
4484
4551
|
});
|
|
4485
4552
|
if (override["selection"]) {
|
|
4486
4553
|
logger.info(logText(`Overriding file at ${templatesPath}.`));
|
|
4487
|
-
await
|
|
4554
|
+
await import_fs_extra10.default.outputFileSync(fullTemplatesPath, templateCode);
|
|
4488
4555
|
} else {
|
|
4489
4556
|
logger.info(logText(`Not overriding file at ${templatesPath}.`));
|
|
4490
4557
|
}
|
|
4491
4558
|
} else {
|
|
4492
4559
|
logger.info(logText(`Adding template file at ${templatesPath}`));
|
|
4493
|
-
await
|
|
4560
|
+
await import_fs_extra10.default.outputFileSync(fullTemplatesPath, templateCode);
|
|
4494
4561
|
}
|
|
4495
4562
|
};
|
|
4496
4563
|
var addContentFile = async ({ baseDir }) => {
|
|
4497
4564
|
const contentPath = import_path11.default.join("content", "posts", "hello-world.md");
|
|
4498
4565
|
const fullContentPath = import_path11.default.join(baseDir, contentPath);
|
|
4499
|
-
if (
|
|
4566
|
+
if (import_fs_extra10.default.pathExistsSync(fullContentPath)) {
|
|
4500
4567
|
const override = await (0, import_prompts2.default)({
|
|
4501
4568
|
name: "selection",
|
|
4502
4569
|
type: "confirm",
|
|
@@ -4504,13 +4571,13 @@ var addContentFile = async ({ baseDir }) => {
|
|
|
4504
4571
|
});
|
|
4505
4572
|
if (override["selection"]) {
|
|
4506
4573
|
logger.info(logText(`Overriding file at ${contentPath}.`));
|
|
4507
|
-
await
|
|
4574
|
+
await import_fs_extra10.default.outputFileSync(fullContentPath, content);
|
|
4508
4575
|
} else {
|
|
4509
4576
|
logger.info(logText(`Not overriding file at ${contentPath}.`));
|
|
4510
4577
|
}
|
|
4511
4578
|
} else {
|
|
4512
4579
|
logger.info(logText(`Adding content file at ${contentPath}`));
|
|
4513
|
-
await
|
|
4580
|
+
await import_fs_extra10.default.outputFileSync(fullContentPath, content);
|
|
4514
4581
|
}
|
|
4515
4582
|
};
|
|
4516
4583
|
var logNextSteps = ({
|
|
@@ -4570,7 +4637,7 @@ var addReactiveFile = {
|
|
|
4570
4637
|
baseDir,
|
|
4571
4638
|
usingTypescript
|
|
4572
4639
|
}) => {
|
|
4573
|
-
const usingSrc = !
|
|
4640
|
+
const usingSrc = !import_fs_extra10.default.pathExistsSync(import_path11.default.join(baseDir, "pages"));
|
|
4574
4641
|
const pagesPath = import_path11.default.join(baseDir, usingSrc ? "src" : "", "pages");
|
|
4575
4642
|
const packageJSONPath = import_path11.default.join(baseDir, "package.json");
|
|
4576
4643
|
const tinaBlogPagePath = import_path11.default.join(pagesPath, "demo", "blog");
|
|
@@ -4578,12 +4645,12 @@ var addReactiveFile = {
|
|
|
4578
4645
|
tinaBlogPagePath,
|
|
4579
4646
|
`[filename].${usingTypescript ? "tsx" : "js"}`
|
|
4580
4647
|
);
|
|
4581
|
-
if (!
|
|
4582
|
-
|
|
4583
|
-
|
|
4648
|
+
if (!import_fs_extra10.default.pathExistsSync(tinaBlogPagePathFile)) {
|
|
4649
|
+
import_fs_extra10.default.mkdirpSync(tinaBlogPagePath);
|
|
4650
|
+
import_fs_extra10.default.writeFileSync(tinaBlogPagePathFile, nextPostPage({ usingSrc }));
|
|
4584
4651
|
}
|
|
4585
4652
|
logger.info("Adding a nextjs example... \u2705");
|
|
4586
|
-
const pack = JSON.parse(
|
|
4653
|
+
const pack = JSON.parse(import_fs_extra10.default.readFileSync(packageJSONPath).toString());
|
|
4587
4654
|
const oldScripts = pack.scripts || {};
|
|
4588
4655
|
const newPack = JSON.stringify(
|
|
4589
4656
|
{
|
|
@@ -4593,7 +4660,7 @@ var addReactiveFile = {
|
|
|
4593
4660
|
null,
|
|
4594
4661
|
2
|
|
4595
4662
|
);
|
|
4596
|
-
|
|
4663
|
+
import_fs_extra10.default.writeFileSync(packageJSONPath, newPack);
|
|
4597
4664
|
}
|
|
4598
4665
|
};
|
|
4599
4666
|
function execShellCommand(cmd) {
|
|
@@ -4645,7 +4712,7 @@ InitCommand.usage = import_clipanion6.Command.Usage({
|
|
|
4645
4712
|
|
|
4646
4713
|
// src/next/commands/searchindex-command/index.ts
|
|
4647
4714
|
var import_clipanion7 = require("clipanion");
|
|
4648
|
-
var
|
|
4715
|
+
var import_graphql16 = require("@tinacms/graphql");
|
|
4649
4716
|
var import_search3 = require("@tinacms/search");
|
|
4650
4717
|
var SearchIndexCommand = class extends import_clipanion7.Command {
|
|
4651
4718
|
constructor() {
|
|
@@ -4679,7 +4746,7 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
|
|
|
4679
4746
|
process.exit(1);
|
|
4680
4747
|
}
|
|
4681
4748
|
const { schema } = configManager.config;
|
|
4682
|
-
const tinaSchema = await (0,
|
|
4749
|
+
const tinaSchema = await (0, import_graphql16.createSchema)({
|
|
4683
4750
|
schema: { ...schema, config: configManager.config }
|
|
4684
4751
|
});
|
|
4685
4752
|
let client;
|
|
@@ -4718,7 +4785,7 @@ var SearchIndexCommand = class extends import_clipanion7.Command {
|
|
|
4718
4785
|
}
|
|
4719
4786
|
const searchIndexer = new import_search3.SearchIndexer({
|
|
4720
4787
|
batchSize: ((_t = configManager.config.search) == null ? void 0 : _t.indexBatchSize) || 100,
|
|
4721
|
-
bridge: new
|
|
4788
|
+
bridge: new import_graphql16.FilesystemBridge(
|
|
4722
4789
|
configManager.rootPath,
|
|
4723
4790
|
configManager.contentRootPath
|
|
4724
4791
|
),
|
|
@@ -2,6 +2,7 @@ import { Command } from 'clipanion';
|
|
|
2
2
|
import type { DocumentNode } from 'graphql';
|
|
3
3
|
import type { Database } from '@tinacms/graphql';
|
|
4
4
|
import type { TinaSchema } from '@tinacms/schema-tools';
|
|
5
|
+
import { ConfigManager } from '../config-manager';
|
|
5
6
|
/**
|
|
6
7
|
* Base Command for Dev and build
|
|
7
8
|
*/
|
|
@@ -18,10 +19,12 @@ export declare abstract class BaseCommand extends Command {
|
|
|
18
19
|
abstract execute(): Promise<number | void>;
|
|
19
20
|
startSubCommand(): Promise<void>;
|
|
20
21
|
logDeprecationWarnings(): void;
|
|
21
|
-
indexContentWithSpinner({ database, graphQLSchema, tinaSchema, text, }: {
|
|
22
|
+
indexContentWithSpinner({ database, graphQLSchema, tinaSchema, configManager, partialReindex, text, }: {
|
|
22
23
|
database: Database;
|
|
23
24
|
graphQLSchema: DocumentNode;
|
|
24
25
|
tinaSchema: TinaSchema;
|
|
26
|
+
configManager: ConfigManager;
|
|
27
|
+
partialReindex?: boolean;
|
|
25
28
|
text?: string;
|
|
26
29
|
}): Promise<void>;
|
|
27
30
|
}
|
|
@@ -5,6 +5,7 @@ export declare class BuildCommand extends BaseCommand {
|
|
|
5
5
|
static paths: string[][];
|
|
6
6
|
localOption: boolean;
|
|
7
7
|
skipIndexing: boolean;
|
|
8
|
+
partialReindex: boolean;
|
|
8
9
|
tinaGraphQLVersion: string;
|
|
9
10
|
/**
|
|
10
11
|
* 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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.23",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@types/progress": "^2.0.3",
|
|
41
41
|
"@types/prompts": "^2.0.13",
|
|
42
42
|
"@types/yup": "^0.29.11",
|
|
43
|
-
"jest": "^
|
|
43
|
+
"jest": "^29.5.0",
|
|
44
44
|
"typescript": "4.3.5"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@graphql-codegen/core": "^2.1.0",
|
|
48
48
|
"@graphql-codegen/plugin-helpers": "latest",
|
|
49
|
-
"@graphql-codegen/typescript": "^
|
|
50
|
-
"@graphql-codegen/typescript-generic-sdk": "^
|
|
51
|
-
"@graphql-codegen/typescript-operations": "^
|
|
52
|
-
"@graphql-codegen/visitor-plugin-common": "^
|
|
49
|
+
"@graphql-codegen/typescript": "^4.0.1",
|
|
50
|
+
"@graphql-codegen/typescript-generic-sdk": "^3.1.0",
|
|
51
|
+
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
52
|
+
"@graphql-codegen/visitor-plugin-common": "^4.0.1",
|
|
53
53
|
"@graphql-inspector/core": "^4.0.0",
|
|
54
54
|
"@graphql-tools/graphql-file-loader": "^7.2.0",
|
|
55
55
|
"@graphql-tools/load": "^7.3.2",
|
|
@@ -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.21",
|
|
62
|
+
"@tinacms/datalayer": "1.2.19",
|
|
63
|
+
"@tinacms/graphql": "1.4.19",
|
|
64
64
|
"@tinacms/metrics": "1.0.2",
|
|
65
65
|
"@tinacms/schema-tools": "1.4.7",
|
|
66
|
-
"@tinacms/search": "1.0.
|
|
66
|
+
"@tinacms/search": "1.0.4",
|
|
67
67
|
"@vitejs/plugin-react": "3.1.0",
|
|
68
68
|
"ajv": "^6.12.3",
|
|
69
69
|
"altair-express-middleware": "4.0.6",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"fast-glob": "^3.2.4",
|
|
83
83
|
"fs-extra": "^9.0.1",
|
|
84
84
|
"graphql": "15.8.0",
|
|
85
|
+
"graphql-tag": "2.12.6",
|
|
85
86
|
"ini": "^3.0.0",
|
|
86
87
|
"is-unicode-supported": "^1.3.0",
|
|
87
88
|
"js-yaml": "^4.0.0",
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
"node-fetch": "2",
|
|
96
97
|
"normalize-path": "^3.0.0",
|
|
97
98
|
"postcss-nested": "^5.0.6",
|
|
99
|
+
"postcss": "^8.3.3",
|
|
98
100
|
"prettier": "^2.2.1",
|
|
99
101
|
"progress": "^2.0.3",
|
|
100
102
|
"prompts": "^2.4.1",
|
|
@@ -102,7 +104,7 @@
|
|
|
102
104
|
"rollup-plugin-visualizer": "^5.9.0",
|
|
103
105
|
"tailwindcss": "^3.2.7",
|
|
104
106
|
"url-pattern": "^1.0.3",
|
|
105
|
-
"vite": "4.
|
|
107
|
+
"vite": "^4.3.9",
|
|
106
108
|
"yarn": "^1.22.17",
|
|
107
109
|
"yup": "^0.32.9",
|
|
108
110
|
"zod": "^3.14.3"
|