Skip to content

Commit 36655ce

Browse files
Merge branch 'beta' into #83-improve-batch-requests
2 parents d060227 + 24017b9 commit 36655ce

File tree

11 files changed

+1908
-709
lines changed

11 files changed

+1908
-709
lines changed

.commitlintrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
extends:
2+
- "@commitlint/config-conventional"

.huskyrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
hooks:
2+
commit-msg: "commitlint -E HUSKY_GIT_PARAMS"
3+
pre-commit: "lint-staged"
4+
pre-push: "npm run test && npm run build"

.lintstagedrc.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ linters:
33
- prettier --write --config ./.prettierrc.yml
44
- tslint --project ./tsconfig.json -t codeFrame --fix
55
- git add
6+
"(src/**/*.spec.ts|test/**/*.ts)":
7+
- prettier --write --config ./.prettierrc.yml
8+
# FIXME tslint will not work because of the following error
9+
# ✖ tslint --project ./tsconfig.jest.json -t codeFrame --fix found some errors. Please fix them and try committing again.
10+
#'/Users/michaelwittwer/dev/shiftcode/dynamo-easy/test/models/complex.model.ts' is not included in project.
11+
# - tslint --project ./tsconfig.jest.json -t codeFrame --fix
12+
- git add
613
"**/package.json":
714
- sort-package-json
815
- git add

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ before_script: npx greenkeeper-lockfile-update
2828

2929
script:
3030
- npm run lint:ci
31-
- npm run test:coverage
31+
- npm run test:ci
3232
- npm run build
3333
- npm run build:docs
3434

README.md

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
99
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg)](#contributors)
1010

11-
This is the documentation for the new version of dynamo-easy released as a scoped package using the namespace
12-
@shiftcoders (@shiftcoders/dynamo-easy). If you still want to use the 0.0.x version you can
13-
by installing the old version `npm install dynamo-easy` (https://github
14-
.com/shiftcode/dynamo-easy/releases/tag/v0.10
15-
.1)
16-
1711
Abstracts away the complexity of the low level aws dynamosdk. Provides an easy to use fluent api to for requests and supports typescript decorators,
1812
to define some metadata for your models. You don't need to care about the mapping of javascript types to their dynamo types any more. We got you covered.
1913

@@ -22,6 +16,53 @@ Checkout the full technical api documentation [here](https://shiftcode.github.io
2216
Built with :heart: by [shiftcode](https://www.shiftcode.ch).
2317

2418
# Get Started
19+
20+
## Prerequisite
21+
22+
### Typescript Metadata
23+
24+
#### Reflection API
25+
26+
> ⚠ The reflect-metadata polyfill should be imported only once in your entire application because the Reflect object is
27+
mean to be a global singleton.
28+
29+
Install the reflect-metadata polyfill.
30+
31+
```
32+
npm install reflect-metadata --save
33+
```
34+
35+
The type definitions for reflect-metadata are included in the npm package.
36+
You need to add the following reference to the types field in your [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types):
37+
38+
```
39+
"types": ["reflect-metadata"]
40+
```
41+
42+
Finally, import reflect-metadata in some entry file in your application.
43+
44+
```
45+
import "reflect-metadata"
46+
```
47+
48+
#### Decorators
49+
50+
51+
We need to enable the two experimental features to work with decorators, add this to your tsconfig.json:
52+
53+
```
54+
"experimentalDecorators": true
55+
"emitDecoratorMetadata": true
56+
```
57+
58+
#### Other
59+
Also make sure to install the other peer dependencies of @shiftcoders/dynamo-easy.
60+
61+
62+
## First Sample
63+
64+
When all the setup work is done, define your first model and create a dynamo store to execute actions on the dynamoDB.
65+
2566
```typescript
2667
@Model()
2768
class Person{
@@ -57,16 +98,9 @@ dynamoStore.scan()
5798

5899
```
59100

60-
Want to use this library with Angular (>4) [checkout our angular-service](TODO).
61-
62101
# Decorators
63102
Decorators are used to add some metadata to our model classes, relevant to our javascript-to-dynamo mapper.
64103

65-
This is an experimental feature and requires to set the following typescript compiler options:
66-
67-
- "experimentalDecorators": true
68-
- "emitDecoratorMetadata": true
69-
70104
Additionally we rely on the reflect-metadata (https://www.npmjs.com/package/reflect-metadata) library for reflection api.
71105

72106
To get started with decorators just add a [@Model()](https://shiftcode.github.io/dynamo-easy/modules/_decorator_impl_model_model_decorator_.html) Decorator to any typescript class.

0 commit comments

Comments
 (0)