@kunalshetye/cms-sdk
v1.0.0-kunalshetye.5
Published
JavaScript tools for integration with Optimizely CMS
Readme
@kunalshetye/cms-sdk
Custom fork of
@optimizely/cms-sdkThis package is a community-maintained fork published under the
@kunalshetyescope. It tracks the officialepiserver/content-js-sdkrepository and adds features not yet available upstream, such as built-in Optimizely Forms support and forms-availability detection.The
mainbranch stays in sync with upstream. Custom changes live on the@kunalshetye/content-js-sdkrelease branch.
What's different from the official SDK?
- Optimizely Forms support - Built-in content type definitions for all 10 form element types
- Forms feature detection - Automatic introspection check that only includes form fragments when Forms is installed on the CMS instance
- All upstream features - Everything from the official SDK is included
For a complete reference, see the Fork Features documentation.
Installation
npm install @kunalshetye/[email protected]Or using other package managers:
# pnpm
pnpm add @kunalshetye/[email protected]
# yarn
yarn add @kunalshetye/[email protected]
# bun
bun add @kunalshetye/[email protected][!NOTE] All releases from this fork use the
-kunalshetye.Nprerelease suffix (e.g.,1.0.0-kunalshetye.1,1.0.0-kunalshetye.2). The base version (e.g.,1.0.0) tracks the upstream@optimizely/cms-sdkversion it's based on.
Aliasing as @optimizely/cms-sdk
If you have an existing codebase that imports from @optimizely/cms-sdk and don't want to rename all imports, you can alias this package:
{
"dependencies": {
"@optimizely/cms-sdk": "npm:@kunalshetye/[email protected]"
}
}This lets you keep import { ... } from '@optimizely/cms-sdk' everywhere while using this fork under the hood.
Quick Start
import { GraphClient, initContentTypeRegistry, FormContentTypes } from '@kunalshetye/cms-sdk';
// Register content types (including forms)
initContentTypeRegistry([
...FormContentTypes,
...yourAppContentTypes,
]);
// Initialize the client
const client = new GraphClient('<YOUR_APP_SINGLE_KEY>');
// Fetch content — form fragments are included automatically if Forms is enabled
const content = await client.getContentByPath('/some-page');Build Configuration
The buildConfig() factory accepts the following options:
| Field | Type | Description |
|---|---|---|
| components | string[] | Glob patterns to locate content type definition files |
| propertyGroups | PropertyGroupType[] | Custom property groups for the CMS editor |
| contentDir | string | Directory for generated content type files from config pull (default: ./src/content) |
Documentation
For comprehensive guides and documentation, visit the main repository:
Getting Started
- Installation - Set up your development environment
- Setup - Configure the SDK and CLI
- Modelling - Define your content types with TypeScript
Core Features
- Fetching Content - Query and retrieve content in your app
- Rendering (React) - Display content in React components
- Live Preview - Enable real-time content editing
Advanced Features
- Experience - Work with experiences and variations
- Display Settings - Configure content display options
- RichText Component (React) - Render rich text content
- DAM Assets - Manage digital assets
- Client Utils - Utility functions and helpers
- Forms - Working with Optimizely Forms
- Fork Features - Complete reference of features unique to this fork
- Changelog - Release history
Keeping in sync with upstream
This fork follows a simple branching strategy:
main— Mirrors the officialepiserver/content-js-sdkvia GitHub's upstream sync. No custom changes here.@kunalshetye/content-js-sdk— Release branch with custom features. Periodically rebased/merged frommainto pick up upstream changes.
Releases to npm are published exclusively from the @kunalshetye/content-js-sdk branch.
Support
- Upstream issues - Report bugs in the official SDK on GitHub
- Fork-specific issues - For issues related to this fork's custom features (forms support, etc.), open an issue on this repository
License
Apache License 2.0
Community fork maintained by @kunalshetye | Documentation | Upstream
