![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@contentrain/generator
Advanced tools
Type and schema generator for Contentrain SDK.
npm install @contentrain/generator
# Generate types for all models
contentrain-generate
# Generate types with custom configuration
contentrain-generate --content ./content --output ./types
import { ContentrainGenerator } from '@contentrain/generator'
// Initialize generator
const generator = new ContentrainGenerator({
contentPath: './content',
output: './types'
})
// Generate types
await generator.generate()
interface GeneratorConfig {
// Path to content directory (default: 'contentrain')
contentPath?: string
// Output path for generated types (default: 'contentrain/types')
output?: string
}
The generator creates TypeScript interfaces for your content models. For example:
// Base model type that all content models extend
export interface BaseContentrainModel {
ID: string
createdAt: string
updatedAt: string
status: 'draft' | 'changed' | 'publish'
scheduled: boolean
}
// Generated from metadata.json
// {
// "name": "BlogPost",
// "modelId": "blog-posts",
// ...
// }
interface IBlogPost extends BaseContentrainModel {
title: string
content: string
author: string
tags: string[]
}
// Generated from metadata.json
// {
// "name": "Author",
// "modelId": "authors",
// ...
// }
interface IAuthor extends BaseContentrainModel {
name: string
bio: string
avatar: string
}
// Type mapping for model IDs to their respective interfaces
export type ContentrainTypeMap = {
'blog-posts': IBlogPost
'authors': IAuthor
}
Options:
--content Path to content directory [string] [default: "contentrain"]
--output Output path for types [string] [default: "contentrain/types"]
--help Show help [boolean]
--version Show version number [boolean]
MIT
FAQs
`@contentrain/generator` is a type and schema generator tool for the Contentrain SDK. It generates TypeScript interfaces for your content models and can be used via CLI or programmatically.
The npm package @contentrain/generator receives a total of 0 weekly downloads. As such, @contentrain/generator popularity was classified as not popular.
We found that @contentrain/generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.