1.4.1 • Published 2 years ago

prisma-schema-sorter v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm version npm npm Commitizen friendly

Prisma Schema Sorter

Prisma 2 tool to sort schema models, enums, generators and datasources

Full docs can be found here: docs

Table of Contents

Installation

Using npm:

$ npm install prisma-schema-sorter

Using yarn:

$ yarn add prisma-schema-sorter

Usage

You can use the library in multiple ways as described below.

1- Using the CLI:

With the CLI, you get the same functionality but with greater flexibility. You could run the command as a one-off every now and then from the terminal like this:

$ npx prisma-schema-sorter sort --schema="./prisma/schema.prisma"

You could also keep the command as an npm script to run it as part of your workflow:

{
    "scripts": {
      "sort-schema": "npx prisma-schema-sorter sort --schema='./prisma/schema.prisma'"
    }
}

Or even without the npx prefix:

{
    "scripts": {
      "sort-schema": "prisma-schema-sorter sort --schema='./prisma/schema.prisma'"
    }
}

2- Programmatically:

ES Module

import { sortPrismaSchema } from 'prisma-schema-sorter';
await sortPrismaSchema('./prisma/schema.prisma');
// => Success

CommonJS

var sortPrismaSchema = require('prisma-schema-sorter').sortPrismaSchema;
sortPrismaSchema('./prisma/schema.prisma').then();
// => Success
1.4.1

2 years ago

1.4.0

2 years ago

1.4.0-rc.1

2 years ago

1.3.4

2 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.2.0

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.1

3 years ago