Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into add-static-media
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsee55 committed Aug 1, 2023
2 parents 6672cfb + 6382576 commit 8333626
Show file tree
Hide file tree
Showing 365 changed files with 1,634 additions and 4,765 deletions.
5 changes: 0 additions & 5 deletions .changeset/lemon-pots-float.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/metal-rats-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tinacms/mdx': patch
---

Ensure urls are sanitized in a tags for rich-text
5 changes: 5 additions & 0 deletions .changeset/olive-beers-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tinacms/cli': patch
---

Adds ability to specify branch name in the request for the autogenerated client
5 changes: 5 additions & 0 deletions .changeset/perfect-readers-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tinacms/mdx': patch
---

Fix issue where non-object lists weren't handled properly for rich-text embeds
1 change: 0 additions & 1 deletion .changeset/sour-zebras-crash.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
'@tinacms/toolkit': patch
'tinacms': patch
---

Expand Down
15 changes: 15 additions & 0 deletions .changeset/wet-islands-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'next-tinacms-cloudinary': patch
'@tinacms/scripts': patch
'next-tinacms-dos': patch
'next-tinacms-s3': patch
'@tinacms/app': patch
'@tinacms/cli': patch
'tinacms': patch
---

Absorb @tinacms/toolkit into tinacms

fix: Use clean page-sizes on media manager (to make pagination more obvious)

