removed tinacms, more headache then its worth. Easier to manually create files xD

This commit is contained in:
Hamza Ahmed
2023-11-16 19:25:04 +00:00
parent 867a05d76e
commit d112021b62
15 changed files with 3 additions and 13656 deletions
+3 -6
View File
@@ -2,7 +2,7 @@
FROM alpine as Builder
# install curl and git
RUN apk add --update curl git npm
RUN apk add --update curl git
# download and unnzip the hugo binary then place it in /usr/local/bin
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v0.120.3/hugo_0.120.3_linux-arm64.tar.gz > hugo.tar.gz && tar -zxf hugo.tar.gz && mv hugo /usr/local/bin
@@ -13,11 +13,8 @@ RUN git clone --recurse-submodules https://gitlab.com/AHMZA/blog.git
# set blog (the folder we just cloned) as the current DIR
WORKDIR blog
# install tinacli
RUN npm install @tinacms/cli
# build Tina and generate minifed hugo files
RUN npx @tinacms/cli@latest build && hugo --minify
# run hugo --minify to generate static files
hugo --minify
# Nginx image is as basic as we can get
-12557
View File
File diff suppressed because it is too large Load Diff
-16
View File
@@ -1,16 +0,0 @@
{
"name": "blog",
"version": "1.0.0",
"description": "## What This repository is where the blog is stored. Features of using gitlab: - version control - CI/CD pipelines - gitlab container image repository",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@tinacms/cli": "^1.5.31",
"tinacms": "^1.5.22"
}
}
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
{"DocumentConnection":{"type":"DocumentConnection","resolveType":"multiCollectionDocumentList","collections":["post","products"]},"Node":{"type":"Node","resolveType":"nodeDocument"},"DocumentNode":{"type":"DocumentNode","resolveType":"multiCollectionDocument","createDocument":"create","updateDocument":"update"},"Post":{"type":"Post","resolveType":"collectionDocument","collection":"post","createPost":"create","updatePost":"update"},"PostConnection":{"type":"PostConnection","resolveType":"collectionDocumentList","collection":"post"},"Products":{"type":"Products","resolveType":"collectionDocument","collection":"products","createProducts":"create","updateProducts":"update"},"ProductsConnection":{"type":"ProductsConnection","resolveType":"collectionDocumentList","collection":"products"}}
-1
View File
@@ -1 +0,0 @@
{"version":{"fullVersion":"1.4.27","major":"1","minor":"4","patch":"27"},"meta":{"flags":["experimentalData"]},"collections":[{"name":"post","label":"Posts","path":"content/posts","fields":[{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["post","title"],"searchable":true},{"type":"rich-text","name":"body","label":"Body","isBody":true,"namespace":["post","body"],"searchable":true,"parser":{"type":"markdown"}}],"namespace":["post"]},{"name":"products","label":"Products","path":"content/products","fields":[{"type":"string","name":"title","label":"Product Name","isTitle":true,"required":true,"namespace":["products","title"],"searchable":true},{"type":"string","name":"code","label":"Code","required":true,"namespace":["products","code"],"searchable":true},{"type":"string","name":"image","label":"Image URL","required":false,"namespace":["products","image"],"searchable":true},{"type":"rich-text","name":"description","label":"Description","isBody":true,"namespace":["products","description"],"searchable":true,"parser":{"type":"markdown"}}],"namespace":["products"]}],"config":{"media":{"tina":{"publicFolder":"static","mediaRoot":""}},"search":{"tina":{"indexerToken":"3ad8991708087bb81af5aa2bd79586afd6d847fb","stopwordLanguages":["eng"]},"indexBatchSize":100,"maxSearchIndexFieldLength":100}}}
-5
View File
@@ -1,5 +0,0 @@
import { createClient } from "tinacms/dist/client";
import { queries } from "./types";
export const client = createClient({ url: 'http://localhost:4001/graphql', token: 'e1040fd77966916ca7aa0b2480f9c6bbf865fe7d', queries, });
export default client;
-87
View File
@@ -1,87 +0,0 @@
// tina/config.ts
import { defineConfig } from "tinacms";
var branch = process.env.HEAD || process.env.VERCEL_GIT_COMMIT_REF || "main";
var config_default = defineConfig({
branch,
clientId: "f68869c9-46b7-4f70-bf52-46783f537a63",
// Get this from tina.io
token: "e1040fd77966916ca7aa0b2480f9c6bbf865fe7d",
// Get this from tina.io
build: {
outputFolder: "admin",
publicFolder: "static"
},
media: {
tina: {
mediaRoot: "",
publicFolder: "static"
}
},
schema: {
collections: [
{
name: "post",
label: "Posts",
path: "content/posts",
fields: [
{
type: "string",
name: "title",
label: "Title",
isTitle: true,
required: true
},
{
type: "rich-text",
name: "body",
label: "Body",
isBody: true
}
]
},
{
name: "products",
label: "Products",
path: "content/products",
fields: [
{
type: "string",
name: "title",
label: "Product Name",
isTitle: true,
required: true
},
{
type: "string",
name: "code",
label: "Code",
required: true
},
{
type: "string",
name: "image",
label: "Image URL",
required: false
},
{
type: "rich-text",
name: "description",
label: "Description",
isBody: true
}
]
}
]
},
search: {
tina: {
indexerToken: "3ad8991708087bb81af5aa2bd79586afd6d847fb",
stopwordLanguages: ["eng"]
},
indexBatchSize: 100,
maxSearchIndexFieldLength: 100
}
});
export {
config_default as default
};
-13
View File
@@ -1,13 +0,0 @@
fragment PostParts on Post {
__typename
title
body
}
fragment ProductsParts on Products {
__typename
title
code
image
description
}
-105
View File
@@ -1,105 +0,0 @@
query post($relativePath: String!) {
post(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...PostParts
}
}
query postConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: PostFilter) {
postConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...PostParts
}
}
}
}
query products($relativePath: String!) {
products(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...ProductsParts
}
}
query productsConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: ProductsFilter) {
productsConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...ProductsParts
}
}
}
}
-194
View File
@@ -1,194 +0,0 @@
# DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
"""References another document, used as a foreign key"""
scalar Reference
""""""
scalar JSON
type SystemInfo {
filename: String!
title: String
basename: String!
breadcrumbs(excludeExtension: Boolean): [String!]!
path: String!
relativePath: String!
extension: String!
template: String!
collection: Collection!
}
type Folder {
name: String!
path: String!
}
type PageInfo {
hasPreviousPage: Boolean!
hasNextPage: Boolean!
startCursor: String!
endCursor: String!
}
""""""
interface Node {
id: ID!
}
""""""
interface Document {
id: ID!
_sys: SystemInfo
_values: JSON!
}
"""A relay-compliant pagination connection"""
interface Connection {
totalCount: Float!
pageInfo: PageInfo!
}
type Query {
getOptimizedQuery(queryString: String!): String
collection(collection: String): Collection!
collections: [Collection!]!
node(id: String): Node!
document(collection: String, relativePath: String): DocumentNode!
post(relativePath: String): Post!
postConnection(before: String, after: String, first: Float, last: Float, sort: String, filter: PostFilter): PostConnection!
products(relativePath: String): Products!
productsConnection(before: String, after: String, first: Float, last: Float, sort: String, filter: ProductsFilter): ProductsConnection!
}
input DocumentFilter {
post: PostFilter
products: ProductsFilter
}
type DocumentConnectionEdges {
cursor: String!
node: DocumentNode
}
type DocumentConnection implements Connection {
pageInfo: PageInfo!
totalCount: Float!
edges: [DocumentConnectionEdges]
}
type Collection {
name: String!
slug: String!
label: String
path: String!
format: String
matches: String
templates: [JSON]
fields: [JSON]
documents(before: String, after: String, first: Float, last: Float, sort: String, filter: DocumentFilter, folder: String): DocumentConnection!
}
union DocumentNode = Post | Products | Folder
type Post implements Node & Document {
title: String!
body: JSON
id: ID!
_sys: SystemInfo!
_values: JSON!
}
input StringFilter {
startsWith: String
eq: String
exists: Boolean
in: [String]
}
input RichTextFilter {
startsWith: String
eq: String
exists: Boolean
}
input PostFilter {
title: StringFilter
body: RichTextFilter
}
type PostConnectionEdges {
cursor: String!
node: Post
}
type PostConnection implements Connection {
pageInfo: PageInfo!
totalCount: Float!
edges: [PostConnectionEdges]
}
type Products implements Node & Document {
title: String!
code: String!
image: String
description: JSON
id: ID!
_sys: SystemInfo!
_values: JSON!
}
input ProductsFilter {
title: StringFilter
code: StringFilter
image: StringFilter
description: RichTextFilter
}
type ProductsConnectionEdges {
cursor: String!
node: Products
}
type ProductsConnection implements Connection {
pageInfo: PageInfo!
totalCount: Float!
edges: [ProductsConnectionEdges]
}
type Mutation {
addPendingDocument(collection: String!, relativePath: String!, template: String): DocumentNode!
updateDocument(collection: String, relativePath: String!, params: DocumentUpdateMutation!): DocumentNode!
deleteDocument(collection: String, relativePath: String!): DocumentNode!
createDocument(collection: String, relativePath: String!, params: DocumentMutation!): DocumentNode!
updatePost(relativePath: String!, params: PostMutation!): Post!
createPost(relativePath: String!, params: PostMutation!): Post!
updateProducts(relativePath: String!, params: ProductsMutation!): Products!
createProducts(relativePath: String!, params: ProductsMutation!): Products!
}
input DocumentUpdateMutation {
post: PostMutation
products: ProductsMutation
relativePath: String
}
input DocumentMutation {
post: PostMutation
products: ProductsMutation
}
input PostMutation {
title: String
body: JSON
}
input ProductsMutation {
title: String
code: String
image: String
description: JSON
}
schema {
query: Query
mutation: Mutation
}
-1
View File
@@ -1 +0,0 @@
[]
-582
View File
@@ -1,582 +0,0 @@
//@ts-nocheck
// DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
export function gql(strings: TemplateStringsArray, ...args: string[]): string {
let str = ''
strings.forEach((string, i) => {
str += string + (args[i] || '')
})
return str
}
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: { input: string; output: string; }
String: { input: string; output: string; }
Boolean: { input: boolean; output: boolean; }
Int: { input: number; output: number; }
Float: { input: number; output: number; }
/** References another document, used as a foreign key */
Reference: { input: any; output: any; }
JSON: { input: any; output: any; }
};
export type SystemInfo = {
__typename?: 'SystemInfo';
filename: Scalars['String']['output'];
title?: Maybe<Scalars['String']['output']>;
basename: Scalars['String']['output'];
breadcrumbs: Array<Scalars['String']['output']>;
path: Scalars['String']['output'];
relativePath: Scalars['String']['output'];
extension: Scalars['String']['output'];
template: Scalars['String']['output'];
collection: Collection;
};
export type SystemInfoBreadcrumbsArgs = {
excludeExtension?: InputMaybe<Scalars['Boolean']['input']>;
};
export type Folder = {
__typename?: 'Folder';
name: Scalars['String']['output'];
path: Scalars['String']['output'];
};
export type PageInfo = {
__typename?: 'PageInfo';
hasPreviousPage: Scalars['Boolean']['output'];
hasNextPage: Scalars['Boolean']['output'];
startCursor: Scalars['String']['output'];
endCursor: Scalars['String']['output'];
};
export type Node = {
id: Scalars['ID']['output'];
};
export type Document = {
id: Scalars['ID']['output'];
_sys?: Maybe<SystemInfo>;
_values: Scalars['JSON']['output'];
};
/** A relay-compliant pagination connection */
export type Connection = {
totalCount: Scalars['Float']['output'];
pageInfo: PageInfo;
};
export type Query = {
__typename?: 'Query';
getOptimizedQuery?: Maybe<Scalars['String']['output']>;
collection: Collection;
collections: Array<Collection>;
node: Node;
document: DocumentNode;
post: Post;
postConnection: PostConnection;
products: Products;
productsConnection: ProductsConnection;
};
export type QueryGetOptimizedQueryArgs = {
queryString: Scalars['String']['input'];
};
export type QueryCollectionArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
};
export type QueryNodeArgs = {
id?: InputMaybe<Scalars['String']['input']>;
};
export type QueryDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type QueryPostArgs = {
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type QueryPostConnectionArgs = {
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<PostFilter>;
};
export type QueryProductsArgs = {
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type QueryProductsConnectionArgs = {
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<ProductsFilter>;
};
export type DocumentFilter = {
post?: InputMaybe<PostFilter>;
products?: InputMaybe<ProductsFilter>;
};
export type DocumentConnectionEdges = {
__typename?: 'DocumentConnectionEdges';
cursor: Scalars['String']['output'];
node?: Maybe<DocumentNode>;
};
export type DocumentConnection = Connection & {
__typename?: 'DocumentConnection';
pageInfo: PageInfo;
totalCount: Scalars['Float']['output'];
edges?: Maybe<Array<Maybe<DocumentConnectionEdges>>>;
};
export type Collection = {
__typename?: 'Collection';
name: Scalars['String']['output'];
slug: Scalars['String']['output'];
label?: Maybe<Scalars['String']['output']>;
path: Scalars['String']['output'];
format?: Maybe<Scalars['String']['output']>;
matches?: Maybe<Scalars['String']['output']>;
templates?: Maybe<Array<Maybe<Scalars['JSON']['output']>>>;
fields?: Maybe<Array<Maybe<Scalars['JSON']['output']>>>;
documents: DocumentConnection;
};
export type CollectionDocumentsArgs = {
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<DocumentFilter>;
folder?: InputMaybe<Scalars['String']['input']>;
};
export type DocumentNode = Post | Products | Folder;
export type Post = Node & Document & {
__typename?: 'Post';
title: Scalars['String']['output'];
body?: Maybe<Scalars['JSON']['output']>;
id: Scalars['ID']['output'];
_sys: SystemInfo;
_values: Scalars['JSON']['output'];
};
export type StringFilter = {
startsWith?: InputMaybe<Scalars['String']['input']>;
eq?: InputMaybe<Scalars['String']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
};
export type RichTextFilter = {
startsWith?: InputMaybe<Scalars['String']['input']>;
eq?: InputMaybe<Scalars['String']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
};
export type PostFilter = {
title?: InputMaybe<StringFilter>;
body?: InputMaybe<RichTextFilter>;
};
export type PostConnectionEdges = {
__typename?: 'PostConnectionEdges';
cursor: Scalars['String']['output'];
node?: Maybe<Post>;
};
export type PostConnection = Connection & {
__typename?: 'PostConnection';
pageInfo: PageInfo;
totalCount: Scalars['Float']['output'];
edges?: Maybe<Array<Maybe<PostConnectionEdges>>>;
};
export type Products = Node & Document & {
__typename?: 'Products';
title: Scalars['String']['output'];
code: Scalars['String']['output'];
image?: Maybe<Scalars['String']['output']>;
description?: Maybe<Scalars['JSON']['output']>;
id: Scalars['ID']['output'];
_sys: SystemInfo;
_values: Scalars['JSON']['output'];
};
export type ProductsFilter = {
title?: InputMaybe<StringFilter>;
code?: InputMaybe<StringFilter>;
image?: InputMaybe<StringFilter>;
description?: InputMaybe<RichTextFilter>;
};
export type ProductsConnectionEdges = {
__typename?: 'ProductsConnectionEdges';
cursor: Scalars['String']['output'];
node?: Maybe<Products>;
};
export type ProductsConnection = Connection & {
__typename?: 'ProductsConnection';
pageInfo: PageInfo;
totalCount: Scalars['Float']['output'];
edges?: Maybe<Array<Maybe<ProductsConnectionEdges>>>;
};
export type Mutation = {
__typename?: 'Mutation';
addPendingDocument: DocumentNode;
updateDocument: DocumentNode;
deleteDocument: DocumentNode;
createDocument: DocumentNode;
updatePost: Post;
createPost: Post;
updateProducts: Products;
createProducts: Products;
};
export type MutationAddPendingDocumentArgs = {
collection: Scalars['String']['input'];
relativePath: Scalars['String']['input'];
template?: InputMaybe<Scalars['String']['input']>;
};
export type MutationUpdateDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath: Scalars['String']['input'];
params: DocumentUpdateMutation;
};
export type MutationDeleteDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath: Scalars['String']['input'];
};
export type MutationCreateDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath: Scalars['String']['input'];
params: DocumentMutation;
};
export type MutationUpdatePostArgs = {
relativePath: Scalars['String']['input'];
params: PostMutation;
};
export type MutationCreatePostArgs = {
relativePath: Scalars['String']['input'];
params: PostMutation;
};
export type MutationUpdateProductsArgs = {
relativePath: Scalars['String']['input'];
params: ProductsMutation;
};
export type MutationCreateProductsArgs = {
relativePath: Scalars['String']['input'];
params: ProductsMutation;
};
export type DocumentUpdateMutation = {
post?: InputMaybe<PostMutation>;
products?: InputMaybe<ProductsMutation>;
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type DocumentMutation = {
post?: InputMaybe<PostMutation>;
products?: InputMaybe<ProductsMutation>;
};
export type PostMutation = {
title?: InputMaybe<Scalars['String']['input']>;
body?: InputMaybe<Scalars['JSON']['input']>;
};
export type ProductsMutation = {
title?: InputMaybe<Scalars['String']['input']>;
code?: InputMaybe<Scalars['String']['input']>;
image?: InputMaybe<Scalars['String']['input']>;
description?: InputMaybe<Scalars['JSON']['input']>;
};
export type PostPartsFragment = { __typename: 'Post', title: string, body?: any | null };
export type ProductsPartsFragment = { __typename: 'Products', title: string, code: string, image?: string | null, description?: any | null };
export type PostQueryVariables = Exact<{
relativePath: Scalars['String']['input'];
}>;
export type PostQuery = { __typename?: 'Query', post: { __typename: 'Post', id: string, title: string, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } };
export type PostConnectionQueryVariables = Exact<{
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<PostFilter>;
}>;
export type PostConnectionQuery = { __typename?: 'Query', postConnection: { __typename?: 'PostConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string, endCursor: string }, edges?: Array<{ __typename?: 'PostConnectionEdges', cursor: string, node?: { __typename: 'Post', id: string, title: string, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } | null } | null> | null } };
export type ProductsQueryVariables = Exact<{
relativePath: Scalars['String']['input'];
}>;
export type ProductsQuery = { __typename?: 'Query', products: { __typename: 'Products', id: string, title: string, code: string, image?: string | null, description?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } };
export type ProductsConnectionQueryVariables = Exact<{
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<ProductsFilter>;
}>;
export type ProductsConnectionQuery = { __typename?: 'Query', productsConnection: { __typename?: 'ProductsConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string, endCursor: string }, edges?: Array<{ __typename?: 'ProductsConnectionEdges', cursor: string, node?: { __typename: 'Products', id: string, title: string, code: string, image?: string | null, description?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } | null } | null> | null } };
export const PostPartsFragmentDoc = gql`
fragment PostParts on Post {
__typename
title
body
}
`;
export const ProductsPartsFragmentDoc = gql`
fragment ProductsParts on Products {
__typename
title
code
image
description
}
`;
export const PostDocument = gql`
query post($relativePath: String!) {
post(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...PostParts
}
}
${PostPartsFragmentDoc}`;
export const PostConnectionDocument = gql`
query postConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: PostFilter) {
postConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...PostParts
}
}
}
}
${PostPartsFragmentDoc}`;
export const ProductsDocument = gql`
query products($relativePath: String!) {
products(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...ProductsParts
}
}
${ProductsPartsFragmentDoc}`;
export const ProductsConnectionDocument = gql`
query productsConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: ProductsFilter) {
productsConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
breadcrumbs
path
relativePath
extension
}
id
}
...ProductsParts
}
}
}
}
${ProductsPartsFragmentDoc}`;
export type Requester<C= {}> = <R, V>(doc: DocumentNode, vars?: V, options?: C) => Promise<R>
export function getSdk<C>(requester: Requester<C>) {
return {
post(variables: PostQueryVariables, options?: C): Promise<{data: PostQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostQueryVariables, query: string}> {
return requester<{data: PostQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostQueryVariables, query: string}, PostQueryVariables>(PostDocument, variables, options);
},
postConnection(variables?: PostConnectionQueryVariables, options?: C): Promise<{data: PostConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostConnectionQueryVariables, query: string}> {
return requester<{data: PostConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostConnectionQueryVariables, query: string}, PostConnectionQueryVariables>(PostConnectionDocument, variables, options);
},
products(variables: ProductsQueryVariables, options?: C): Promise<{data: ProductsQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: ProductsQueryVariables, query: string}> {
return requester<{data: ProductsQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: ProductsQueryVariables, query: string}, ProductsQueryVariables>(ProductsDocument, variables, options);
},
productsConnection(variables?: ProductsConnectionQueryVariables, options?: C): Promise<{data: ProductsConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: ProductsConnectionQueryVariables, query: string}> {
return requester<{data: ProductsConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: ProductsConnectionQueryVariables, query: string}, ProductsConnectionQueryVariables>(ProductsConnectionDocument, variables, options);
}
};
}
export type Sdk = ReturnType<typeof getSdk>;
// TinaSDK generated code
import { createClient, TinaClient } from "tinacms/dist/client";
const generateRequester = (
client: TinaClient,
options?: { branch?: string }
) => {
const requester: (
doc: any,
vars?: any,
options?: { branch?: string },
client
) => 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, errors: data?.errors, query: doc, variables: vars || {} }
}
return requester
}
/**
* @experimental this class can be used but may change in the future
**/
export const ExperimentalGetTinaClient = () =>
getSdk(
generateRequester(
createClient({
url: "http://localhost:4001/graphql",
queries,
})
)
)
export const queries = (
client: TinaClient,
options?: {
branch?: string
}
) => {
const requester = generateRequester(client, options)
return getSdk(requester)
}
-86
View File
@@ -1,86 +0,0 @@
import { defineConfig } from "tinacms";
// Your hosting provider likely exposes this as an environment variable
const branch = process.env.HEAD || process.env.VERCEL_GIT_COMMIT_REF || "main";
export default defineConfig({
branch,
clientId: $TINA_CID, // Get this from tina.io
token: $TINA_TOKEN, // Get this from tina.io
build: {
outputFolder: "admin",
publicFolder: "static",
},
media: {
tina: {
mediaRoot: "",
publicFolder: "static",
},
},
schema: {
collections: [
{
name: "post",
label: "Posts",
path: "content/posts",
fields: [
{
type: "string",
name: "title",
label: "Title",
isTitle: true,
required: true,
},
{
type: "rich-text",
name: "body",
label: "Body",
isBody: true,
},
],
},
{
name: "products",
label: "Products",
path: "content/products",
fields: [
{
type: "string",
name: "title",
label: "Product Name",
isTitle: true,
required: true,
},
{
type: "string",
name: "code",
label: "Code",
required: true,
},
{
type: "string",
name: "image",
label: "Image URL",
required: false,
},
{
type: "rich-text",
name: "description",
label: "Description",
isBody: true,
},
]
},
],
},
search: {
tina: {
indexerToken: '3ad8991708087bb81af5aa2bd79586afd6d847fb',
stopwordLanguages: ['eng']
},
indexBatchSize: 100,
maxSearchIndexFieldLength: 100
},
});
File diff suppressed because one or more lines are too long