- Updated dependencies [216cfff0c]
- tinacms@1.6.1
- Updated dependencies [c8ceba4d8]
- tinacms@1.6.0
- Updated dependencies [04704e3dc]
- tinacms@1.5.30
- tinacms@1.5.29
- tinacms@1.5.28
- Updated dependencies [4202c1028]
- Updated dependencies [64f8fa038]
- Updated dependencies [548fe6d96]
- Updated dependencies [50b20f809]
- tinacms@1.5.27
- Updated dependencies [9e1a22a53]
- tinacms@1.5.26
- tinacms@1.5.25
-
a65ca13f2: ## TinaCMS Self hosted Updates
- Deprecated:
onPut
,onDelete
, andlevel
arguments increateDatabase
. - Added:
databaseAdapter
to replacelevel
. - Added:
gitProvider
to substituteonPut
andonDelete
. - New Package:
tinacms-gitprovider-github
, exporting theGitHubProvider
class. - Interface Addition:
gitProvider
added to@tinacms/graphql
. - Addition: Generated database client.
import { createDatabase, createLocalDatabase } from '@tinacms/datalayer' import { MongodbLevel } from 'mongodb-level' import { GitHubProvider } from 'tinacms-gitprovider-github' const isLocal = process.env.TINA_PUBLIC_IS_LOCAL === 'true' export default isLocal ? createLocalDatabase() : createDatabase({ gitProvider: new GitHubProvider({ branch: process.env.GITHUB_BRANCH, owner: process.env.GITHUB_OWNER, repo: process.env.GITHUB_REPO, token: process.env.GITHUB_PERSONAL_ACCESS_TOKEN, }), databaseAdapter: new MongodbLevel<string, Record<string, any>>({ collectionName: 'tinacms', dbName: 'tinacms', mongoUri: process.env.MONGODB_URI, }), namespace: process.env.GITHUB_BRANCH, })
- GitHubProvider Usage: Replace
onPut
andonDelete
withgitProvider
, using the providedGitHubProvider
for GitHub.
const gitProvider = new GitHubProvider({ branch: process.env.GITHUB_BRANCH, owner: process.env.GITHUB_OWNER, repo: process.env.GITHUB_REPO, token: process.env.GITHUB_PERSONAL_ACCESS_TOKEN, })
- Custom Git Provider: Implement the
GitProvider
interface for different git providers.
If you are not using Github as your git provider, you can implement the
GitProvider
interface to use your own git provider.class CustomGitProvider implements GitProvider async onPut(key: string, value: string) // ... async onDelete(key: string) // ... const gitProvider = new CustomGitProvider();
- Renaming in Code: Change
level
todatabaseAdapter
for clarity.
createDatabase({ - level: new MongodbLevel<string, Record<string, any>>(...), + databaseAdapter: new MongodbLevel<string, Record<string, any>>(...), })
- Usage: Implement a local database with the
createLocalDatabase
function.
import { createLocalDatabase } from '@tinacms/datalayer' createLocalDatabase(port)
- Updated
database.{ts,js}
File:
import { createDatabase, createLocalDatabase, GitHubProvider } from '@tinacms/datalayer'; import { MongodbLevel } from 'mongodb-level'; const isLocal = process.env.TINA_PUBLIC_IS_LOCAL === 'true'; export default isLocal ? createLocalDatabase() : createDatabase({ gitProvider: new GitHubProvider(...), databaseAdapter: new MongodbLevel<string, Record<string, any>>(...), });
- New:
authProvider
indefineConfig
. - Class:
AbstractAuthProvider
for extending new auth providers. - Clerk Auth Provider: New provider added.
- Renaming:
admin.auth
toadmin.authHooks
. - Deprecation:
admin.auth
.
- Transition: From auth functions to
authProvider
class.
- Previous API:
defineConfig({ admin: { auth: { login() {}, logout() {}, //... }, }, //... })
- New API:
import { AbstractAuthProvider } from 'tinacms' class CustomAuthProvider extends AbstractAuthProvider { login() {} logout() {} //... } defineConfig({ authProvider: new CustomAuthProvider(), //... })
-
New: TinaNodeBackend is exported from
@tinacms/datalayer
. This is used to host the TinaCMS backend in a single function. -
New:
LocalBackendAuthProvider
is exported from@tinacms/datalayer
. This is used to host the TinaCMS backend locally. -
New:
AuthJsBackendAuthProvider
is exported fromtinacms-authjs
. This is used to host the TinaCMS backend with AuthJS.
Now, instead of hosting the in /tina/api/gql.ts file, the entire TinaCMS backend (including auth) will be hosted in a single backend function.
/api/tina/[...routes].{ts,js}
import { TinaNodeBackend, LocalBackendAuthProvider } from '@tinacms/datalayer' import { TinaAuthJSOptions, AuthJsBackendAuthProvider } from 'tinacms-authjs' import databaseClient from '../../../tina/__generated__/databaseClient' const isLocal = process.env.TINA_PUBLIC_IS_LOCAL === 'true' const handler = TinaNodeBackend({ authProvider: isLocal ? LocalBackendAuthProvider() : AuthJsBackendAuthProvider({ authOptions: TinaAuthJSOptions({ databaseClient: databaseClient, secret: process.env.NEXTAUTH_SECRET, }), }), databaseClient, }) export default (req, res) => { // Modify the request here if you need to return handler(req, res) }
These changes are put in place to make self hosted TinaCMS easier to use and more flexible.
Please check out the docs for more information on self hosted TinaCMS.
- Deprecated:
- Updated dependencies [a65ca13f2]
- tinacms@1.5.24