0.5.3 • Published 2 months ago

remult-cli v0.5.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

remult-cli is a command-line tool designed to simplify the process of generating Remult entities from a PostgreSQL database.

Inspired by prisma db pull, this tool streamlines the creation of Remult entities, making database integration smoother and more efficient.

Usage

Basic Usage

Generate Remult entities using the default settings:

npx remult-cli pull

Advanced Usage

For more advanced usage, you can utilize the --help flag to explore the available options:

npx remult-cli --help

Examples

# All entities from two schemas:
npx remult-cli pull --schemas auth public

# All entities from all schemas:
npx remult-cli pull --schemas '*'

Options

  • --connectionString: Your PostgreSQL database connection string. Only PostgreSQL databases are supported.
  • --tableProps: Customize properties for generated tables (default: allowApiCrud: true).
  • --output: Define the output directory for the generated Remult entities (default: ./src/shared).
  • --defaultOrderBy: Will put a default order by if we see one of this column name. (default: order,name).
  • --customDecorators: Will replace the default decorator by a custom one. (Should be a stringified JSON object). Let's describe this example: {"@Fields.string":"@KitFields.string#@kitql/remult"}, here we replace the default @Fields.string decorator by @KitFields.string from the @kitql/remult import.

Environmental Variables

Alternatively, you can utilize a .env file to set configuration values. Example:

DATABASE_URL=postgres://user:pass@host:port/db-name
TABLE_PROPS=allowApiCrud: (r) => r?.authenticated() ?? false
OUTPUT=./fancy/place
DEFAULT_ORDER_BY = "order,name,nom,username"
CUSTOM_DECORATORS = '{"@Fields.string":"@KitFields.string#@kitql/remult","@Fields.dateOnly":"@KitFields.dateOnly#@kitql/remult"}'

After setting up your .env file, run the following command:

npx remult-cli pull

Development

  1. Clone the repository:
git clone https://github.com/Yedidyar/remult-cli.git
  1. Install dependencies:
pnpm install
  1. Start the development server:
pnpm dev
  1. Begin development:
pnpm start
  1. Run CI locally with 🌍 earthly 🌍
    • Install earthly for yours OS (you can see there yours OS pre-requisites)
    • Run earthly -P +all (you can also add the --interactive flag for debugging)

Contribution

We welcome contributions from the community! If you find any issues or have ideas for enhancements, please submit bug reports, feature requests, or pull requests through our GitHub repository.

License

remult-cli is licensed under the MIT License.

0.5.3

2 months ago

0.5.2

4 months ago

0.5.1

4 months ago

0.5.0

6 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.3.0

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago