typeorm-codebase-sync
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

TypeORM Codebase Sync

Automatically update your codebase to add migrations, entities and subscribers to your data-source.ts file

Test Version codecov

Installation

  1. Install dependencies
npm install --save-dev typescript
npm install --save typeorm
  1. Install typeorm-codebase-sync
npm install --save-dev typeorm-codebase-sync
  1. Add typeorm-sync script to package.json
npm set-script "typeorm-sync" "typeorm-codebase-sync addReferences --dataSource ./src/db/data-source.ts --migrations ./src/db/migrations --entities ./src/db/entities --subscribers ./src/db/subscribers"
  1. To automatically run typeorm-sync after using the typeorm CLI, edit package.json:
npm set-script "posttypeorm" "npm run typeorm-sync"

Given that your package.json contains a script called typeorm, after each time you run npm run typeorm -- <params>, the typeorm-sync script will automatically run

Documentation

addReferences command

Usage: typeorm-codebase-sync addReferences --dataSource <path> [options]

Required:
  -d, --dataSource  Path to a data-source.ts file                                [string] [required]

Files:
  -m, --migrations   Glob of migration files or folders containing migration files           [array]
  -e, --entities     Glob of entity files or folders containing entity files                 [array]
  -s, --subscribers  Glob of subscriber files or folders containing subscriber files         [array]

Options:
  -h, --help     Show help                                                                 [boolean]
  -v, --version  Show version number                                                       [boolean]

Dependents (0)

Package Sidebar

Install

npm i typeorm-codebase-sync

Weekly Downloads

172

Version

1.1.2

License

MIT

Unpacked Size

92.8 kB

Total Files

36

Last publish

Collaborators

  • giladgd