@tinacms/cli 0.60.24 → 0.60.27

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/CHANGELOG.md DELETED
@@ -1,1212 +0,0 @@
1
- # tinacms-cli
2
-
3
- ## 0.60.24
4
-
5
- ### Patch Changes
6
-
7
- - 2ef5a1f33: Use media config from the schema in the local media server
8
- - 2ef5a1f33: Uses new `schema.config` when resolving media/asset urls
9
- - b348f8b6b: Experimental isomorphic git bridge implementation
10
- - b46e9a481: Fixed issue where child process would start before parent
11
- - fb73fb355: Renames syncFolder to a mediaRoot when configuring Repo-Based Media
12
- - 7b77fe1b5: Add a default TinaMediaStore for repo-based media
13
- - 3e4b3ea7e: media manage uses relieve dir paths
14
- - 99a13024d: Enables paging for local media manager
15
- - Updated dependencies [2ef5a1f33]
16
- - Updated dependencies [2ef5a1f33]
17
- - Updated dependencies [b348f8b6b]
18
- - Updated dependencies [fb73fb355]
19
- - Updated dependencies [4daf15b36]
20
- - @tinacms/graphql@0.61.0
21
- - @tinacms/datalayer@0.2.0
22
- - @tinacms/schema-tools@0.0.6
23
- - @tinacms/metrics@0.0.3
24
-
25
- ## 0.60.23
26
-
27
- ### Patch Changes
28
-
29
- - Updated dependencies [3325cd226]
30
- - @tinacms/graphql@0.60.8
31
-
32
- ## 0.60.22
33
-
34
- ### Patch Changes
35
-
36
- - b1a4290e6: Use media config from the schema in the local media server
37
- - 1955b8842: Uses new `schema.config` when resolving media/asset urls
38
- - Updated dependencies [f6cb634c2]
39
- - Updated dependencies [b1a4290e6]
40
- - Updated dependencies [1955b8842]
41
- - Updated dependencies [8b81c3cf3]
42
- - @tinacms/graphql@0.60.7
43
- - @tinacms/schema-tools@0.0.5
44
- - @tinacms/datalayer@0.1.1
45
- - @tinacms/metrics@0.0.3
46
-
47
- ## 0.60.21
48
-
49
- ### Patch Changes
50
-
51
- - Updated dependencies [e2aafcd93]
52
- - Updated dependencies [a20fed8b7]
53
- - @tinacms/graphql@0.60.6
54
-
55
- ## 0.60.20
56
-
57
- ### Patch Changes
58
-
59
- - f71f55ac3: Fixd issue where --dev caused a breaking change
60
- - Updated dependencies [57f09bdd7]
61
- - @tinacms/graphql@0.60.5
62
-
63
- ## 0.60.19
64
-
65
- ### Patch Changes
66
-
67
- - d103b27ad: Fix issue where new collections would not be added when CLI restarts
68
- - e06dbb3ca: Adds `waitForDB` cmd to cli
69
- - Updated dependencies [d103b27ad]
70
- - @tinacms/graphql@0.60.4
71
-
72
- ## 0.60.18
73
-
74
- ### Patch Changes
75
-
76
- - 79d112d79: Update cli to accept tinaCloudMediaStore flag and add to metadata during schema compilation
77
- - 91d6e6758: revert platform aware paths in schema introduced in https://github.com/tinacms/tinacms/commit/558cc4368cd2a4b6e87dfb82bbfbb6f569f8a6f8
78
- - b1240328d: Adds local server routes for handling media
79
- - 91d6e6758: Fix issues with experimentalData on windows related to path separator inconsistency and interference with the .tina/**generated** folder
80
- - Updated dependencies [79d112d79]
81
- - Updated dependencies [3f46c6706]
82
- - Updated dependencies [db9168578]
83
- - Updated dependencies [91d6e6758]
84
- - @tinacms/graphql@0.60.3
85
-
86
- ## 0.60.17
87
-
88
- ### Patch Changes
89
-
90
- - 08cdb672a: Adds `useRelativeMedia` support to local graphql client
91
- - 646cad8da: Adds support for using the generated client on the frontend
92
- - f857616f6: Rename sdk to queries
93
- - Updated dependencies [08cdb672a]
94
- - Updated dependencies [fdbfe9a16]
95
- - Updated dependencies [6e2ed31a2]
96
- - @tinacms/graphql@0.60.2
97
- - @tinacms/schema-tools@0.0.4
98
-
99
- ## 0.60.16
100
-
101
- ### Patch Changes
102
-
103
- - 7372f90ca: Adds a new client that can be used on the backend and frontend.
104
- - Updated dependencies [3b11ff6ad]
105
- - @tinacms/graphql@0.60.1
106
-
107
- ## 0.60.15
108
-
109
- ### Patch Changes
110
-
111
- - ceb826916: Fix issue where \_app override from tina init was improperly formatted
112
-
113
- ## 0.60.14
114
-
115
- ### Patch Changes
116
-
117
- - Updated dependencies [6a6f137ae]
118
- - @tinacms/graphql@0.60.0
119
-
120
- ## 0.60.13
121
-
122
- ### Patch Changes
123
-
124
- - 9d28ea29e: hide some existing start:server logging behind --verbose flag. format some messages to make them easier to read
125
-
126
- ## 0.60.12
127
-
128
- ### Patch Changes
129
-
130
- - ef450a53a: - Update tinacms CLI to support schemaFileType option (default 'ts') to allow user to specify the schema file type
131
- - Update telemetry module to optionally check NO_TELEMETRY environment variable for disabling telemetry
132
- - 81b729c24: Update formatting of cli init outputs
133
- - 558cc4368: Make schema init platform-aware and refactor database put requests
134
- - Updated dependencies [4da32454b]
135
- - Updated dependencies [921709a7e]
136
- - Updated dependencies [ef450a53a]
137
- - Updated dependencies [a2906d6fe]
138
- - Updated dependencies [558cc4368]
139
- - Updated dependencies [06666d39f]
140
- - Updated dependencies [3e2d9e43a]
141
- - @tinacms/graphql@0.59.11
142
- - @tinacms/schema-tools@0.0.3
143
- - @tinacms/metrics@0.0.3
144
- - @tinacms/datalayer@0.1.1
145
-
146
- ## 0.60.11
147
-
148
- ### Patch Changes
149
-
150
- - Updated dependencies [cf33bcec1]
151
- - @tinacms/graphql@0.59.10
152
-
153
- ## 0.60.10
154
-
155
- ### Patch Changes
156
-
157
- - 6154d12b8: Check for appropriate versions of react and react-dom before initializing with tinacms init
158
- - 8c23d69a2: Adds an MDX example when you run @tinacms/cli init
159
- - abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
160
-
161
- ### How to migrate.
162
-
163
- If you gone though the `tinacms init` process there should be a file called `.tina/components/TinaProvider`. In that file you can import the schema from `schema.ts` and add it to the TinaCMS wrapper component.
164
-
165
- ```tsx
166
- import TinaCMS from 'tinacms'
167
- import schema, { tinaConfig } from '../schema.ts'
168
-
169
- // Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
170
- // Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
171
- /**
172
- *
173
- * @private Do not import this directly, please import the dynamic provider instead
174
- */
175
- const TinaProvider = ({ children }) => {
176
- return (
177
- <TinaCMS {...tinaConfig} schema={schema}>
178
- {children}
179
- </TinaCMS>
180
- )
181
- }
182
-
183
- export default TinaProvider
184
- ```
185
-
186
- - Updated dependencies [8b3be903f]
187
- - Updated dependencies [82174ff50]
188
- - Updated dependencies [a87e1e6fa]
189
- - Updated dependencies [abf25c673]
190
- - Updated dependencies [591640db0]
191
- - Updated dependencies [e8b0de1f7]
192
- - Updated dependencies [b01f2e382]
193
- - @tinacms/datalayer@0.1.0
194
- - @tinacms/graphql@0.59.9
195
-
196
- ## 0.60.9
197
-
198
- ### Patch Changes
199
-
200
- - 048538625: fix: return cms on cmsCallback codegen (to fix broken typing)
201
- - Updated dependencies [e7b27ba3b]
202
- - Updated dependencies [11d55f441]
203
- - @tinacms/graphql@0.59.8
204
-
205
- ## 0.60.8
206
-
207
- ### Patch Changes
208
-
209
- - 919f5cb6c: use standard next script names
210
-
211
- ## 0.60.7
212
-
213
- ### Patch Changes
214
-
215
- - 9e436f145: Update CLI to use defineConfig
216
- - 851e4be73: Update tina init to use the new way of laying out tina config
217
- - cc99e4309: update admin file path to /pages/admin.js to support the hash router
218
- - @tinacms/datalayer@0.0.2
219
- - @tinacms/graphql@0.59.7
220
- - @tinacms/metrics@0.0.2
221
-
222
- ## 0.60.6
223
-
224
- ### Patch Changes
225
-
226
- - 98622111d: Use [esbuild](https://esbuild.github.io/) to build the schema instead of typescript.
227
-
228
- This allows the user to
229
-
230
- - use non typescript files like JS, JSX, TS
231
- - Import from outside of the tina folder
232
-
233
- The downside
234
-
235
- - Now type errors will still pass (The schema will compile) and one will get an error at runtime instead of compile time
236
-
237
- - Updated dependencies [c730fa1dd]
238
- - Updated dependencies [cd0f6f022]
239
- - @tinacms/graphql@0.59.7
240
-
241
- ## 0.60.5
242
-
243
- ### Patch Changes
244
-
245
- - 399fbf4fa: Fix an issue where builds weren't happening during CI, this is only an issue for the experimental data layer
246
-
247
- ## 0.60.4
248
-
249
- ### Patch Changes
250
-
251
- - a05546eb4: Added basic open source telemetry
252
-
253
- See [this discussion](https://github.com/tinacms/tinacms/discussions/2451) for more information and how to opt out.
254
-
255
- - Updated dependencies [8bf0ac832]
256
- - Updated dependencies [a05546eb4]
257
- - @tinacms/metrics@0.0.2
258
- - @tinacms/datalayer@0.0.2
259
- - @tinacms/graphql@0.59.6
260
-
261
- ## 0.60.3
262
-
263
- ### Patch Changes
264
-
265
- - 43b40cc8b: Implement useTina in CLI init
266
- - b399c734c: Fixes support for collection.templates in graphql
267
- - Updated dependencies [b399c734c]
268
- - @tinacms/datalayer@0.0.2
269
- - @tinacms/graphql@0.59.6
270
-
271
- ## 0.60.2
272
-
273
- ### Patch Changes
274
-
275
- - d17de356a: Update CLI to use apiUrl
276
- - a67b0c1d7: Dont reinstantiate bridge and store
277
-
278
- ## 0.60.1
279
-
280
- ### Patch Changes
281
-
282
- - Updated dependencies [8ad8f03fd]
283
- - Updated dependencies [04b7988d5]
284
- - Updated dependencies [e3c41f69d]
285
- - Updated dependencies [f5390e841]
286
- - Updated dependencies [32082e0b3]
287
- - @tinacms/graphql@0.59.5
288
- - @tinacms/datalayer@0.0.1
289
-
290
- ## 0.60.0
291
-
292
- ### Minor Changes
293
-
294
- - 35884152b: Adds and audit command that checks files for errors.
295
-
296
- ### Patch Changes
297
-
298
- - 083aa8ec6: Rebuild database every save while in local mode
299
- - Updated dependencies [b66aefde1]
300
- - Updated dependencies [35884152b]
301
- - Updated dependencies [4948beec6]
302
- - @tinacms/graphql@0.59.4
303
-
304
- ## 0.59.0
305
-
306
- ### Minor Changes
307
-
308
- - 70da62fe8: deprecated the use of `getStaticPropsForTina`
309
-
310
- ### Patch Changes
311
-
312
- - 80732bd97: Create a @tinacms/datalayer package which houses the logic for data management for the GraphQL API. This simplifies the @tinacms/graphql package and allows for a clearer separation.
313
- - Updated dependencies [34cd3a44a]
314
- - Updated dependencies [b006a5ab9]
315
- - Updated dependencies [a324b9c37]
316
- - Updated dependencies [80732bd97]
317
- - Updated dependencies [0bec208e2]
318
- - Updated dependencies [5c070a83f]
319
- - @tinacms/graphql@0.59.3
320
- - @tinacms/datalayer@0.0.1
321
-
322
- ## 0.58.5
323
-
324
- ### Patch Changes
325
-
326
- - Updated dependencies [212685fc3]
327
- - @tinacms/graphql@0.59.2
328
-
329
- ## 0.58.4
330
-
331
- ### Patch Changes
332
-
333
- - 118524507: Fixed typo in admin link
334
- - Updated dependencies [f46c6f987]
335
- - @tinacms/graphql@0.59.1
336
-
337
- ## 0.58.3
338
-
339
- ### Patch Changes
340
-
341
- - Updated dependencies [bd4e1f802]
342
- - Updated dependencies [62bea7019]
343
- - @tinacms/graphql@0.59.0
344
-
345
- ## 0.58.2
346
-
347
- ### Patch Changes
348
-
349
- - Updated dependencies [fffce3af8]
350
- - @tinacms/graphql@0.58.2
351
-
352
- ## 0.58.1
353
-
354
- ### Patch Changes
355
-
356
- - Updated dependencies [4700d7ae4]
357
- - @tinacms/graphql@0.58.1
358
-
359
- ## 0.58.0
360
-
361
- ### Minor Changes
362
-
363
- - fa7a0419f: Adds experimental support for a data layer between file-based content and the GraphQL API. This allows documents to be indexed so the CMS can behave more like a traditional CMS, with the ability enforce foreign reference constraints and filtering/pagination capabilities.
364
- - 8c14f29ef: Updated cli to include a new option, `--noSDK`. When this flag is present it will not generate the SDK.
365
-
366
- ### Patch Changes
367
-
368
- - 9c5f888a3: Modifies `tinacms init` for `TinaAdmin`-ready page
369
- - Updated dependencies [eb5fbfac7]
370
- - Updated dependencies [fa7a0419f]
371
- - Updated dependencies [47d126029]
372
- - @tinacms/graphql@0.58.0
373
-
374
- ## 0.57.2
375
-
376
- ### Patch Changes
377
-
378
- - edb2f4011: Trim path property on collections during compilation
379
- - Updated dependencies [edb2f4011]
380
- - @tinacms/graphql@0.57.2
381
-
382
- ## 0.57.1
383
-
384
- ### Patch Changes
385
-
386
- - 50710e1d0: Add no-check for Typescript-generated file
387
- - c78d981e6: Reset entire **generated** folder on re-compile
388
- - Updated dependencies [60729f60c]
389
- - @tinacms/graphql@0.57.1
390
-
391
- ## 0.57.0
392
-
393
- ### Minor Changes
394
-
395
- - d1ed404ba: Add support for auto-generated SDK for type-safe data fetching
396
-
397
- ### Patch Changes
398
-
399
- - 138ceb8c4: Clean up dependencies
400
- - Updated dependencies [138ceb8c4]
401
- - Updated dependencies [577d6a5ad]
402
- - Updated dependencies [ed277e3bd]
403
- - Updated dependencies [d1ed404ba]
404
- - @tinacms/graphql@0.57.0
405
-
406
- ## 0.56.5
407
-
408
- ### Patch Changes
409
-
410
- - 33ebe7a41: updated cli generated files
411
- - Updated dependencies [4b7795612]
412
- - @tinacms/graphql@0.56.1
413
-
414
- ## 0.56.4
415
-
416
- ### Patch Changes
417
-
418
- - b99baebf1: Add rich-text editor based on mdx, bump React dependency requirement to 16.14
419
- - Updated dependencies [891623c7c]
420
- - Updated dependencies [b99baebf1]
421
- - @tinacms/graphql@0.56.0
422
-
423
- ## 0.56.3
424
-
425
- ### Patch Changes
426
-
427
- - 7c389cb0f: Remove Forestry reference in CLI hint
428
-
429
- ## 0.56.2
430
-
431
- ### Patch Changes
432
-
433
- - Updated dependencies [9ecb392ca]
434
- - @tinacms/graphql@0.55.2
435
-
436
- ## 0.56.1
437
-
438
- ### Patch Changes
439
-
440
- - Updated dependencies [ff4446c8e]
441
- - Updated dependencies [667c33e2a]
442
- - @tinacms/graphql@0.55.1
443
-
444
- ## 0.56.0
445
-
446
- ### Minor Changes
447
-
448
- - f3bddeb4a: Added new warning messages for list UI that we do not support by default
449
- - 455a44359: Add noWatch option to server:start command. When this option is used, the config is not regenerated on file changes.
450
-
451
- ### Patch Changes
452
-
453
- - Updated dependencies [2908f8176]
454
- - Updated dependencies [5d83643b2]
455
- - Updated dependencies [f3bddeb4a]
456
- - @tinacms/graphql@0.55.0
457
-
458
- ## 0.55.2
459
-
460
- ### Patch Changes
461
-
462
- - e6e727697: feat: add simpler err message
463
- - 9b27192fe: Build packages with new scripting, which includes preliminary support for ES modules.
464
- - Updated dependencies [9b27192fe]
465
- - @tinacms/graphql@0.54.3
466
-
467
- ## 0.55.1
468
-
469
- ### Patch Changes
470
-
471
- - d94fec611: Improve exported types for defineSchema
472
- - Updated dependencies [d94fec611]
473
- - @tinacms/graphql@0.54.2
474
-
475
- ## 0.55.0
476
-
477
- ### Minor Changes
478
-
479
- - f4f652dae: Updated regex for CSS in tina init CLI
480
-
481
- ## 0.54.2
482
-
483
- ### Patch Changes
484
-
485
- - Updated dependencies [4de977f63]
486
- - @tinacms/graphql@0.54.1
487
-
488
- ## 0.54.1
489
-
490
- ### Patch Changes
491
-
492
- - Updated dependencies [7663e0f7f]
493
- - @tinacms/graphql@0.54.0
494
-
495
- ## 0.54.0
496
-
497
- ### Minor Changes
498
-
499
- - 069c63b73: Tina init command now adds exit-admin path
500
-
501
- ### Patch Changes
502
-
503
- - Updated dependencies [b4f5e973f]
504
- - @tinacms/graphql@0.53.0
505
-
506
- ## 0.53.3
507
-
508
- ### Patch Changes
509
-
510
- - Updated dependencies [b4bbdda86]
511
- - @tinacms/graphql@0.52.2
512
-
513
- ## 0.53.2
514
-
515
- ### Patch Changes
516
-
517
- - Updated dependencies [b05c91c6]
518
- - @tinacms/graphql@0.52.1
519
-
520
- ## 0.53.1
521
-
522
- ### Patch Changes
523
-
524
- - 7d2307321: Fixed the new line character in the @tinacms/cli init command
525
- - Updated dependencies [aa4507697]
526
- - @tinacms/graphql@0.52.0
527
-
528
- ## 0.53.0
529
-
530
- ### Minor Changes
531
-
532
- - 35d6f5e7: Added better error handleing for childProcess
533
-
534
- ## 0.52.2
535
-
536
- ### Patch Changes
537
-
538
- - Updated dependencies [589c7806]
539
- - @tinacms/graphql@0.51.1
540
-
541
- ## 0.52.1
542
-
543
- ### Patch Changes
544
-
545
- - c66b7eef: added regex to add css files to generated file
546
- - Updated dependencies [5a934f6b]
547
- - Updated dependencies [271a72d7]
548
- - @tinacms/graphql@0.51.0
549
-
550
- ## 0.52.0
551
-
552
- ### Minor Changes
553
-
554
- - d6dd2886: Added styles to generated files from CLI
555
-
556
- ### Patch Changes
557
-
558
- - 853330c1: Fix issue where NEXT_PUBLIC_EDIT_BRANCH was actually NEXT_PUBLIC_EDIT_BRACH in generated file
559
-
560
- ## 0.51.1
561
-
562
- ### Patch Changes
563
-
564
- - Updated dependencies [0970961f]
565
- - @tinacms/graphql@0.50.2
566
-
567
- ## 0.51.0
568
-
569
- ### Minor Changes
570
-
571
- - 25e0be67: update generated files in CLI
572
-
573
- ## 0.50.1
574
-
575
- ### Patch Changes
576
-
577
- - Updated dependencies [65b3e3a3]
578
- - @tinacms/graphql@0.50.1
579
-
580
- ## 0.50.0
581
-
582
- ### Minor Changes
583
-
584
- - 7f3c8c1a: # 🔧 Changes coming to TinaCMS ⚙️
585
-
586
- 👋 You may have noticed we've been hard at-work lately building out a more opinionated approach to TinaCMS. To that end, we've settled around a few key points we'd like to announce. To see the work in progress, check out the [main](https://github.com/tinacms/tinacms/tree/main) branch, which will become the primary branch soon.
587
-
588
- ## Consolidating @tinacms packages in to @tinacms/toolkit
589
-
590
- By nature, Tina relies heavily on React context, and the dependency mismatches from over-modularizing our toolkit has led to many bugs related to missing context. To fix this, we'll be consolidating nearly every package in the @tinacms scope to a single package called `@tinacms/toolkit`
591
-
592
- We'll also be rolling out esm support as it's now much easier to address build improvements
593
-
594
- ## A more focused tinacms package
595
-
596
- The `tinacms` package now comes baked-in with APIs for working with the TinaCMS GraphQL API. Because `@tinacms/toolkit` now encompasses everything you'd need to build your own CMS integration, we're repurposing the `tinacms` package to more accurately reflect the "batteries-included" approach.
597
-
598
- If you haven't been introduced, the GraphQL API is a Git-backed CMS which we'll be leaning into more in the future. With a generous free tier and direct syncing with Github its something we're really excited to push forward. Sign up for free here
599
- Note: tinacms still exports the same APIs, but we'll gradually start moving the backend-agnostic tools to @tinacms/toolkit.
600
-
601
- ## Consolidating the tina-graphql-gateway repo
602
-
603
- The tina-graphql-gateway repo will be absorbed into this one. If you've been working with our GraphQL APIs you'll need to follow our migration guide.
604
-
605
- ## Moving from Lerna to Yarn PNP
606
-
607
- We've had success with Yarn 2 and PNP in other monorepos, if you're a contributor you'll notice some updates to the DX, which should hopefully result in a smoother experience.
608
-
609
- ## FAQ
610
-
611
- ### What about other backends?
612
-
613
- The `@tinacms/toolkit` isn't going anywhere. And if you're using packages like `react-tinacms-strapi` or r`eact-tinacms-github` with success, that won't change much, they'll just be powered by `@tinacms/toolkit` under the hood.
614
-
615
- ### Do I need to do anything?
616
-
617
- We'll be bumping all packages to `0.50.0` to reflect the changes. If you're using @tincams scoped packages those won't receive the upgrade. Unscoped packages like `react-tinacms-editor` will be upgraded, and should be bumped to 0.50.0 as well.
618
- When we move to `1.0.0` we'll be pushing internal APIs to `@tinacms/toolkit`, so that's the long-term location of
619
-
620
- ### Will you continue to patch older versions?
621
-
622
- We'll continue to make security patches, however major bug fixes will likely not see any updates. Keep in mind that `@tinacms/toolkit` will continue to be developed.
623
-
624
- ### Patch Changes
625
-
626
- - Updated dependencies [7f3c8c1a]
627
- - @tinacms/graphql@0.1.0
628
-
629
- ## 0.4.0
630
-
631
- ### Minor Changes
632
-
633
- - 7351d92f: # Define schema changes
634
-
635
- We're going to be leaning on a more _primitive_ concept of how types are defined with Tina, and in doing so will be introducing some breaking changes to the way schemas are defined. Read the detailed [RFC discussion](https://github.com/tinacms/rfcs/pull/18) for more on this topic, specifically the [latter portions](https://github.com/tinacms/rfcs/pull/18#issuecomment-805400313) of the discussion.
636
-
637
- ## Collections now accept a `fields` _or_ `templates` property
638
-
639
- You can now provide `fields` instead of `templates` for your collection, doing so will result in a more straightforward schema definition:
640
-
641
- ```js
642
- {
643
- collections: [
644
- {
645
- name: 'post',
646
- label: 'Post',
647
- path: 'content/posts',
648
- fields: [
649
- {
650
- name: 'title',
651
- label: 'Title',
652
- type: 'string', // read on below to learn more about _type_ changes
653
- },
654
- ],
655
- // defining `fields` and `templates` would result in a compilation error
656
- },
657
- ]
658
- }
659
- ```
660
-
661
- **Why?**
662
-
663
- Previously, a collection could define multiple templates, the ambiguity introduced with this feature meant that your documents needed a `_template` field on them so we'd know which one they belonged to. It also mean having to disambiguate your queries in graphql:
664
-
665
- ```graphql
666
- getPostDocument(relativePage: $relativePath) {
667
- data {
668
- ...on Article_Doc_Data {
669
- title
670
- }
671
- }
672
- }
673
- ```
674
-
675
- Going forward, if you use `fields` on a collection, you can omit the `_template` key and simplify your query:
676
-
677
- ```graphql
678
- getPostDocument(relativePage: $relativePath) {
679
- data {
680
- title
681
- }
682
- }
683
- ```
684
-
685
- ## `type` changes
686
-
687
- Types will look a little bit different, and are meant to reflect the lowest form of the shape they can represent. Moving forward, the `ui` field will represent the UI portion of what you might expect. For a blog post "description" field, you'd define it like this:
688
-
689
- ```js
690
- {
691
- type: "string",
692
- label: "Description",
693
- name: "description",
694
- }
695
- ```
696
-
697
- By default `string` will use the `text` field, but you can change that by specifying the `component`:
698
-
699
- ```js
700
- {
701
- type: "string",
702
- label: "Description",
703
- name: "description",
704
- ui: {
705
- component: "textarea"
706
- }
707
- }
708
- ```
709
-
710
- For the most part, the UI properties are added to the field and adhere to the existing capabilities of Tina's core [field plugins](https://tina.io/docs/fields/). But there's nothing stopping you from providing your own components -- just be sure to register those with the CMS object on the frontend:
711
-
712
- ```js
713
- {
714
- type: "string",
715
- label: "Description",
716
- name: "description",
717
- ui: {
718
- component: "myMapField"
719
- someAdditionalMapConfig: 'some-value'
720
- }
721
- }
722
- ```
723
-
724
- [Register](https://tina.io/docs/fields/custom-fields/#registering-the-plugin) your `myMapField` with Tina:
725
-
726
- ```js
727
- cms.fields.add({
728
- name: 'myMapField',
729
- Component: MapPicker,
730
- })
731
- ```
732
-
733
- ### One important gotcha
734
-
735
- Every property in the `defineSchema` API must be serlializable. Meaning functions will not work. For example, there's no way to define a `validate` or `parse` function at this level. However, you can either use the [formify](https://tina.io/docs/tina-cloud/client/#formify) API to get access to the Tina form, or provide your own logic by specifying a plugin of your choice:
736
-
737
- ```js
738
- {
739
- type: "string",
740
- label: "Description",
741
- name: "description",
742
- ui: {
743
- component: "myText"
744
- }
745
- }
746
- ```
747
-
748
- And then when you register the plugin, provide your custom logic here:
749
-
750
- ```js
751
- import { TextFieldPlugin } from 'tinacms'
752
-
753
- // ...
754
-
755
- cms.fields.add({
756
- ...TextFieldPlugin, // spread existing text plugin
757
- name: 'myText',
758
- validate: value => {
759
- someValidationLogic(value)
760
- },
761
- })
762
- ```
763
-
764
- **Why?**
765
-
766
- The reality is that under the hood this has made no difference to the backend, so we're removing it as a point of friction. Instead, `type` is the true definition of the field's _shape_, while `ui` can be used for customizing the look and behavior of the field's UI.
767
-
768
- ## Defensive coding in Tina
769
-
770
- When working with GraphQL, there are 2 reasons a property may not be present.
771
-
772
- 1. The data is not a required property. That is to say, if I have a blog post document, and "category" is an optional field, we'll need to make sure we factor that into how we render our page:
773
-
774
- ```tsx
775
- const MyPage = props => {
776
- return (
777
- <>
778
- <h2>{props.getPostDocument.data.title}</h2>
779
- <MyCategoryComponent>
780
- {props.getPostDocument.data?.category}
781
- </MyCategoryComponent>
782
- </>
783
- )
784
- }
785
- ```
786
-
787
- 2. The query did not ask for that field:
788
-
789
- ```graphql
790
- {
791
- getPostDocument {
792
- data {
793
- title
794
- }
795
- }
796
- }
797
- ```
798
-
799
- But with Tina, there's a 3rd scenario: the document may be in an invalid state. Meaning, we could mark the field as `required` _and_ query for the appropriate field, and _still_ not have the expected shape of data. Due to the contextual nature of Tina, it's very common to be in an intermediate state, where your data is incomplete simply because you're still working on it. Most APIs would throw an error when a document is in an invalid state. Or, more likely, you couldn't even request it.
800
-
801
- ## Undefined list fields will return `null`
802
-
803
- Previously an listable field which wasn't defined in the document was treated as an emptry array. So for example:
804
-
805
- ```md
806
- ---
807
- title: 'Hello, World'
808
- categories:
809
- - sports
810
- - movies
811
- ---
812
- ```
813
-
814
- The responsee would be `categories: ['sports', 'movies']`. If you omit the items, but kept the empty array:
815
-
816
- ```md
817
- ---
818
- title: 'Hello, World'
819
- categories: []
820
- ---
821
- ```
822
-
823
- The responsee would be `categories: []`. If you omit the field entirely:
824
-
825
- ```md
826
- ---
827
- title: 'Hello, World'
828
- ---
829
- ```
830
-
831
- The response will be `categories: null`. Previously this would have been `[]`, which was incorrect.
832
-
833
- ## For a listable item which is `required: true` you _must_ provide a `ui.defaultItem` property
834
-
835
- ### Why?
836
-
837
- It's possible for Tina's editing capabilities to introduce an invalid state during edits to list items. Imagine the scenario where you are iterating through an array of objects, and each object has a categories array on it we'd like to render:
838
-
839
- ```tsx
840
- const MyPage = props => {
841
- return props.blocks.map(block => {
842
- return (
843
- <>
844
- <h2>{block.categories.split(',')}</h2>
845
- </>
846
- )
847
- })
848
- }
849
- ```
850
-
851
- For a new item, `categories` will be null, so we'll get an error. This only happens when you're editing your page with Tina, so it's not a production-facing issue.
852
-
853
- ## Every `type` can be a list
854
-
855
- Previously, we had a `list` field, which allowed you to supply a `field` property. Instead, _every_ primitive type can be represented as a list:
856
-
857
- ```js
858
- {
859
- type: "string",
860
- label: "Categories",
861
- name: "categories",
862
- list: true
863
- }
864
- ```
865
-
866
- Additionally, enumerable lists and selects are inferred from the `options` property. The following example is represented by a `select` field:
867
-
868
- ```js
869
- {
870
- type: "string",
871
- label: "Categories",
872
- name: "categories",
873
- options: ["fitness", "movies", "music"]
874
- }
875
- ```
876
-
877
- While this, is a `checkbox` field
878
-
879
- ```js
880
- {
881
- type: "string",
882
- label: "Categories",
883
- name: "categories"
884
- list: true,
885
- options: ["fitness", "movies", "music"]
886
- }
887
- ```
888
-
889
- > Note we may introduce an `enum` type, but haven't discussed it thoroughly
890
-
891
- ## Introducing the `object` type
892
-
893
- Tina currently represents the concept of an _object_ in two ways: a `group` (and `group-list`), which is a uniform collection of fields; and `blocks`, which is a polymporphic collection. Moving forward, we'll be introducing a more comporehensive type, which envelopes the behavior of both `group` and `blocks`, and since _every_ field can be a `list`, this also makes `group-list` redundant.
894
-
895
- > Note: we've previously assumed that `blocks` usage would _always_ be as an array. We'll be keeping that assumption with the `blocks` type for compatibility, but `object` will allow for non-array polymorphic objects.
896
-
897
- ### Defining an `object` type
898
-
899
- An `object` type takes either a `fields` _or_ `templates` property (just like the `collections` definition). If you supply `fields`, you'll end up with what is essentially a `group` item. And if you say `list: true`, you'll have what used to be a `group-list` definition.
900
-
901
- Likewise, if you supply a `templates` field and `list: true`, you'll get the same API as `blocks`. However you can also say `list: false` (or omit it entirely), and you'll have a polymorphic object which is _not_ an array.
902
-
903
- This is identical to the current `blocks` definition:
904
-
905
- ```js
906
- {
907
- type: "object",
908
- label: "Page Sections",
909
- name: "pageSections",
910
- list: true,
911
- templates: [{
912
- label: "Hero",
913
- name: "hero",
914
- fields: [{
915
- label: "Title",
916
- name: "title",
917
- type: "string"
918
- }]
919
- }]
920
- }
921
- ```
922
-
923
- And here is one for `group`:
924
-
925
- ```js
926
- {
927
- type: "object",
928
- label: "Hero",
929
- name: "hero",
930
- fields: [{
931
- label: "Title",
932
- name: "title",
933
- type: "string"
934
- }]
935
- }
936
- ```
937
-
938
- ## `dataJSON` field
939
-
940
- You can now request `dataJSON` for the entire data object as a single query key. This is great for more tedius queries like theme files where including each item in the result is cumbersome.
941
-
942
- > Note there is no typescript help for this feature for now
943
-
944
- ```graphql
945
- getThemeDocument(relativePath: $relativePath) {
946
- dataJSON
947
- }
948
- ```
949
-
950
- ```json
951
- {
952
- "getThemeDocument": {
953
- "dataJSON": {
954
- "every": "field",
955
- "in": {
956
- "the": "document"
957
- },
958
- "is": "returned"
959
- }
960
- }
961
- }
962
- ```
963
-
964
- ## Lists queries will now adhere to the GraphQL connection spec
965
-
966
- [Read the spec](https://relay.dev/graphql/connections.htm)
967
-
968
- Previously, lists would return a simple array of items:
969
-
970
- ```graphql
971
- {
972
- getPostsList {
973
- id
974
- }
975
- }
976
- ```
977
-
978
- Which would result in:
979
-
980
- ```json
981
- {
982
- "data": {
983
- "getPostsList": [
984
- {
985
- "id": "content/posts/voteForPedro.md"
986
- }
987
- ]
988
- }
989
- }
990
- ```
991
-
992
- In the new API, you'll need to step through `edges` & `nodes`:
993
-
994
- ```graphql
995
- {
996
- getPostsList {
997
- edges {
998
- node {
999
- id
1000
- }
1001
- }
1002
- }
1003
- }
1004
- ```
1005
-
1006
- ```json
1007
- {
1008
- "data": {
1009
- "getPostsList": {
1010
- "edges": [
1011
- {
1012
- "node": {
1013
- "id": "content/posts/voteForPedro.md"
1014
- }
1015
- }
1016
- ]
1017
- }
1018
- }
1019
- }
1020
- ```
1021
-
1022
- **Why?**
1023
-
1024
- The GraphQL connection spec opens up a more future-proof structure, allowing us to put more information in to the _connection_ itself like how many results have been returned, and how to request the next page of data.
1025
-
1026
- Read [a detailed explanation](https://graphql.org/learn/pagination/) of how the connection spec provides a richer set of capabilities.
1027
-
1028
- > Note: sorting and filtering is still not supported for list queries.
1029
-
1030
- ## `_body` is no longer included by default
1031
-
1032
- There is instead an `isBody` boolean which can be added to any `string` field
1033
-
1034
- **Why?**
1035
-
1036
- Since markdown files sort of have an implicit "body" to them, we were automatically populating a field which represented the body of your markdown file. This wasn't that useful, and kind of annoying. Instead, just attach `isBody` to the field which you want to represent your markdown "body":
1037
-
1038
- ```js
1039
- {
1040
- collections: [{
1041
- name: "post",
1042
- label: "Post",
1043
- path: "content/posts",
1044
- fields: [
1045
- {
1046
- name: "title",
1047
- label: "Title",
1048
- type: "string"
1049
- }
1050
- {
1051
- name: "myBody",
1052
- label: "My Body",
1053
- type: "string",
1054
- component: 'textarea',
1055
- isBody: true
1056
- }
1057
- ]
1058
- }]
1059
- }
1060
- ```
1061
-
1062
- This would result in a form field called `My Body` getting saved to the body of your markdown file (if you're using markdown):
1063
-
1064
- ```md
1065
- ---
1066
- title: Hello, World!
1067
- ---
1068
-
1069
- This is the body of the file, it's edited through the "My Body" field in your form.
1070
- ```
1071
-
1072
- ## References now point to more than one collection.
1073
-
1074
- Instead of a `collection` property, you must now define a `collections` field, which is an array:
1075
-
1076
- ```js
1077
- {
1078
- type: "reference",
1079
- label: "Author",
1080
- name: "author",
1081
- collections: ["author"]
1082
- }
1083
- ```
1084
-
1085
- ```graphql
1086
- {
1087
- getPostDocument(relativePath: "hello.md") {
1088
- data {
1089
- title
1090
- author {
1091
- ...on Author_Document {
1092
- name
1093
- }
1094
- ...on Post_Document {
1095
- title
1096
- }
1097
- }
1098
- }
1099
- }
1100
- ```
1101
-
1102
- ## Other breaking changes
1103
-
1104
- ### The `template` field on polymorphic objects (formerly _blocks_) is now `_template`
1105
-
1106
- **Old API:**
1107
-
1108
- ```md
1109
- ---
1110
- ---
1111
- myBlocks:
1112
- - template: hero
1113
- title: Hello
1114
- ---
1115
- ```
1116
-
1117
- **New API:**
1118
-
1119
- ```md
1120
- ---
1121
- ---
1122
- myBlocks:
1123
- - \_template: hero
1124
- title: Hello
1125
- ---
1126
- ```
1127
-
1128
- ### `data` `__typename` values have changed
1129
-
1130
- They now include the proper namespace to prevent naming collisions and no longer require `_Doc_Data` suffix. All generated `__typename` properties are going to be slightly different. We weren't fully namespacing fields so it wasn't possible to guarantee that no collisions would occur. The pain felt here will likely be most seen when querying and filtering through blocks. This ensures the stability of this type in the future
1131
-
1132
- ```graphql
1133
- {
1134
- getPageDocument(relativePath: "home.md") {
1135
- data {
1136
- title
1137
- myBlocks {
1138
- ...on Page_Hero_Data { # previously this would have been Hero_Data
1139
- # ...
1140
- }
1141
- }
1142
- }
1143
- }
1144
- ```
1145
-
1146
- - 33e27538: Init command now adds admin.tsx file to the users pages folder
1147
- - 8c8fc2ad: Init script now checks for file extention.
1148
-
1149
- ### Patch Changes
1150
-
1151
- - 5cd5ce76: - Improve types for ui field
1152
- - Marks system fields as required so the user has a guarantee that they'll be there
1153
- - Return null for listable fields which are null or undefined
1154
- - Handle null values for reference fields better
1155
- - Updated dependencies [fdb7724b]
1156
- - Updated dependencies [d42e2bcf]
1157
- - Updated dependencies [5cd5ce76]
1158
- - Updated dependencies [8c425440]
1159
- - Updated dependencies [7351d92f]
1160
- - tina-graphql@0.2.0
1161
- - tina-graphql-helpers@0.1.2
1162
-
1163
- ## 0.3.1
1164
-
1165
- ### Patch Changes
1166
-
1167
- - ebe77b21: added iframe to tina init generate page
1168
-
1169
- ## 0.3.0
1170
-
1171
- ### Minor Changes
1172
-
1173
- - fa3967b3: tina-gql init command now updates the users package.json with tina-dev scripts and adds a \_app.js files into the users project
1174
-
1175
- ## 0.2.60
1176
-
1177
- ### Patch Changes
1178
-
1179
- - c21bda17: Allow single command arguments to be passed in the sub command for the server:start command
1180
- - Updated dependencies [348ef1e5]
1181
- - tina-graphql@0.1.25
1182
-
1183
- ## 0.2.58
1184
-
1185
- ### Patch Changes
1186
-
1187
- - Updated dependencies [b36de960]
1188
- - tina-graphql@0.1.24
1189
-
1190
- ## 0.2.57
1191
-
1192
- ### Patch Changes
1193
-
1194
- - Bump packages to reflect new changest capabilities
1195
- - Updated dependencies [undefined]
1196
- - tina-graphql@0.1.23
1197
- - tina-graphql-helpers@0.1.1
1198
-
1199
- ## 0.2.56
1200
-
1201
- ### Patch Changes
1202
-
1203
- - Updated dependencies [undefined]
1204
- - tina-graphql-helpers@0.1.0
1205
- - tina-graphql@0.1.22
1206
-
1207
- ## 0.2.55
1208
-
1209
- ### Patch Changes
1210
-
1211
- - Updated dependencies [undefined]
1212
- - tina-graphql@0.1.21