Sha256: c64a1a5fbafc11cf564cd9b3c46fd45aab4b28b646d0ded0d6dd199edd5dca34

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

# TsSchema

Uses ActiveRecord to generate a schema.d.ts file for use in typescript frontends.

## Installation

```ruby
bundle add "ts_schema"
```

Then generate the initializer file:

```ruby
rails generate ts_schema:install
```

## Usage

All options with their defaults are in the config file.

By default, every migration, rollback, reset or setup task will auto generate a new schema file, replacing the existing one. You can disable this behavior in the config file.

You can manually generate the schema file by running:

```ruby
rails ts_schema:generate
```

## Gotchas

Apparantly, sometimes ActiveRecord's inflections will alter the class name. For instance, with a class named `Five`; `"Fives".singularize` returns "Fife", which is not the classname. In the case where Rails alters the classname for an association, you must explicitly define it on the association in the model using `class_name`. Example: `has_many :fives, class_name: "Five"`.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ts_schema-0.1.12 README.md
ts_schema-0.1.11 README.md
ts_schema-0.1.10 README.md
ts_schema-0.1.9 README.md
ts_schema-0.1.8 README.md
ts_schema-0.1.7 README.md
ts_schema-0.1.6 README.md
ts_schema-0.1.5 README.md
ts_schema-0.1.4 README.md
ts_schema-0.1.3 README.md
ts_schema-0.1.1 README.md