Fix issue with uploading media in a folder with tina cloud
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ terraform/**/.terraform
# Ignore any .next folder
**/.next/**
examples/hugo-quickstart
**/out.md
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[![GitHub license](https://img.shields.io/github/license/tinacms/tinacms?color=blue)](https://github.com/tinacms/tinacms/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/tinacms.svg?style=flat)](https://www.npmjs.com/package/tinacms) ![Status](https://github.com/tinacms/tinacms/workflows/Build,%20Test,%20Lint%20for%20Master/badge.svg)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-103-orange.svg?style=flat-square)](#contributors-)
[![GitHub license](https://img.shields.io/github/license/tinacms/tinacms?color=blue)](https://github.com/tinacms/tinacms/blob/main/LICENSE)
[![npm version](https://img.shields.io/npm/v/tinacms.svg?style=flat)](https://www.npmjs.com/package/tinacms)
[![Build, Test, Lint for Main](https://github.com/tinacms/tinacms/actions/workflows/main.yml/badge.svg?branch=main&event=push)](https://github.com/tinacms/tinacms/actions/workflows/main.yml)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/github/all-contributors/tinacms/tinacms?color=ec4815)](#contributors)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

# [![TINA CMS](https://res.cloudinary.com/forestry-demo/image/upload/v1585234360/TinaCMS/TinaCMS.png 'Visit tinacms.org')](https://tina.io)
Expand Down Expand Up @@ -45,7 +51,6 @@ Please see our [./CONTRIBUTING.md](https://github.com/tinacms/tinacms/blob/main/
- Kelly Davis ([@kldavis](https://github.com/kldavis4)) - Forestry.io
- James O'Halloran ([@jamespohalloran](https://github.com/jamespohalloran)) - Forestry.io


### All Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ import { Container } from '../util/container'
import { Section } from '../util/section'
import { useTheme } from '../layout'
import format from 'date-fns/format'
import { TinaMarkdown } from 'tinacms/dist/rich-text'
import { TinaMarkdown } from 'tinacms/rich-text'
import { Prism } from 'tinacms/dist/rich-text/prism'
import type { TinaMarkdownContent, Components } from 'tinacms/dist/rich-text'
import { PostType } from '../../pages/posts/[filename]'
import { tinaField } from 'tinacms/dist/react'
import { tinaField } from 'tinacms/react'

console.log('hihih', TinaMarkdown)

const components: Components<{
BlockQuote: {
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"format": "prettier --write .",
"postinstall": "husky install"
},
"dependencies": {
"devDependencies": {
"@changesets/cli": "^2.26.0",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
Expand All @@ -40,9 +40,7 @@
"prettier": "^2.8.4",
"pretty-quick": "^3.1.3",
"typescript": "4.3.5",
"workspace": "^0.0.1-preview.1"
},
"devDependencies": {
"workspace": "^0.0.1-preview.1",
"@types/jest": "^27.5.2",
"cypress": "9.7.0",
"husky": "^7.0.4",
Expand Down
1 change: 0 additions & 1 deletion packages/@tinacms/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@heroicons/react": "1.0.6",
"@monaco-editor/react": "4.4.5",
"@tinacms/mdx": "workspace:*",
"@tinacms/toolkit": "workspace:*",
"@xstate/react": "3.0.0",
"final-form": "4.20.7",
"graphiql": "3.0.0-alpha.1",
Expand Down
47 changes: 33 additions & 14 deletions packages/@tinacms/cli/src/next/codegen/codegen/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,55 @@ export const AddGeneratedClientFunc: (apiURL: string) => PluginFunction = (
// TinaSDK generated code
import { createClient, TinaClient } from "tinacms/dist/client";
const generateRequester = (client: TinaClient) => {
const generateRequester = (
client: TinaClient,
options?: { branch?: string }
) => {
const requester: (
doc: any,
vars?: any,
options?: any,
options?: { branch?: string },
client
) => Promise<any> = async (doc, vars, _options) => {
) => Promise<any> = async (doc, vars, options) => {
let url = client.apiUrl
if (options?.branch) {
const index = client.apiUrl.lastIndexOf('/')
url = client.apiUrl.substring(0, index + 1) + options.branch
}
const data = await client.request({
query: doc,
variables: vars,
});
url,
})
return { data: data?.data, query: doc, variables: vars || {} };
};
return { data: data?.data, query: doc, variables: vars || {} }
}
return requester;
};
return requester
}
/**
* @experimental this class can be used but may change in the future
**/
export const ExperimentalGetTinaClient = () =>
getSdk(
generateRequester(createClient({ url: "${apiURL}", queries }))
);
generateRequester(
createClient({
url: "${apiURL}",
queries,
})
)
)
export const queries = (client: TinaClient) => {
const requester = generateRequester(client);
return getSdk(requester);
};
export const queries = (
client: TinaClient,
options?: {
branch?: string
}
) => {
const requester = generateRequester(client, options)
return getSdk(requester)
}
`
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@tinacms/cli/src/next/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const createConfig = async ({
appType: 'spa',
resolve: {
alias,
dedupe: ['graphql', 'tinacms', '@tinacms/toolkit', 'react', 'react-dom'],
dedupe: ['graphql', 'tinacms', 'react', 'react-dom'],
},
define: {
/**
Expand Down Expand Up @@ -240,7 +240,7 @@ export const createConfig = async ({
},
plugins: [
/**
* `splitVendorChunkPlugin` is needed because `tinacms` and `@tinacms/toolkit` are quite large,
* `splitVendorChunkPlugin` is needed because `tinacms` is quite large,
* Vite's chunking strategy chokes on memory issues for smaller machines (ie. on CI).
*/
react({
Expand Down
59 changes: 59 additions & 0 deletions packages/@tinacms/mdx/src/next/tests/mdx-table-like-field/field.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { RichTextField } from '@tinacms/schema-tools'

export const field: RichTextField = {
name: 'body',
type: 'rich-text',
parser: { type: 'mdx' },
templates: [
{
name: 'TestComponent',
label: 'Test component',
fields: [
{
label: 'Rows',
name: 'rows',
type: 'object',
list: true,
fields: [
{
label: 'Cells',
name: 'celss',
list: true,
type: 'string',
},
{
label: 'Is Header',
name: 'isHeader',
type: 'boolean',
},
],
},
],
},
{
name: 'TestComponent2',
label: 'Test component 2',
fields: [
{
label: 'Rows',
name: 'rows',
type: 'object',
list: true,
fields: [
{
label: 'Cells',
name: 'celss',
list: true,
type: 'number',
},
{
label: 'Is Header',
name: 'isHeader',
type: 'boolean',
},
],
},
],
},
],
}
15 changes: 15 additions & 0 deletions packages/@tinacms/mdx/src/next/tests/mdx-table-like-field/in.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Welcome to the barebones starter for TinaCMS!

<TestComponent
rows={[
{ celss: ["Three", "Two", "One"], isHeader: true },
{ celss: ["C", "B", "A"] }
]}
/>

<TestComponent
rows={[
{ celss: [1,2,3], isHeader: true },
{ celss: [4,5,6] }
]}
/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { it, expect } from 'vitest'
import { parseMDX } from '../../../parse'
import { stringifyMDX } from '../../../stringify'
import { field } from './field'
import input from './in.md?raw'
import * as util from '../util'

it('matches input', () => {
const tree = parseMDX(input, field, (v) => v)
expect(util.print(tree)).toMatchFile(util.nodePath(__dirname))
const string = stringifyMDX(tree, field, (v) => v)
expect(string).toMatchFile(util.mdPath(__dirname))
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"type": "root",
"children": [
{
"type": "p",
"children": [
{
"type": "text",
"text": "Welcome to the barebones starter for TinaCMS!"
}
]
},
{
"type": "mdxJsxFlowElement",
"name": "TestComponent",
"children": [
{
"type": "text",
"text": ""
}
],
"props": {
"rows": [
{
"celss": [
"Three",
"Two",
"One"
],
"isHeader": true
},
{
"celss": [
"C",
"B",
"A"
]
}
]
}
},
{
"type": "mdxJsxFlowElement",
"name": "TestComponent",
"children": [
{
"type": "text",
"text": ""
}
],
"props": {
"rows": [
{
"celss": [
1,
2,
3
],
"isHeader": true
},
{
"celss": [
4,
5,
6
]
}
]
}
}
]
}
10 changes: 10 additions & 0 deletions packages/@tinacms/mdx/src/next/tests/mdx-table-like-field/out.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Welcome to the barebones starter for TinaCMS!

<TestComponent
rows={[
{ celss: ["Three", "Two", "One"], isHeader: true },
{ celss: ["C", "B", "A"] }
]}
/>

<TestComponent rows={[{ celss: [1, 2, 3], isHeader: true }, { celss: [4, 5, 6] }]} />
8 changes: 8 additions & 0 deletions packages/@tinacms/mdx/src/parse/acorn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ const extractKeyValue = (
const value = extractObjectExpression(property.value, field)
return { key, value }
}
} else if (field?.list) {
assertType(property.value, 'ArrayExpression')
const value = property.value.elements.map((element) => {
assertHasType(element)
assertType(element, 'Literal')
return element.value
})
return { key, value }
} else {
assertType(property.value, 'Literal')
return { key, value: property.value.value }
Expand Down

0 comments on commit 8333626

Please sign in to comment.