@tinacms/cli 0.60.23 → 0.60.26

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