JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q77582F
  • License MIT

Jsonjsdb database builder

Package Exports

  • jsonjsdb-builder

Readme

NPM Version NPM License

Jsonjsdb Builder

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-builder

Table of Contents

Basic Usage

Simple Database Update

Convert Excel files to jsonjs format:

import JsonjsdbBuilder from 'jsonjsdb-builder'

const builder = new JsonjsdbBuilder()
await builder.setOutputDb('app_db') // Output directory
await builder.updateDb('db') // Source Excel files directory

Parameters:

  • app_db: Target directory for generated jsonjs files
  • db: 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 { JsonjsdbWatcher, jsonjsdbAddConfig } from 'jsonjsdb-builder'

// Setup database watcher
await JsonjsdbWatcher.setDb('app_db')
await JsonjsdbWatcher.watch('db')
await JsonjsdbWatcher.updatePreview('preview', 'data')

export default defineConfig({
  plugins: [
    jsonjsdbAddConfig('data/jsonjsdb_config.html'),
    process.env.NODE_ENV && FullReload(JsonjsdbWatcher.getTableIndexFilePath()),
  ],
})

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