@tinacms/cli 1.5.0 → 1.5.2
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/cmds/forestry-migrate/util/index.d.ts +3 -3
- package/dist/cmds/init/index.d.ts +3 -1
- package/dist/index.js +276 -105
- package/dist/next/commands/codemod-command/index.d.ts +1 -0
- package/dist/next/commands/dev-command/server/index.d.ts +1 -1
- package/dist/next/commands/init-command/index.d.ts +1 -0
- package/dist/next/config-manager.d.ts +4 -0
- package/dist/next/database.d.ts +1 -1
- package/dist/next/vite/plugins.d.ts +17 -0
- package/package.json +12 -10
|
@@ -76,7 +76,7 @@ declare const forestryFieldWithoutField: z.ZodObject<{
|
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
78
|
name?: string;
|
|
79
|
-
type?: "number" | "boolean" | "file" | "text" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "
|
|
79
|
+
type?: "number" | "boolean" | "file" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks" | "color";
|
|
80
80
|
label?: string;
|
|
81
81
|
template_types?: string[];
|
|
82
82
|
}, {
|
|
@@ -95,7 +95,7 @@ declare const forestryFieldWithoutField: z.ZodObject<{
|
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
97
|
name?: string;
|
|
98
|
-
type?: "number" | "boolean" | "file" | "text" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "
|
|
98
|
+
type?: "number" | "boolean" | "file" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks" | "color";
|
|
99
99
|
label?: string;
|
|
100
100
|
template_types?: string[];
|
|
101
101
|
}>;
|
|
@@ -150,10 +150,10 @@ export declare const parseSections: ({ val }: {
|
|
|
150
150
|
}) => {
|
|
151
151
|
sections?: {
|
|
152
152
|
match?: string;
|
|
153
|
+
exclude?: string;
|
|
153
154
|
path?: string;
|
|
154
155
|
type?: "directory" | "document" | "heading" | "jekyll-pages" | "jekyll-posts";
|
|
155
156
|
label?: string;
|
|
156
|
-
exclude?: string;
|
|
157
157
|
create?: "none" | "all" | "documents";
|
|
158
158
|
templates?: string[];
|
|
159
159
|
new_doc_ext?: string;
|
|
@@ -2,7 +2,8 @@ export interface Framework {
|
|
|
2
2
|
name: 'next' | 'hugo' | 'jekyll' | 'other';
|
|
3
3
|
reactive: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function initStaticTina({ pathToForestryConfig, noTelemetry, }: {
|
|
5
|
+
export declare function initStaticTina({ rootPath, pathToForestryConfig, noTelemetry, }: {
|
|
6
|
+
rootPath: string;
|
|
6
7
|
pathToForestryConfig: string;
|
|
7
8
|
noTelemetry: boolean;
|
|
8
9
|
}): Promise<void>;
|
|
@@ -14,6 +15,7 @@ export interface AddConfigArgs {
|
|
|
14
15
|
collections?: string;
|
|
15
16
|
token?: string;
|
|
16
17
|
clientId?: string;
|
|
18
|
+
isForestryMigration?: boolean;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Executes a shell command and return it as a Promise.
|
package/dist/index.js
CHANGED
|
@@ -28,10 +28,10 @@ __export(src_exports, {
|
|
|
28
28
|
default: () => src_default
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(src_exports);
|
|
31
|
-
var
|
|
31
|
+
var import_clipanion6 = require("clipanion");
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "1.5.
|
|
34
|
+
var version = "1.5.2";
|
|
35
35
|
|
|
36
36
|
// src/next/commands/dev-command/index.ts
|
|
37
37
|
var import_clipanion = require("clipanion");
|
|
@@ -207,10 +207,6 @@ var ConfigManager = class {
|
|
|
207
207
|
import_path.default.join(this.tinaFolderPath, "database")
|
|
208
208
|
);
|
|
209
209
|
this.generatedFolderPath = import_path.default.join(this.tinaFolderPath, GENERATED_FOLDER);
|
|
210
|
-
this.config = await this.loadConfigFile(
|
|
211
|
-
this.generatedFolderPath,
|
|
212
|
-
this.tinaConfigFilePath
|
|
213
|
-
);
|
|
214
210
|
this.generatedGraphQLGQLPath = import_path.default.join(
|
|
215
211
|
this.generatedFolderPath,
|
|
216
212
|
GRAPHQL_GQL_FILE
|
|
@@ -235,16 +231,6 @@ var ConfigManager = class {
|
|
|
235
231
|
this.generatedFolderPath,
|
|
236
232
|
"frags.gql"
|
|
237
233
|
);
|
|
238
|
-
const fullLocalContentPath = import_path.default.join(
|
|
239
|
-
this.tinaFolderPath,
|
|
240
|
-
this.config.localContentPath || ""
|
|
241
|
-
);
|
|
242
|
-
if (this.config.localContentPath && await import_fs_extra.default.existsSync(fullLocalContentPath)) {
|
|
243
|
-
logger.info(`Using separate content repo at ${fullLocalContentPath}`);
|
|
244
|
-
this.contentRootPath = fullLocalContentPath;
|
|
245
|
-
} else {
|
|
246
|
-
this.contentRootPath = this.rootPath;
|
|
247
|
-
}
|
|
248
234
|
this.generatedTypesTSFilePath = import_path.default.join(
|
|
249
235
|
this.generatedFolderPath,
|
|
250
236
|
"types.ts"
|
|
@@ -273,6 +259,19 @@ var ConfigManager = class {
|
|
|
273
259
|
this.generatedFolderPath,
|
|
274
260
|
"client.js"
|
|
275
261
|
);
|
|
262
|
+
const clientExists = this.isUsingTs() ? await import_fs_extra.default.pathExists(this.generatedClientTSFilePath) : await import_fs_extra.default.pathExists(this.generatedClientJSFilePath);
|
|
263
|
+
if (!clientExists) {
|
|
264
|
+
const file = "export default ()=>({})\nexport const client = ()=>({})";
|
|
265
|
+
if (this.isUsingTs()) {
|
|
266
|
+
await import_fs_extra.default.outputFile(this.generatedClientTSFilePath, file);
|
|
267
|
+
} else {
|
|
268
|
+
await import_fs_extra.default.outputFile(this.generatedClientJSFilePath, file);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
this.config = await this.loadConfigFile(
|
|
272
|
+
this.generatedFolderPath,
|
|
273
|
+
this.tinaConfigFilePath
|
|
274
|
+
);
|
|
276
275
|
this.publicFolderPath = import_path.default.join(
|
|
277
276
|
this.rootPath,
|
|
278
277
|
this.config.build.publicFolder
|
|
@@ -283,6 +282,16 @@ var ConfigManager = class {
|
|
|
283
282
|
);
|
|
284
283
|
this.outputHTMLFilePath = import_path.default.join(this.outputFolderPath, "index.html");
|
|
285
284
|
this.outputGitignorePath = import_path.default.join(this.outputFolderPath, ".gitignore");
|
|
285
|
+
const fullLocalContentPath = import_path.default.join(
|
|
286
|
+
this.tinaFolderPath,
|
|
287
|
+
this.config.localContentPath || ""
|
|
288
|
+
);
|
|
289
|
+
if (this.config.localContentPath && await import_fs_extra.default.existsSync(fullLocalContentPath)) {
|
|
290
|
+
logger.info(`Using separate content repo at ${fullLocalContentPath}`);
|
|
291
|
+
this.contentRootPath = fullLocalContentPath;
|
|
292
|
+
} else {
|
|
293
|
+
this.contentRootPath = this.rootPath;
|
|
294
|
+
}
|
|
286
295
|
this.spaMainPath = require.resolve("@tinacms/app");
|
|
287
296
|
this.spaRootPath = import_path.default.join(this.spaMainPath, "..", "..");
|
|
288
297
|
}
|
|
@@ -364,7 +373,8 @@ var ConfigManager = class {
|
|
|
364
373
|
entryPoints: [this.selfHostedDatabaseFilePath],
|
|
365
374
|
bundle: true,
|
|
366
375
|
platform: "node",
|
|
367
|
-
outfile
|
|
376
|
+
outfile,
|
|
377
|
+
loader: loaders
|
|
368
378
|
});
|
|
369
379
|
const result = require(outfile);
|
|
370
380
|
await import_fs_extra.default.removeSync(outfile);
|
|
@@ -381,13 +391,15 @@ var ConfigManager = class {
|
|
|
381
391
|
bundle: true,
|
|
382
392
|
target: ["es2020"],
|
|
383
393
|
platform: "node",
|
|
384
|
-
outfile
|
|
394
|
+
outfile,
|
|
395
|
+
loader: loaders
|
|
385
396
|
});
|
|
386
397
|
await esbuild.build({
|
|
387
398
|
entryPoints: [outfile],
|
|
388
399
|
bundle: true,
|
|
389
400
|
platform: "node",
|
|
390
|
-
outfile: outfile2
|
|
401
|
+
outfile: outfile2,
|
|
402
|
+
loader: loaders
|
|
391
403
|
});
|
|
392
404
|
const result = require(outfile2);
|
|
393
405
|
await import_fs_extra.default.removeSync(outfile);
|
|
@@ -395,6 +407,31 @@ var ConfigManager = class {
|
|
|
395
407
|
return result.default;
|
|
396
408
|
}
|
|
397
409
|
};
|
|
410
|
+
var loaders = {
|
|
411
|
+
".aac": "file",
|
|
412
|
+
".css": "file",
|
|
413
|
+
".eot": "file",
|
|
414
|
+
".flac": "file",
|
|
415
|
+
".gif": "file",
|
|
416
|
+
".jpeg": "file",
|
|
417
|
+
".jpg": "file",
|
|
418
|
+
".json": "json",
|
|
419
|
+
".mp3": "file",
|
|
420
|
+
".mp4": "file",
|
|
421
|
+
".ogg": "file",
|
|
422
|
+
".otf": "file",
|
|
423
|
+
".png": "file",
|
|
424
|
+
".svg": "file",
|
|
425
|
+
".ttf": "file",
|
|
426
|
+
".wav": "file",
|
|
427
|
+
".webm": "file",
|
|
428
|
+
".webp": "file",
|
|
429
|
+
".woff": "file",
|
|
430
|
+
".woff2": "file",
|
|
431
|
+
".js": "jsx",
|
|
432
|
+
".jsx": "jsx",
|
|
433
|
+
".tsx": "tsx"
|
|
434
|
+
};
|
|
398
435
|
|
|
399
436
|
// src/next/commands/dev-command/html.ts
|
|
400
437
|
var devHTML = (port) => `<!DOCTYPE html>
|
|
@@ -424,7 +461,7 @@ var devHTML = (port) => `<!DOCTYPE html>
|
|
|
424
461
|
</html>`;
|
|
425
462
|
|
|
426
463
|
// src/next/commands/dev-command/server/index.ts
|
|
427
|
-
var
|
|
464
|
+
var import_vite3 = require("vite");
|
|
428
465
|
|
|
429
466
|
// src/next/vite/index.ts
|
|
430
467
|
var import_path3 = __toESM(require("path"));
|
|
@@ -768,6 +805,9 @@ var createConfig = async ({
|
|
|
768
805
|
};
|
|
769
806
|
|
|
770
807
|
// src/next/vite/plugins.ts
|
|
808
|
+
var import_pluginutils = require("@rollup/pluginutils");
|
|
809
|
+
var import_fs = __toESM(require("fs"));
|
|
810
|
+
var import_vite2 = require("vite");
|
|
771
811
|
var import_esbuild = require("esbuild");
|
|
772
812
|
var import_path5 = __toESM(require("path"));
|
|
773
813
|
var import_body_parser = __toESM(require("body-parser"));
|
|
@@ -1001,14 +1041,50 @@ var devServerEndPointsPlugin = ({
|
|
|
1001
1041
|
};
|
|
1002
1042
|
return plug;
|
|
1003
1043
|
};
|
|
1044
|
+
function viteTransformExtension({
|
|
1045
|
+
exportAsDefault = true,
|
|
1046
|
+
svgrOptions,
|
|
1047
|
+
esbuildOptions,
|
|
1048
|
+
include = "**/*.svg",
|
|
1049
|
+
exclude
|
|
1050
|
+
} = {}) {
|
|
1051
|
+
const filter = (0, import_pluginutils.createFilter)(include, exclude);
|
|
1052
|
+
return {
|
|
1053
|
+
name: "vite-plugin-svgr",
|
|
1054
|
+
async transform(code, id) {
|
|
1055
|
+
if (filter(id)) {
|
|
1056
|
+
const { transform: transform2 } = await Promise.resolve().then(() => __toESM(require("@svgr/core")));
|
|
1057
|
+
const svgCode = await import_fs.default.promises.readFile(
|
|
1058
|
+
id.replace(/\?.*$/, ""),
|
|
1059
|
+
"utf8"
|
|
1060
|
+
);
|
|
1061
|
+
const componentCode = await transform2(svgCode, svgrOptions, {
|
|
1062
|
+
filePath: id,
|
|
1063
|
+
caller: {
|
|
1064
|
+
previousExport: exportAsDefault ? null : code
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
const res = await (0, import_vite2.transformWithEsbuild)(componentCode, id, {
|
|
1068
|
+
loader: "jsx",
|
|
1069
|
+
...esbuildOptions
|
|
1070
|
+
});
|
|
1071
|
+
return {
|
|
1072
|
+
code: res.code,
|
|
1073
|
+
map: null
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1004
1079
|
|
|
1005
1080
|
// src/next/commands/dev-command/server/index.ts
|
|
1006
1081
|
var createDevServer = async (configManager, database, apiURL, noWatch) => {
|
|
1007
1082
|
const plugins = [
|
|
1008
1083
|
transformTsxPlugin({ configManager }),
|
|
1009
|
-
devServerEndPointsPlugin({ apiURL, configManager, database })
|
|
1084
|
+
devServerEndPointsPlugin({ apiURL, configManager, database }),
|
|
1085
|
+
viteTransformExtension()
|
|
1010
1086
|
];
|
|
1011
|
-
return (0,
|
|
1087
|
+
return (0, import_vite3.createServer)(
|
|
1012
1088
|
await createConfig({
|
|
1013
1089
|
configManager,
|
|
1014
1090
|
database,
|
|
@@ -1462,7 +1538,7 @@ var createDBServer = (port) => {
|
|
|
1462
1538
|
});
|
|
1463
1539
|
dbServer.listen(port);
|
|
1464
1540
|
};
|
|
1465
|
-
async function createAndInitializeDatabase(configManager, bridgeOverride) {
|
|
1541
|
+
async function createAndInitializeDatabase(configManager, datalayerPort, bridgeOverride) {
|
|
1466
1542
|
let database;
|
|
1467
1543
|
const bridge = bridgeOverride || new import_graphql7.FilesystemBridge(configManager.rootPath, configManager.contentRootPath);
|
|
1468
1544
|
if (configManager.hasSelfHostedConfig() && configManager.config.contentApiUrlOverride) {
|
|
@@ -1476,7 +1552,7 @@ async function createAndInitializeDatabase(configManager, bridgeOverride) {
|
|
|
1476
1552
|
)} but there was no "contentApiUrlOverride" set. Falling back to built-in datalayer`
|
|
1477
1553
|
);
|
|
1478
1554
|
}
|
|
1479
|
-
const level = new import_graphql7.TinaLevelClient();
|
|
1555
|
+
const level = new import_graphql7.TinaLevelClient(datalayerPort);
|
|
1480
1556
|
level.openConnection();
|
|
1481
1557
|
database = (0, import_graphql7.createDatabase)({
|
|
1482
1558
|
bridge,
|
|
@@ -1531,7 +1607,7 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1531
1607
|
description: "Specify a port to run the server on. (default 4001)"
|
|
1532
1608
|
});
|
|
1533
1609
|
this.datalayerPort = import_clipanion.Option.String("--datalayer-port", "9000", {
|
|
1534
|
-
description: "Specify a port to run the datalayer server on. (default
|
|
1610
|
+
description: "Specify a port to run the datalayer server on. (default 9000)"
|
|
1535
1611
|
});
|
|
1536
1612
|
this.subCommand = import_clipanion.Option.String("-c,--command", {
|
|
1537
1613
|
description: "The sub-command to run"
|
|
@@ -1608,7 +1684,10 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1608
1684
|
}
|
|
1609
1685
|
}
|
|
1610
1686
|
if (firstTime) {
|
|
1611
|
-
database = await createAndInitializeDatabase(
|
|
1687
|
+
database = await createAndInitializeDatabase(
|
|
1688
|
+
configManager,
|
|
1689
|
+
Number(this.datalayerPort)
|
|
1690
|
+
);
|
|
1612
1691
|
} else {
|
|
1613
1692
|
database.clearCache();
|
|
1614
1693
|
}
|
|
@@ -1816,7 +1895,7 @@ var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
|
1816
1895
|
var import_graphql9 = require("@tinacms/graphql");
|
|
1817
1896
|
|
|
1818
1897
|
// src/next/commands/build-command/server.ts
|
|
1819
|
-
var
|
|
1898
|
+
var import_vite5 = require("vite");
|
|
1820
1899
|
var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
1821
1900
|
const publicEnv = {};
|
|
1822
1901
|
Object.keys(process.env).forEach((key) => {
|
|
@@ -1836,13 +1915,13 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
1836
1915
|
}
|
|
1837
1916
|
});
|
|
1838
1917
|
const config3 = await createConfig({
|
|
1839
|
-
plugins: [transformTsxPlugin({ configManager })],
|
|
1918
|
+
plugins: [transformTsxPlugin({ configManager }), viteTransformExtension()],
|
|
1840
1919
|
configManager,
|
|
1841
1920
|
database,
|
|
1842
1921
|
apiURL,
|
|
1843
1922
|
noWatch: true
|
|
1844
1923
|
});
|
|
1845
|
-
return (0,
|
|
1924
|
+
return (0, import_vite5.build)(config3);
|
|
1846
1925
|
};
|
|
1847
1926
|
|
|
1848
1927
|
// src/next/commands/build-command/index.ts
|
|
@@ -1963,7 +2042,7 @@ var BuildCommand = class extends import_clipanion2.Command {
|
|
|
1963
2042
|
description: "DEPRECATED - This should now be set in the config at client.skip = true'. Don't generate the generated client SDK"
|
|
1964
2043
|
});
|
|
1965
2044
|
this.datalayerPort = import_clipanion2.Option.String("--datalayer-port", "9000", {
|
|
1966
|
-
description: "Specify a port to run the datalayer server on. (default
|
|
2045
|
+
description: "Specify a port to run the datalayer server on. (default 9000)"
|
|
1967
2046
|
});
|
|
1968
2047
|
this.isomorphicGitBridge = import_clipanion2.Option.Boolean("--isomorphicGitBridge", {
|
|
1969
2048
|
description: "DEPRECATED - Enable Isomorphic Git Bridge Implementation"
|
|
@@ -2016,7 +2095,10 @@ var BuildCommand = class extends import_clipanion2.Command {
|
|
|
2016
2095
|
process.exit(1);
|
|
2017
2096
|
}
|
|
2018
2097
|
createDBServer(Number(this.datalayerPort));
|
|
2019
|
-
const database = await createAndInitializeDatabase(
|
|
2098
|
+
const database = await createAndInitializeDatabase(
|
|
2099
|
+
configManager,
|
|
2100
|
+
Number(this.datalayerPort)
|
|
2101
|
+
);
|
|
2020
2102
|
const { queryDoc, fragDoc } = await (0, import_graphql9.buildSchema)(
|
|
2021
2103
|
database,
|
|
2022
2104
|
configManager.config
|
|
@@ -2434,7 +2516,7 @@ var AuditCommand = class extends import_clipanion3.Command {
|
|
|
2434
2516
|
description: "Disable anonymous telemetry that is collected"
|
|
2435
2517
|
});
|
|
2436
2518
|
this.datalayerPort = import_clipanion3.Option.String("--datalayer-port", "9000", {
|
|
2437
|
-
description: "Specify a port to run the datalayer server on. (default
|
|
2519
|
+
description: "Specify a port to run the datalayer server on. (default 9000)"
|
|
2438
2520
|
});
|
|
2439
2521
|
}
|
|
2440
2522
|
async catch(error) {
|
|
@@ -2456,6 +2538,7 @@ var AuditCommand = class extends import_clipanion3.Command {
|
|
|
2456
2538
|
createDBServer(Number(this.datalayerPort));
|
|
2457
2539
|
const database = await createAndInitializeDatabase(
|
|
2458
2540
|
configManager,
|
|
2541
|
+
Number(this.datalayerPort),
|
|
2459
2542
|
this.clean ? void 0 : new import_graphql13.AuditFileSystemBridge(configManager.rootPath)
|
|
2460
2543
|
);
|
|
2461
2544
|
const { tinaSchema, graphQLSchema } = await (0, import_graphql12.buildSchema)(
|
|
@@ -2496,12 +2579,12 @@ AuditCommand.usage = import_clipanion3.Command.Usage({
|
|
|
2496
2579
|
});
|
|
2497
2580
|
|
|
2498
2581
|
// src/next/commands/init-command/index.ts
|
|
2499
|
-
var
|
|
2582
|
+
var import_clipanion5 = require("clipanion");
|
|
2500
2583
|
|
|
2501
2584
|
// src/cmds/init/index.ts
|
|
2502
|
-
var
|
|
2585
|
+
var import_path10 = __toESM(require("path"));
|
|
2503
2586
|
var import_prettier = require("prettier");
|
|
2504
|
-
var
|
|
2587
|
+
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
2505
2588
|
var import_prompts2 = __toESM(require("prompts"));
|
|
2506
2589
|
var import_metrics2 = require("@tinacms/metrics");
|
|
2507
2590
|
|
|
@@ -2510,19 +2593,19 @@ var nextPostPage = ({
|
|
|
2510
2593
|
usingSrc
|
|
2511
2594
|
}) => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
2512
2595
|
// This is a demo file once you have tina setup feel free to delete this file
|
|
2513
|
-
|
|
2596
|
+
|
|
2514
2597
|
import Head from 'next/head'
|
|
2515
2598
|
import { useTina } from 'tinacms/dist/react'
|
|
2516
2599
|
import { TinaMarkdown } from 'tinacms/dist/rich-text'
|
|
2517
|
-
import client from '${usingSrc ? "../" : ""}
|
|
2518
|
-
|
|
2600
|
+
import client from '${usingSrc ? "../" : ""}../../../tina/__generated__/client'
|
|
2601
|
+
|
|
2519
2602
|
const BlogPage = (props) => {
|
|
2520
2603
|
const { data } = useTina({
|
|
2521
2604
|
query: props.query,
|
|
2522
2605
|
variables: props.variables,
|
|
2523
2606
|
data: props.data,
|
|
2524
2607
|
})
|
|
2525
|
-
|
|
2608
|
+
|
|
2526
2609
|
return (
|
|
2527
2610
|
<>
|
|
2528
2611
|
<Head>
|
|
@@ -2561,7 +2644,7 @@ var nextPostPage = ({
|
|
|
2561
2644
|
</>
|
|
2562
2645
|
)
|
|
2563
2646
|
}
|
|
2564
|
-
|
|
2647
|
+
|
|
2565
2648
|
export const getStaticProps = async ({ params }) => {
|
|
2566
2649
|
let data = {}
|
|
2567
2650
|
let query = {}
|
|
@@ -2574,7 +2657,7 @@ var nextPostPage = ({
|
|
|
2574
2657
|
} catch {
|
|
2575
2658
|
// swallow errors related to document creation
|
|
2576
2659
|
}
|
|
2577
|
-
|
|
2660
|
+
|
|
2578
2661
|
return {
|
|
2579
2662
|
props: {
|
|
2580
2663
|
variables: variables,
|
|
@@ -2584,10 +2667,10 @@ var nextPostPage = ({
|
|
|
2584
2667
|
},
|
|
2585
2668
|
}
|
|
2586
2669
|
}
|
|
2587
|
-
|
|
2670
|
+
|
|
2588
2671
|
export const getStaticPaths = async () => {
|
|
2589
2672
|
const postsListData = await client.queries.postConnection()
|
|
2590
|
-
|
|
2673
|
+
|
|
2591
2674
|
return {
|
|
2592
2675
|
paths: postsListData.data.postConnection.edges.map((post) => ({
|
|
2593
2676
|
params: { filename: post.node._sys.filename },
|
|
@@ -2595,9 +2678,9 @@ var nextPostPage = ({
|
|
|
2595
2678
|
fallback: false,
|
|
2596
2679
|
}
|
|
2597
2680
|
}
|
|
2598
|
-
|
|
2681
|
+
|
|
2599
2682
|
export default BlogPage
|
|
2600
|
-
|
|
2683
|
+
|
|
2601
2684
|
const PageSection = (props) => {
|
|
2602
2685
|
return (
|
|
2603
2686
|
<>
|
|
@@ -2606,11 +2689,11 @@ var nextPostPage = ({
|
|
|
2606
2689
|
</>
|
|
2607
2690
|
)
|
|
2608
2691
|
}
|
|
2609
|
-
|
|
2692
|
+
|
|
2610
2693
|
const components = {
|
|
2611
2694
|
PageSection: PageSection,
|
|
2612
2695
|
}
|
|
2613
|
-
|
|
2696
|
+
|
|
2614
2697
|
const ContentSection = ({ content }) => {
|
|
2615
2698
|
return (
|
|
2616
2699
|
<div className="relative py-16 bg-white overflow-hidden">
|
|
@@ -2740,6 +2823,12 @@ function extendNextScripts(scripts) {
|
|
|
2740
2823
|
}
|
|
2741
2824
|
|
|
2742
2825
|
// src/cmds/init/setup-files/config.ts
|
|
2826
|
+
var clientConfig = (isForestryMigration) => {
|
|
2827
|
+
if (isForestryMigration) {
|
|
2828
|
+
return "client: {skip: true},";
|
|
2829
|
+
}
|
|
2830
|
+
return "";
|
|
2831
|
+
};
|
|
2743
2832
|
var other = (args) => {
|
|
2744
2833
|
return `
|
|
2745
2834
|
import { defineConfig } from "tinacms";
|
|
@@ -2751,6 +2840,7 @@ export default defineConfig({
|
|
|
2751
2840
|
branch,
|
|
2752
2841
|
clientId: ${args.clientId ? `'${args.clientId}'` : "null"}, // Get this from tina.io
|
|
2753
2842
|
token: ${args.token ? `'${args.token}'` : "null"}, // Get this from tina.io
|
|
2843
|
+
${clientConfig(args.isForestryMigration)}
|
|
2754
2844
|
build: {
|
|
2755
2845
|
outputFolder: "admin",
|
|
2756
2846
|
publicFolder: "${args.publicFolder}",
|
|
@@ -2793,11 +2883,12 @@ var configExamples = {
|
|
|
2793
2883
|
|
|
2794
2884
|
// Your hosting provider likely exposes this as an environment variable
|
|
2795
2885
|
const branch = process.env.HEAD || process.env.VERCEL_GIT_COMMIT_REF || 'main'
|
|
2796
|
-
|
|
2886
|
+
|
|
2797
2887
|
export default defineConfig({
|
|
2798
2888
|
branch,
|
|
2799
2889
|
clientId: ${args.clientId ? `'${args.clientId}'` : "null"}, // Get this from tina.io
|
|
2800
2890
|
token: ${args.token ? `'${args.token}'` : "null"}, // Get this from tina.io
|
|
2891
|
+
${clientConfig(args.isForestryMigration)}
|
|
2801
2892
|
build: {
|
|
2802
2893
|
outputFolder: "admin",
|
|
2803
2894
|
publicFolder: "${args.publicFolder}",
|
|
@@ -2996,7 +3087,6 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
2996
3087
|
skipBlocks = false
|
|
2997
3088
|
}) => {
|
|
2998
3089
|
const tinaFields = [];
|
|
2999
|
-
const blockFields = [];
|
|
3000
3090
|
fields == null ? void 0 : fields.forEach((forestryField2) => {
|
|
3001
3091
|
var _a, _b, _c, _d;
|
|
3002
3092
|
if (forestryField2.name === "menu") {
|
|
@@ -3139,7 +3229,6 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
3139
3229
|
break;
|
|
3140
3230
|
case "blocks":
|
|
3141
3231
|
if (skipBlocks) {
|
|
3142
|
-
blockFields.push(forestryField2.name);
|
|
3143
3232
|
break;
|
|
3144
3233
|
}
|
|
3145
3234
|
const templates = [];
|
|
@@ -3154,11 +3243,16 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
3154
3243
|
label: template2.label,
|
|
3155
3244
|
name: stringifyTemplateName(tem, tem)
|
|
3156
3245
|
};
|
|
3246
|
+
if (t.name != tem) {
|
|
3247
|
+
;
|
|
3248
|
+
t.nameOverride = tem;
|
|
3249
|
+
}
|
|
3157
3250
|
templates.push(t);
|
|
3158
3251
|
});
|
|
3159
3252
|
field = {
|
|
3160
3253
|
type: "object",
|
|
3161
3254
|
list: true,
|
|
3255
|
+
templateKey: "template",
|
|
3162
3256
|
label: forestryField2.label,
|
|
3163
3257
|
...getTinaFieldsFromName(forestryField2.name),
|
|
3164
3258
|
templates
|
|
@@ -3185,20 +3279,9 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
3185
3279
|
tinaFields.push(field);
|
|
3186
3280
|
}
|
|
3187
3281
|
});
|
|
3188
|
-
if (blockFields.length > 0) {
|
|
3189
|
-
logger.info(
|
|
3190
|
-
warnText(
|
|
3191
|
-
`Skipping blocks field${blockFields.length > 1 ? "s" : ""}: ${blockFields.map((b) => `"${b}"`).join(
|
|
3192
|
-
", "
|
|
3193
|
-
)}" in ${template}.yaml. Blocks fields need to be manually imported: ${linkText(
|
|
3194
|
-
"https://tina.io/docs/forestry/common-errors/#migrating-blocks"
|
|
3195
|
-
)}`
|
|
3196
|
-
)
|
|
3197
|
-
);
|
|
3198
|
-
}
|
|
3199
3282
|
return tinaFields;
|
|
3200
3283
|
};
|
|
3201
|
-
var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks =
|
|
3284
|
+
var getFieldsFromTemplates = ({ tem, pathToForestryConfig, skipBlocks = false }) => {
|
|
3202
3285
|
const templatePath = import_path7.default.join(
|
|
3203
3286
|
pathToForestryConfig,
|
|
3204
3287
|
".forestry",
|
|
@@ -3250,7 +3333,11 @@ var transformForestryMatchToTinaMatch = (match) => {
|
|
|
3250
3333
|
var _a, _b;
|
|
3251
3334
|
const newMatch = (_b = (_a = match.replace(" ", "").replace(/\.?(mdx|md|json|yaml|yml|toml)/g, "")) == null ? void 0 : _a.replace(/\..*$/g, "")) == null ? void 0 : _b.replace("{}", "");
|
|
3252
3335
|
if (match !== newMatch) {
|
|
3253
|
-
logger.
|
|
3336
|
+
logger.info(
|
|
3337
|
+
`Info: Match ${match} was transformed to ${newMatch}. See ${linkText(
|
|
3338
|
+
"https://tina.io/docs/forestry/common-errors/#info-match-match-was-transformed-to-newmatch"
|
|
3339
|
+
)}`
|
|
3340
|
+
);
|
|
3254
3341
|
}
|
|
3255
3342
|
return newMatch;
|
|
3256
3343
|
};
|
|
@@ -3433,6 +3520,9 @@ var rewriteTemplateKeysInDocs = (templateMap, rootPath) => {
|
|
|
3433
3520
|
(_a = templateObj == null ? void 0 : templateObj.pages) == null ? void 0 : _a.forEach((page) => {
|
|
3434
3521
|
try {
|
|
3435
3522
|
const filePath = import_path8.default.join(page);
|
|
3523
|
+
if (import_fs_extra7.default.lstatSync(filePath).isDirectory()) {
|
|
3524
|
+
return;
|
|
3525
|
+
}
|
|
3436
3526
|
const extname = import_path8.default.extname(filePath);
|
|
3437
3527
|
const fileContent = import_fs_extra7.default.readFileSync(filePath).toString();
|
|
3438
3528
|
const content2 = (0, import_graphql14.parseFile)(fileContent, extname, (yup) => yup.object({}));
|
|
@@ -3450,12 +3540,81 @@ var rewriteTemplateKeysInDocs = (templateMap, rootPath) => {
|
|
|
3450
3540
|
}
|
|
3451
3541
|
};
|
|
3452
3542
|
|
|
3543
|
+
// src/next/commands/codemod-command/index.ts
|
|
3544
|
+
var import_clipanion4 = require("clipanion");
|
|
3545
|
+
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
3546
|
+
var import_path9 = __toESM(require("path"));
|
|
3547
|
+
var CodemodCommand = class extends import_clipanion4.Command {
|
|
3548
|
+
constructor() {
|
|
3549
|
+
super(...arguments);
|
|
3550
|
+
this.rootPath = import_clipanion4.Option.String("--rootPath", {
|
|
3551
|
+
description: "Specify the root directory to run the CLI from"
|
|
3552
|
+
});
|
|
3553
|
+
this.verbose = import_clipanion4.Option.Boolean("-v,--verbose", false, {
|
|
3554
|
+
description: "increase verbosity of logged output"
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3557
|
+
async catch(error) {
|
|
3558
|
+
console.log(error);
|
|
3559
|
+
}
|
|
3560
|
+
async execute() {
|
|
3561
|
+
const mod = this.path[1];
|
|
3562
|
+
if (!mod) {
|
|
3563
|
+
logger.error(
|
|
3564
|
+
"Must specify an additional argument (eg. 'move-tina-folder')"
|
|
3565
|
+
);
|
|
3566
|
+
process.exit(1);
|
|
3567
|
+
}
|
|
3568
|
+
const mods = { "move-tina-folder": () => moveTinaFolder(this.rootPath) };
|
|
3569
|
+
const command = mods[mod];
|
|
3570
|
+
if (!command) {
|
|
3571
|
+
logger.error(`Mod not found for ${mod}`);
|
|
3572
|
+
process.exit(1);
|
|
3573
|
+
}
|
|
3574
|
+
await command();
|
|
3575
|
+
}
|
|
3576
|
+
};
|
|
3577
|
+
CodemodCommand.paths = [["codemod"], ["codemod", "move-tina-folder"]];
|
|
3578
|
+
CodemodCommand.usage = import_clipanion4.Command.Usage({
|
|
3579
|
+
category: `Commands`,
|
|
3580
|
+
description: `Use codemods for various Tina tasks`
|
|
3581
|
+
});
|
|
3582
|
+
var moveTinaFolder = async (rootPath = process.cwd()) => {
|
|
3583
|
+
const configManager = new ConfigManager({ rootPath });
|
|
3584
|
+
try {
|
|
3585
|
+
await configManager.processConfig();
|
|
3586
|
+
} catch (e) {
|
|
3587
|
+
logger.error(e.message);
|
|
3588
|
+
process.exit(1);
|
|
3589
|
+
}
|
|
3590
|
+
const tinaDestination = import_path9.default.join(configManager.rootPath, "tina");
|
|
3591
|
+
if (await import_fs_extra8.default.existsSync(tinaDestination)) {
|
|
3592
|
+
logger.info(
|
|
3593
|
+
`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.`
|
|
3594
|
+
);
|
|
3595
|
+
} else {
|
|
3596
|
+
await import_fs_extra8.default.moveSync(configManager.tinaFolderPath, tinaDestination);
|
|
3597
|
+
await writeGitignore(configManager.rootPath);
|
|
3598
|
+
logger.info(
|
|
3599
|
+
"Move to 'tina' folder complete. Be sure to update any imports of the autogenerated client!"
|
|
3600
|
+
);
|
|
3601
|
+
}
|
|
3602
|
+
};
|
|
3603
|
+
var writeGitignore = async (rootPath) => {
|
|
3604
|
+
await import_fs_extra8.default.outputFileSync(
|
|
3605
|
+
import_path9.default.join(rootPath, "tina", ".gitignore"),
|
|
3606
|
+
"__generated__"
|
|
3607
|
+
);
|
|
3608
|
+
};
|
|
3609
|
+
|
|
3453
3610
|
// src/cmds/init/index.ts
|
|
3454
3611
|
async function initStaticTina({
|
|
3612
|
+
rootPath,
|
|
3455
3613
|
pathToForestryConfig,
|
|
3456
3614
|
noTelemetry
|
|
3457
3615
|
}) {
|
|
3458
3616
|
logger.level = "info";
|
|
3617
|
+
process.chdir(rootPath);
|
|
3459
3618
|
const clientId = await chooseClientId();
|
|
3460
3619
|
let token = null;
|
|
3461
3620
|
if (clientId) {
|
|
@@ -3466,24 +3625,28 @@ async function initStaticTina({
|
|
|
3466
3625
|
const usingTypescript = await chooseTypescript();
|
|
3467
3626
|
const publicFolder = await choosePublicFolder({ framework });
|
|
3468
3627
|
let collections;
|
|
3469
|
-
const hasForestryConfig = await
|
|
3470
|
-
|
|
3628
|
+
const hasForestryConfig = await import_fs_extra9.default.pathExists(
|
|
3629
|
+
import_path10.default.join(pathToForestryConfig, ".forestry", "settings.yml")
|
|
3471
3630
|
);
|
|
3631
|
+
let isForestryMigration = false;
|
|
3472
3632
|
if (hasForestryConfig) {
|
|
3473
3633
|
collections = await forestryMigrate({
|
|
3474
3634
|
pathToForestryConfig
|
|
3475
3635
|
});
|
|
3636
|
+
if (collections) {
|
|
3637
|
+
isForestryMigration = true;
|
|
3638
|
+
}
|
|
3476
3639
|
}
|
|
3477
3640
|
await reportTelemetry({
|
|
3478
3641
|
usingTypescript,
|
|
3479
3642
|
hasForestryConfig,
|
|
3480
3643
|
noTelemetry
|
|
3481
3644
|
});
|
|
3482
|
-
const hasPackageJSON = await
|
|
3645
|
+
const hasPackageJSON = await import_fs_extra9.default.pathExistsSync("package.json");
|
|
3483
3646
|
if (!hasPackageJSON) {
|
|
3484
3647
|
await createPackageJSON();
|
|
3485
3648
|
}
|
|
3486
|
-
const hasGitignore = await
|
|
3649
|
+
const hasGitignore = await import_fs_extra9.default.pathExistsSync(".gitignore");
|
|
3487
3650
|
if (!hasGitignore) {
|
|
3488
3651
|
await createGitignore({ baseDir: "" });
|
|
3489
3652
|
} else {
|
|
@@ -3496,8 +3659,8 @@ async function initStaticTina({
|
|
|
3496
3659
|
}
|
|
3497
3660
|
await addDependencies(packageManager);
|
|
3498
3661
|
await addConfigFile({
|
|
3499
|
-
publicFolder:
|
|
3500
|
-
|
|
3662
|
+
publicFolder: import_path10.default.join(
|
|
3663
|
+
import_path10.default.relative(process.cwd(), pathToForestryConfig),
|
|
3501
3664
|
publicFolder
|
|
3502
3665
|
),
|
|
3503
3666
|
baseDir: "",
|
|
@@ -3505,7 +3668,8 @@ async function initStaticTina({
|
|
|
3505
3668
|
framework,
|
|
3506
3669
|
collections,
|
|
3507
3670
|
token,
|
|
3508
|
-
clientId
|
|
3671
|
+
clientId,
|
|
3672
|
+
isForestryMigration
|
|
3509
3673
|
});
|
|
3510
3674
|
if (!hasForestryConfig) {
|
|
3511
3675
|
await addContentFile({ baseDir: "" });
|
|
@@ -3650,22 +3814,22 @@ var createPackageJSON = async () => {
|
|
|
3650
3814
|
};
|
|
3651
3815
|
var createGitignore = async ({ baseDir }) => {
|
|
3652
3816
|
logger.info(logText("No .gitignore found, creating one"));
|
|
3653
|
-
await
|
|
3817
|
+
await import_fs_extra9.default.outputFileSync(import_path10.default.join(baseDir, ".gitignore"), "node_modules");
|
|
3654
3818
|
};
|
|
3655
3819
|
var checkGitignoreForNodeModules = async ({
|
|
3656
3820
|
baseDir
|
|
3657
3821
|
}) => {
|
|
3658
|
-
const gitignoreContent = await
|
|
3822
|
+
const gitignoreContent = await import_fs_extra9.default.readFileSync(import_path10.default.join(baseDir, ".gitignore")).toString();
|
|
3659
3823
|
return gitignoreContent.split("\n").some((item) => item === "node_modules");
|
|
3660
3824
|
};
|
|
3661
3825
|
var addNodeModulesToGitignore = async ({ baseDir }) => {
|
|
3662
3826
|
logger.info(logText("Adding node_modules to .gitignore"));
|
|
3663
|
-
const gitignoreContent = await
|
|
3827
|
+
const gitignoreContent = await import_fs_extra9.default.readFileSync(import_path10.default.join(baseDir, ".gitignore")).toString();
|
|
3664
3828
|
const newGitignoreContent = [
|
|
3665
3829
|
...gitignoreContent.split("\n"),
|
|
3666
3830
|
"node_modules"
|
|
3667
3831
|
].join("\n");
|
|
3668
|
-
await
|
|
3832
|
+
await import_fs_extra9.default.writeFileSync(import_path10.default.join(baseDir, ".gitignore"), newGitignoreContent);
|
|
3669
3833
|
};
|
|
3670
3834
|
var addDependencies = async (packageManager) => {
|
|
3671
3835
|
logger.info(logText("Adding dependencies, this might take a moment..."));
|
|
@@ -3680,12 +3844,12 @@ var addDependencies = async (packageManager) => {
|
|
|
3680
3844
|
};
|
|
3681
3845
|
var addConfigFile = async (args) => {
|
|
3682
3846
|
const { baseDir, usingTypescript } = args;
|
|
3683
|
-
const configPath =
|
|
3684
|
-
"
|
|
3847
|
+
const configPath = import_path10.default.join(
|
|
3848
|
+
"tina",
|
|
3685
3849
|
`config.${usingTypescript ? "ts" : "js"}`
|
|
3686
3850
|
);
|
|
3687
|
-
const fullConfigPath =
|
|
3688
|
-
if (
|
|
3851
|
+
const fullConfigPath = import_path10.default.join(baseDir, configPath);
|
|
3852
|
+
if (import_fs_extra9.default.pathExistsSync(fullConfigPath)) {
|
|
3689
3853
|
const override = await (0, import_prompts2.default)({
|
|
3690
3854
|
name: "selection",
|
|
3691
3855
|
type: "confirm",
|
|
@@ -3693,23 +3857,24 @@ var addConfigFile = async (args) => {
|
|
|
3693
3857
|
});
|
|
3694
3858
|
if (override["selection"]) {
|
|
3695
3859
|
logger.info(logText(`Overriding file at ${configPath}.`));
|
|
3696
|
-
await
|
|
3860
|
+
await import_fs_extra9.default.outputFileSync(fullConfigPath, config2(args));
|
|
3697
3861
|
} else {
|
|
3698
3862
|
logger.info(logText(`Not overriding file at ${configPath}.`));
|
|
3699
3863
|
}
|
|
3700
3864
|
} else {
|
|
3701
3865
|
logger.info(
|
|
3702
3866
|
logText(
|
|
3703
|
-
`Adding config file at
|
|
3867
|
+
`Adding config file at tina/config.${usingTypescript ? "ts" : "js"}`
|
|
3704
3868
|
)
|
|
3705
3869
|
);
|
|
3706
|
-
await
|
|
3870
|
+
await import_fs_extra9.default.outputFileSync(fullConfigPath, config2(args));
|
|
3871
|
+
await writeGitignore(baseDir);
|
|
3707
3872
|
}
|
|
3708
3873
|
};
|
|
3709
3874
|
var addContentFile = async ({ baseDir }) => {
|
|
3710
|
-
const contentPath =
|
|
3711
|
-
const fullContentPath =
|
|
3712
|
-
if (
|
|
3875
|
+
const contentPath = import_path10.default.join("content", "posts", "hello-world.md");
|
|
3876
|
+
const fullContentPath = import_path10.default.join(baseDir, contentPath);
|
|
3877
|
+
if (import_fs_extra9.default.pathExistsSync(fullContentPath)) {
|
|
3713
3878
|
const override = await (0, import_prompts2.default)({
|
|
3714
3879
|
name: "selection",
|
|
3715
3880
|
type: "confirm",
|
|
@@ -3717,13 +3882,13 @@ var addContentFile = async ({ baseDir }) => {
|
|
|
3717
3882
|
});
|
|
3718
3883
|
if (override["selection"]) {
|
|
3719
3884
|
logger.info(logText(`Overriding file at ${contentPath}.`));
|
|
3720
|
-
await
|
|
3885
|
+
await import_fs_extra9.default.outputFileSync(fullContentPath, content);
|
|
3721
3886
|
} else {
|
|
3722
3887
|
logger.info(logText(`Not overriding file at ${contentPath}.`));
|
|
3723
3888
|
}
|
|
3724
3889
|
} else {
|
|
3725
3890
|
logger.info(logText(`Adding content file at ${contentPath}`));
|
|
3726
|
-
await
|
|
3891
|
+
await import_fs_extra9.default.outputFileSync(fullContentPath, content);
|
|
3727
3892
|
}
|
|
3728
3893
|
};
|
|
3729
3894
|
var logNextSteps = ({
|
|
@@ -3783,20 +3948,20 @@ var addReactiveFile = {
|
|
|
3783
3948
|
baseDir,
|
|
3784
3949
|
usingTypescript
|
|
3785
3950
|
}) => {
|
|
3786
|
-
const usingSrc = !
|
|
3787
|
-
const pagesPath =
|
|
3788
|
-
const packageJSONPath =
|
|
3789
|
-
const tinaBlogPagePath =
|
|
3790
|
-
const tinaBlogPagePathFile =
|
|
3951
|
+
const usingSrc = !import_fs_extra9.default.pathExistsSync(import_path10.default.join(baseDir, "pages"));
|
|
3952
|
+
const pagesPath = import_path10.default.join(baseDir, usingSrc ? "src" : "", "pages");
|
|
3953
|
+
const packageJSONPath = import_path10.default.join(baseDir, "package.json");
|
|
3954
|
+
const tinaBlogPagePath = import_path10.default.join(pagesPath, "demo", "blog");
|
|
3955
|
+
const tinaBlogPagePathFile = import_path10.default.join(
|
|
3791
3956
|
tinaBlogPagePath,
|
|
3792
3957
|
`[filename].${usingTypescript ? "tsx" : "js"}`
|
|
3793
3958
|
);
|
|
3794
|
-
if (!
|
|
3795
|
-
|
|
3796
|
-
|
|
3959
|
+
if (!import_fs_extra9.default.pathExistsSync(tinaBlogPagePathFile)) {
|
|
3960
|
+
import_fs_extra9.default.mkdirpSync(tinaBlogPagePath);
|
|
3961
|
+
import_fs_extra9.default.writeFileSync(tinaBlogPagePathFile, nextPostPage({ usingSrc }));
|
|
3797
3962
|
}
|
|
3798
3963
|
logger.info("Adding a nextjs example... \u2705");
|
|
3799
|
-
const pack = JSON.parse(
|
|
3964
|
+
const pack = JSON.parse(import_fs_extra9.default.readFileSync(packageJSONPath).toString());
|
|
3800
3965
|
const oldScripts = pack.scripts || {};
|
|
3801
3966
|
const newPack = JSON.stringify(
|
|
3802
3967
|
{
|
|
@@ -3806,7 +3971,7 @@ var addReactiveFile = {
|
|
|
3806
3971
|
null,
|
|
3807
3972
|
2
|
|
3808
3973
|
);
|
|
3809
|
-
|
|
3974
|
+
import_fs_extra9.default.writeFileSync(packageJSONPath, newPack);
|
|
3810
3975
|
}
|
|
3811
3976
|
};
|
|
3812
3977
|
function execShellCommand(cmd) {
|
|
@@ -3822,13 +3987,16 @@ function execShellCommand(cmd) {
|
|
|
3822
3987
|
}
|
|
3823
3988
|
|
|
3824
3989
|
// src/next/commands/init-command/index.ts
|
|
3825
|
-
var InitCommand = class extends
|
|
3990
|
+
var InitCommand = class extends import_clipanion5.Command {
|
|
3826
3991
|
constructor() {
|
|
3827
3992
|
super(...arguments);
|
|
3828
|
-
this.pathToForestryConfig =
|
|
3993
|
+
this.pathToForestryConfig = import_clipanion5.Option.String("--forestryPath", {
|
|
3829
3994
|
description: "Specify the relative path to the .forestry directory, if importing an existing forestry site."
|
|
3830
3995
|
});
|
|
3831
|
-
this.
|
|
3996
|
+
this.rootPath = import_clipanion5.Option.String("--rootPath", {
|
|
3997
|
+
description: "Specify the root directory to run the CLI from (defaults to current working directory)"
|
|
3998
|
+
});
|
|
3999
|
+
this.noTelemetry = import_clipanion5.Option.Boolean("--noTelemetry", false, {
|
|
3832
4000
|
description: "Disable anonymous telemetry that is collected"
|
|
3833
4001
|
});
|
|
3834
4002
|
}
|
|
@@ -3838,21 +4006,23 @@ var InitCommand = class extends import_clipanion4.Command {
|
|
|
3838
4006
|
process.exit(1);
|
|
3839
4007
|
}
|
|
3840
4008
|
async execute() {
|
|
4009
|
+
const rootPath = this.rootPath || process.cwd();
|
|
3841
4010
|
await initStaticTina({
|
|
3842
|
-
|
|
4011
|
+
rootPath,
|
|
4012
|
+
pathToForestryConfig: this.pathToForestryConfig || rootPath,
|
|
3843
4013
|
noTelemetry: this.noTelemetry
|
|
3844
4014
|
});
|
|
3845
4015
|
process.exit();
|
|
3846
4016
|
}
|
|
3847
4017
|
};
|
|
3848
4018
|
InitCommand.paths = [["init"]];
|
|
3849
|
-
InitCommand.usage =
|
|
4019
|
+
InitCommand.usage = import_clipanion5.Command.Usage({
|
|
3850
4020
|
category: `Commands`,
|
|
3851
4021
|
description: `Add Tina to an existing project`
|
|
3852
4022
|
});
|
|
3853
4023
|
|
|
3854
4024
|
// src/index.ts
|
|
3855
|
-
var cli = new
|
|
4025
|
+
var cli = new import_clipanion6.Cli({
|
|
3856
4026
|
binaryName: `tinacms`,
|
|
3857
4027
|
binaryLabel: `TinaCMS`,
|
|
3858
4028
|
binaryVersion: version
|
|
@@ -3861,9 +4031,10 @@ cli.register(DevCommand);
|
|
|
3861
4031
|
cli.register(BuildCommand);
|
|
3862
4032
|
cli.register(AuditCommand);
|
|
3863
4033
|
cli.register(InitCommand);
|
|
3864
|
-
cli.register(
|
|
3865
|
-
cli.register(
|
|
3866
|
-
cli.register(
|
|
4034
|
+
cli.register(CodemodCommand);
|
|
4035
|
+
cli.register(import_clipanion6.Builtins.DefinitionsCommand);
|
|
4036
|
+
cli.register(import_clipanion6.Builtins.HelpCommand);
|
|
4037
|
+
cli.register(import_clipanion6.Builtins.VersionCommand);
|
|
3867
4038
|
var src_default = cli;
|
|
3868
4039
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3869
4040
|
0 && (module.exports = {});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Database } from '@tinacms/graphql';
|
|
1
|
+
import type { Database } from '@tinacms/graphql';
|
|
2
2
|
import { ConfigManager } from '../../../config-manager';
|
|
3
3
|
export declare const createDevServer: (configManager: ConfigManager, database: Database, apiURL: string, noWatch: boolean) => Promise<import("vite").ViteDevServer>;
|
|
@@ -2,6 +2,7 @@ import { Command } from 'clipanion';
|
|
|
2
2
|
export declare class InitCommand extends Command {
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
pathToForestryConfig: string;
|
|
5
|
+
rootPath: string;
|
|
5
6
|
noTelemetry: boolean;
|
|
6
7
|
static usage: import("clipanion").Usage;
|
|
7
8
|
catch(error: any): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Loader } from 'esbuild';
|
|
1
2
|
import { Config } from '@tinacms/schema-tools';
|
|
2
3
|
export declare const TINA_FOLDER = "tina";
|
|
3
4
|
export declare const LEGACY_TINA_FOLDER = ".tina";
|
|
@@ -58,3 +59,6 @@ export declare class ConfigManager {
|
|
|
58
59
|
loadDatabaseFile(): Promise<any>;
|
|
59
60
|
loadConfigFile(generatedFolderPath: string, configFilePath: string): Promise<any>;
|
|
60
61
|
}
|
|
62
|
+
export declare const loaders: {
|
|
63
|
+
[ext: string]: Loader;
|
|
64
|
+
};
|
package/dist/next/database.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Database, Bridge } from '@tinacms/graphql';
|
|
2
2
|
import { ConfigManager } from './config-manager';
|
|
3
3
|
export declare const createDBServer: (port: number) => void;
|
|
4
|
-
export declare function createAndInitializeDatabase(configManager: ConfigManager, bridgeOverride?: Bridge): Promise<Database>;
|
|
4
|
+
export declare function createAndInitializeDatabase(configManager: ConfigManager, datalayerPort: number, bridgeOverride?: Bridge): Promise<Database>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
3
|
+
import type { Config } from '@svgr/core';
|
|
4
|
+
import { transformWithEsbuild } from 'vite';
|
|
2
5
|
import type { Database } from '@tinacms/graphql';
|
|
3
6
|
import type { ConfigManager } from '../config-manager';
|
|
4
7
|
export declare const transformTsxPlugin: ({ configManager: _configManager, }: {
|
|
@@ -9,3 +12,17 @@ export declare const devServerEndPointsPlugin: ({ configManager, apiURL, databas
|
|
|
9
12
|
database: Database;
|
|
10
13
|
configManager: ConfigManager;
|
|
11
14
|
}) => Plugin;
|
|
15
|
+
export interface ViteSvgrOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Export React component as default. Notice that it will overrides
|
|
18
|
+
* the default behavior of Vite, which exports the URL as default
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
exportAsDefault?: boolean;
|
|
23
|
+
svgrOptions?: Config;
|
|
24
|
+
esbuildOptions?: Parameters<typeof transformWithEsbuild>[2];
|
|
25
|
+
exclude?: FilterPattern;
|
|
26
|
+
include?: FilterPattern;
|
|
27
|
+
}
|
|
28
|
+
export declare function viteTransformExtension({ exportAsDefault, svgrOptions, esbuildOptions, include, exclude, }?: ViteSvgrOptions): Plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tinacms/scripts": "1.1.0",
|
|
25
24
|
"@types/clear": "0.1.0",
|
|
26
25
|
"@types/cli-spinner": "^0.2.1",
|
|
27
26
|
"@types/cors": "2.8.5",
|
|
@@ -41,7 +40,8 @@
|
|
|
41
40
|
"@types/prompts": "^2.0.13",
|
|
42
41
|
"@types/yup": "^0.29.11",
|
|
43
42
|
"jest": "^27.0.6",
|
|
44
|
-
"typescript": "4.3.5"
|
|
43
|
+
"typescript": "4.3.5",
|
|
44
|
+
"@tinacms/scripts": "1.1.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@graphql-codegen/core": "^2.1.0",
|
|
@@ -53,15 +53,12 @@
|
|
|
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",
|
|
56
|
+
"@rollup/pluginutils": "^5.0.2",
|
|
57
|
+
"@svgr/core": "6.3.1",
|
|
56
58
|
"@tailwindcss/aspect-ratio": "^0.4.0",
|
|
57
59
|
"@tailwindcss/line-clamp": "^0.3.1",
|
|
58
60
|
"@tailwindcss/typography": "^0.5.9",
|
|
59
|
-
"@
|
|
60
|
-
"@tinacms/datalayer": "1.2.1",
|
|
61
|
-
"@tinacms/graphql": "1.4.1",
|
|
62
|
-
"@tinacms/metrics": "1.0.2",
|
|
63
|
-
"@tinacms/schema-tools": "1.4.1",
|
|
64
|
-
"@vitejs/plugin-react": "^2.1.0",
|
|
61
|
+
"@vitejs/plugin-react": "3.1.0",
|
|
65
62
|
"ajv": "^6.12.3",
|
|
66
63
|
"altair-express-middleware": "4.0.6",
|
|
67
64
|
"auto-bind": "^4.0.0",
|
|
@@ -103,7 +100,12 @@
|
|
|
103
100
|
"vite": "4.1.4",
|
|
104
101
|
"yarn": "^1.22.17",
|
|
105
102
|
"yup": "^0.32.9",
|
|
106
|
-
"zod": "^3.14.3"
|
|
103
|
+
"zod": "^3.14.3",
|
|
104
|
+
"@tinacms/app": "1.2.3",
|
|
105
|
+
"@tinacms/datalayer": "1.2.3",
|
|
106
|
+
"@tinacms/graphql": "1.4.3",
|
|
107
|
+
"@tinacms/metrics": "1.0.2",
|
|
108
|
+
"@tinacms/schema-tools": "1.4.2"
|
|
107
109
|
},
|
|
108
110
|
"publishConfig": {
|
|
109
111
|
"registry": "https://registry.npmjs.org"
|