Skip to content

Latest commit

 

History

History
73 lines (55 loc) · 1.65 KB

File metadata and controls

73 lines (55 loc) · 1.65 KB

Contributing to DrawDB CLI

We welcome contributions! This guide will help you get started.

Development Setup

  1. Clone the repository

    git clone https://github.com/drawdb-io/drawdb-cli.git
    cd drawdb-cli
  2. Install dependencies

    npm install
  3. Link for local testing

    npm link

    This makes the drawdb-cli command available globally, pointing to your local source.

Project Structure

  • bin/: CLI entry point (drawdb-cli.js)
  • src/: Source code
    • cli.js: CLI logic (Commander.js)
    • index.js: Main library export
    • converters/: Format converters (one file per format)
    • data/: Constants and type definitions
    • utils/: Shared utilities
  • tests/: Jest unit tests and fixtures

Running Tests

We use Jest for testing.

# Run all tests
npm test

# Run specific test file
npm test tests/mysql.test.js

# Run with coverage
npm run test:coverage

Adding a New Converter

  1. Create a new file in src/converters/ (e.g., oracle.js).
  2. Implement toOracle(diagram) (export) and optionally fromOracle(sql) (import).
  3. Register the converter in src/converters/index.js:
    oracle: {
        name: "Oracle",
        extensions: [".plsql"],
        import: null, // or fromOracle
        export: toOracle
    }
  4. Add unit tests in tests/oracle.test.js.
  5. Update README.md supported formats table.

Code Style

  • Use ES Modules (import/export).

  • Follow existing patterns for SQL generation.

  • Ensure all tests pass before submitting a PR.

  • Ensure all tests pass before submitting a PR.