Skip to content

Commit

Permalink
fix: Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
tonivj5 committed Sep 13, 2018
1 parent 6e23381 commit 4ff52eb
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 21 deletions.
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
# typeorm-naming-strategies
# Typeorm naming strategies

Custom naming strategies for typeorm
This package provides a few (one, at the moment) useful custom naming strategies. It alterates the name of columns, relations and other fields in database.

# How to use
For example, using the snake strategy, if you have a model like this:

```typescript
class User {
@Column()
createdAt;
}
```

In the DB the `createdAt` field will be `created_at`

## Naming strategies available

- Snake

## Installation

It's available as an [npm package](https://www.npmjs.com/package/typeorm-naming-strategies)

```sh
npm install typeorm-naming-strategies --save
```

Or using yarn

```sh
yarn add typeorm-naming-strategies
```

## Usage

```typescript
import { createConnection } from 'typeorm';
import { SnakeNamingStrategy } from 'typeorm-naming-strategies';

await createConnection({
...
namingStrategy: new SnakeNamingStrategy(),
namingStrategy: new SnakeNamingStrategy(), // Here you'r using the strategy!
});
```
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "typeorm-naming-strategies",
"version": "1.0.1",
"version": "1.0.2",
"description": "Custom naming strategies for typeorm",
"main": "index.js",
"types": "index.d.ts",
"keywords": [
"typeorm",
"naming",
"strategy",
"node",
"orm",
"naming strategy",
"snake strategy",
"typeorm snake"
"typeorm snake",
"naming strategies"
],
"repository": {
"type": "git",
Expand All @@ -17,17 +22,17 @@
"author": "Toni Villena",
"license": "MIT",
"scripts": {
"build": "rm -rf dist && tsc && cp README.md package.json dist/",
"build:watch": "tsc -w"
"build": "rm -rf dist && npm run tsc && cp README.md package.json dist/",
"tsc": "tsc"
},
"dependencies": {},
"peerDependencies": {
"typeorm": "^0.2"
},
"devDependencies": {
"@types/node": "^9.4.6",
"tslint": "^5.11.0",
"typeorm": "^0.2",
"tslint": "^5.9.1",
"typescript": "^2.7.2"
"typescript": "^3.0.3"
},
"peerDependencies": {
"typeorm": "^0.2.7"
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { SnakeNamingStrategy } from 'snake-naming.strategy';
export { SnakeNamingStrategy } from './snake-naming.strategy';
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es6",
"noImplicitAny": true,
"declaration": true,
"removeComments": true,
"moduleResolution": "node",
"sourceMap": false,
"strict": true,
"outDir": "dist",
"baseUrl": "src"
"outDir": "dist"
},
"include": ["src/**/*"]
}

0 comments on commit 4ff52eb

Please sign in to comment.