Skip to content

Commit

Permalink
Clean up the alinea package exports. Deprecate the createNextCMS func…
Browse files Browse the repository at this point in the history
…tion and move it to 'alinea/next'.
  • Loading branch information
benmerckx committed Jan 31, 2024
1 parent dff268e commit 4f83e78
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 40 deletions.
2 changes: 1 addition & 1 deletion apps/demo/src/cms.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createNextCMS} from 'alinea'
import {createNextCMS} from 'alinea/next'
import {config} from '../alinea.config'

export const cms = createNextCMS(config)
5 changes: 3 additions & 2 deletions apps/web/src/cms.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import alinea, {createNextCMS} from 'alinea'
import alinea from 'alinea'
import {createCMS} from 'alinea/next'
import * as schema from './schema'

const pages = alinea.root('Pages', {
Expand Down Expand Up @@ -34,4 +35,4 @@ const config = alinea.config({
: '/api/preview'
})

export const cms = createNextCMS(config)
export const cms = createCMS(config)
17 changes: 16 additions & 1 deletion src/alinea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@ export {
type,
workspace
} from 'alinea/core'

// Types

export {Root, Workspace} from 'alinea/core'
export type {Config, Infer, Schema, TextDoc, Type} from 'alinea/core'
export type {
EntryReference,
FileReference,
ImageReference
} from 'alinea/picker/entry/EntryReference'
export type {UrlReference} from 'alinea/picker/url'

// Helpers
export type {Infer as infer} from 'alinea/core'
// Default inputs
export {document} from 'alinea/core/Document'
export {createMediaRoot as media} from 'alinea/core/media/MediaRoot'

// Included inputs
export * from './input.js'
24 changes: 11 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// Config creation
export {Root, Workspace} from 'alinea/core'
export type {Config, Infer, Schema, TextDoc, Type} from 'alinea/core'
export * from 'alinea/core/driver/DefaultDriver'
export * from 'alinea/core/driver/NextDriver'
export {alinea}
export * from './alinea.js'
import * as alinea from './alinea.js'
export default alinea
export type {
EntryReference,
FileReference,
ImageReference
} from 'alinea/picker/entry/EntryReference'
export type {UrlReference} from 'alinea/picker/url'

export {alinea as default}

// Next CMS constructor - deprecated
import {createNextCMS as _createNextCMS} from 'alinea/core/driver/NextDriver'
export {createNextCMS}
/** @deprecated Use import {createCMS} from 'alinea/next' instead */
const createNextCMS = _createNextCMS

export * from 'alinea/core/driver/DefaultDriver'
44 changes: 21 additions & 23 deletions src/input.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
// Included inputs
export {document} from 'alinea/core/Document'
export {check} from 'alinea/input/check'
export {code} from 'alinea/input/code'
export {date} from 'alinea/input/date'
export {json} from 'alinea/input/json'
export {link} from 'alinea/input/link'
export {list} from 'alinea/input/list'
export {metadata} from 'alinea/input/metadata'
export {number} from 'alinea/input/number'
export {object} from 'alinea/input/object'
export {path} from 'alinea/input/path'
export {richText} from 'alinea/input/richtext'
export {select} from 'alinea/input/select'
export {tab, tabs} from 'alinea/input/tabs'
export {text} from 'alinea/input/text'
export {view} from 'alinea/input/view'

import {link} from 'alinea/input/link'
export const entry = link.entry
export const image = link.image
export const file = link.file
export const url = link.url
export {check} from 'alinea/input/check'
export {code} from 'alinea/input/code'
export {date} from 'alinea/input/date'
export {json} from 'alinea/input/json'
export {link} from 'alinea/input/link'
export {list} from 'alinea/input/list'
export {metadata} from 'alinea/input/metadata'
export {number} from 'alinea/input/number'
export {object} from 'alinea/input/object'
export {path} from 'alinea/input/path'
export {richText} from 'alinea/input/richtext'
export {select} from 'alinea/input/select'
export {tab, tabs} from 'alinea/input/tabs'
export {text} from 'alinea/input/text'
export {view} from 'alinea/input/view'

import {link} from 'alinea/input/link'
export const entry = link.entry
export const image = link.image
export const file = link.file
export const url = link.url
1 change: 1 addition & 0 deletions src/next.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {createNextCMS as createCMS} from 'alinea/core/driver/NextDriver'

0 comments on commit 4f83e78

Please sign in to comment.