Registry / database / mysql-build

mysql-build

JSON →
library0.9.29jsnpmunverified

mysql-build is a code generation tool (v0.9.29) that reads a MySQL database schema and produces a corresponding mjs module with CRUD functions (post, delete, put, get, equal) and a query method. It is a Node.js port of a Ruoyi feature, with no recent updates or clear release cadence. Compared to ORMs or Prisma, it is simpler but lacks schema migrations, type safety, and active maintenance.

npm install mysql-build
INSTALL
IMPORT
SIG · MYSQL-BUILD
M
mysql-build
databasejavascriptv0.9.29
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.

build
import build from 'mysql-build'
const build = require('mysql-build')
Package is ESM-only (default export) — CommonJS require will fail.
build (default import)
import build from 'mysql-build'
import { build } from 'mysql-build'
Named import is incorrect; only a default export exists.
build (dynamic import)
import('mysql-build').then(m => m.default(...))
import('mysql-build').then(m => m(...))
When using dynamic import, access the default property.

Connects to a MySQL database, generates CRUD functions, and demonstrates usage of generated query method.

import build from 'mysql-build'; build({ host: 'localhost', port: '3306', user: 'root', password: process.env.MYSQL_PASSWORD ?? '', database: 'my_database', useUnicode: 'true', characterEncoding: 'utf8' }); // The generated 'my_database.mjs' file will be placed in the current directory. // Example usage of the generated file: // import { query, get, equal, post, put, del } from './my_database.mjs'; // const rows = await query('SELECT * FROM users');
Debug
Known issues
gotchaThe build function does not return a promise; it relies on a timeout to exit the process.
fix
Add a setTimeout to exit after generation, or wrap in a callback if supported.
affects: >=0.0.0
gotchaPackage has no TypeScript declarations; all types are implicit.
fix
Use JSDoc comments or create a custom .d.ts file.
affects: >=0.0.0
deprecatedThe package uses the old mysql driver which is not actively maintained; consider using mysql2.
fix
Use mysql2 instead, but note compatibility is not guaranteed.
affects: >=0.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Package is ESM-only, but project is not configured for ESM.
fix
Add "type": "module" to package.json or rename file to .mjs.
Error: Cannot find module 'mysql'
The mysql dependency is not installed.
fix
Run: npm install mysql
Upgrade
Version history
0.9.29latest on npm
Audit
Dependencies
mysqlrequiredMySQL database driver
Agent activity
2 hits · last 30 days
node
2
Resources
mysql-build — npm install mysql-build · libregistry