Skip to content

Commit 44c34c1

Browse files
feat(reflect-metadata): remove import
- update README to provide some more information about what is required to start to use dynamo-easy - adding comment with breaking change which I forgot to add previously BREAKING CHANGE all consumers of dynamo-easy must install and import reflect-metadata in their project.
1 parent 0140a85 commit 44c34c1

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,23 @@ Built with :heart: by [shiftcode](https://www.shiftcode.ch).
1717

1818
# Get Started
1919

20-
## Metadata Reflection API
20+
## Prerequisite
21+
22+
### Typescript Metadata
23+
24+
#### Reflection API
2125

2226
> ⚠ The reflect-metadata polyfill should be imported only once in your entire application because the Reflect object is
2327
mean to be a global singleton.
2428

25-
Required always. Use reflect-metadata as polyfill.
29+
Install the reflect-metadata polyfill.
2630

2731
```
2832
npm install reflect-metadata --save
2933
```
3034

3135
The type definitions for reflect-metadata are included in the npm package.
32-
You need to add the following reference to the types field in your tsconfig.json:
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):
3337

3438
```
3539
"types": ["reflect-metadata"]
@@ -41,8 +45,20 @@ Finally, import reflect-metadata in some entry file in your application.
4145
import "reflect-metadata"
4246
```
4347

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
4459
Also make sure to install the other peer dependencies of @shiftcoders/dynamo-easy.
4560

61+
4662
## First Sample
4763

4864
When all the setup work is done, define your first model and create a dynamo store to execute actions on the dynamoDB.
@@ -85,11 +101,6 @@ dynamoStore.scan()
85101
# Decorators
86102
Decorators are used to add some metadata to our model classes, relevant to our javascript-to-dynamo mapper.
87103

88-
This is an experimental feature and requires to set the following typescript compiler options:
89-
90-
- "experimentalDecorators": true
91-
- "emitDecoratorMetadata": true
92-
93104
Additionally we rely on the reflect-metadata (https://www.npmjs.com/package/reflect-metadata) library for reflection api.
94105

95106
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)