jsonjsdb_editor
v0.3.4
Published
Jsonjsdb database editor
Maintainers
Readme
Jsonjsdb Editor
A development tool for converting relational database tables into jsonjs format compatible with jsonjsdb.
Currently supports Excel (.xlsx) files as source, where each file represents one database table.
Installation
npm install jsonjsdb_editorTable of Contents
Basic Usage
Simple Database Update
Convert Excel files to jsonjs format:
import Jsonjsdb_editor from 'jsonjsdb_editor'
const editor = new Jsonjsdb_editor()
await editor.set_output_db('app_db') // Output directory
await editor.update_db('db') // Source Excel files directoryParameters:
app_db: Target directory for generated jsonjs filesdb: Source directory containing .xlsx files
Vite Integration
Development Workflow
Integrate with Vite for automatic database updates during development:
import { defineConfig } from 'vite'
import FullReload from 'vite-plugin-full-reload'
import { Jsonjsdb_watcher, jsonjsdbAddConfig } from 'jsonjsdb_editor'
// Setup database watcher
await Jsonjsdb_watcher.set_db('app_db')
await Jsonjsdb_watcher.watch('db')
await Jsonjsdb_watcher.update_preview('preview', 'data')
export default defineConfig({
plugins: [
jsonjsdbAddConfig('data/jsonjsdb_config.html'),
process.env.NODE_ENV &&
FullReload(Jsonjsdb_watcher.get_table_index_file_path()),
],
})Features:
- Auto-reload: Automatically updates jsonjs files when Excel sources change
- Config injection: Adds jsonjsdb configuration to your HTML
- Hot reload: Triggers browser refresh on database changes
