Registry / devops / bonescript-compiler

bonescript-compiler

JSON →
library0.14.6jsnpmunverified

BoneScript Compiler (v0.14.6) compiles .bone system description files into complete, runnable Node.js backends. It generates TypeScript source code for Express.js routes, PostgreSQL schema and queries, authentication middleware, and input validation, making it a DSL-to-code tool for declarative backend development. Released on a monthly-ish cadence, it differentiates from traditional scaffolding tools by producing production-ready code that integrates directly with Express and PostgreSQL. Requires Node.js >=18 and ships TypeScript definitions.

npm install bonescript-compiler
INSTALL
IMPORT
SIG · BONESCRIPT-COMPILE
B
bonescript-compiler
devopsjavascriptv0.14.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BoneScriptCompiler
import { BoneScriptCompiler } from 'bonescript-compiler'
const BoneScriptCompiler = require('bonescript-compiler')
ESM-only since v0.14.0, no default export.
compile
import { compile } from 'bonescript-compiler'
import compile from 'bonescript-compiler'
Named export, not default.
CompileOptions
import type { CompileOptions } from 'bonescript-compiler'
Type-only import for TypeScript.

Compiles a BoneScript system description into TypeScript code and validates syntax with error reporting.

import { compile } from 'bonescript-compiler'; import { writeFileSync } from 'fs'; const source = ` route GET /users { query { limit?: number } handler => SELECT * FROM users LIMIT ${'$'}{query.limit ?? 10} } `; const result = compile(source, { dialect: 'postgresql', framework: 'express', auth: false }); writeFileSync('generated.ts', result.code); const source2 = ` route POST /users { body { name: string, email: string } handler => INSERT INTO users (name, email) VALUES (${'$'}{body.name}, ${'$'}{body.email}) RETURNING * } `; const result2 = compile(source2, { check: true }); console.log(result2.errors);
Debug
Known issues
breakingImport path changed from 'bonescript-compiler/lib' to 'bonescript-compiler' in v0.14.0
fix
Update imports to 'bonescript-compiler' and use named exports.
affects: <0.14.0
breakingrequire() no longer works in v0.14.0+; ESM-only package
fix
Switch to ESM imports (import ... from ...).
affects: >=0.14.0
deprecatedThe 'generateExpress' function is deprecated as of v0.14.0; use compile() with framework: 'express'
fix
Migrate to compile() and pass framework option.
affects: <0.14.0
gotchaIf you omit 'dialect' option, compilation defaults to 'postgresql' but may produce unexpected output for other databases
fix
Always specify a dialect, even if just for clarity.
affects: >=0.14.0
gotchaError messages from compilation are returned in the result object, not thrown; forgetting to check errors leads to empty code
fix
Always check result.errors after compile() before using result.code.
affects: >=0.14.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'bonescript-compiler'
Using require() in an ESM-only package
fix
Change to import { BoneScriptCompiler } from 'bonescript-compiler' and set "type": "module" in package.json.
TypeError: bonescript_compiler_1.compile is not a function
Using default import instead of named import
fix
Use import { compile } from 'bonescript-compiler'.
Validation error: 'query' format is invalid
Query parameter definitions not matching the expected pattern (e.g., using ? instead of ?),
fix
Use the correct syntax: query { param?: type } with optional marker ? and type.
Upgrade
Version history
0.14.6latest on npm
Audit
Dependencies
expressrequiredBoneScript generates Express.js route handlers and middleware
pgrequiredGenerated code uses node-postgres for database operations
Agent activity
4 hits · last 30 days
node
4
Resources
bonescript-compiler — npm install bonescript-compiler · libregistry