Skip to content

Commit a20f0a6

Browse files
committed
# Conflicts: # README.md # index.js # package.json
2 parents aa78dd2 + e1fc02b commit a20f0a6

File tree

4 files changed

+251
-300
lines changed

4 files changed

+251
-300
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## How to contribute to serverless-dynamodb-local
2+
3+
#### **Did you find a bug?**
4+
5+
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/99xt/serverless-dynamodb-local/issues).
6+
7+
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/99xt/serverless-dynamodb-local/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
8+
9+
#### **Did you write a patch that fixes a bug?**
10+
11+
* Open a new GitHub pull request with the patch.
12+
13+
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
14+
15+
#### **Do you intend to add a new feature or change an existing one?**
16+
17+
* Suggest your change in the [Gitter](https://gitter.im/99xt/serverless-dynamodb-local?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) and start writing code.
18+
19+
* Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes.
20+
21+
#### **Do you have questions about the source code?**
22+
23+
* Ask any question about how to use serverless-dynamodb-local in the [Glitter](https://gitter.im/99xt/serverless-dynamodb-local?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
24+
25+
</br>
26+
27+
serverless-dynamodb-local is a volunteer effort. We encourage you to pitch in and [join the team](https://github.com/99xt/serverless-dynamodb-local/graphs/contributors)!
28+
29+
Thanks! :heart: :heart: :heart:
30+
31+
serverless-dynamodb-local Team
32+
33+
CONTRIBUTING file inspired/based on [rails contrubiting](https://github.com/rails/rails/blob/master/CONTRIBUTING.md)

README.md

Lines changed: 38 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ serverless-dynamodb-local
66
[![npm version](https://badge.fury.io/js/serverless-dynamodb-local.svg)](https://badge.fury.io/js/serverless-dynamodb-local)
77
[![license](https://img.shields.io/npm/l/serverless-dynamodb-local.svg)](https://www.npmjs.com/package/serverless-dynamodb-local)
88

9-
For [email protected] installation and documentation [please see v1 branch](https://github.com/99xt/serverless-dynamodb-local/tree/v1).
10-
11-
Following instructions are for [email protected]
129
## This Plugin Requires
13-
* Serverless V0.5.x
10+
1411
* Java Runtime Engine (JRE) version 6.x or newer
1512

1613
## Features
@@ -19,10 +16,13 @@ Following instructions are for [email protected]
1916
* Create, Manage and Execute DynamoDB Migration Scripts(Table Creation/ Data Seeds) for DynamoDB Local and Online
2017

2118
## Install Plugin
22-
`npm install --save serverless-dynamodb-local@0.2.10`
19+
`npm install --save serverless-dynamodb-local`
2320

24-
Then in `s-project.json` add following entry to the plugins array: `serverless-dynamodb-local`
25-
e.g `"plugins": ["serverless-dynamodb-local"]`
21+
Then in `serverless.yml` add following entry to the plugins array: `serverless-dynamodb-local`
22+
```yml
23+
plugins:
24+
- serverless-dynamodb-local
25+
```
2626
2727
## Using the Plugin
2828
1) Install DynamoDB Local
@@ -38,12 +38,9 @@ e.g `"plugins": ["serverless-dynamodb-local"]`
3838
* Execute a single migration. Make sure DynamoDB Local is started in another shell.
3939
`sls dynamodb execute -n <filename>`
4040

41-
* Execute all migrations for DynamoDB Local.
41+
* Execute all migrations on the remote dynamodb.
4242
`sls dynamodb executeAll`
4343

44-
* Execute migration(s) in remote DynamoDB use additional parameters(region and stage) after execute/executeAll. e.g.
45-
`sls dynamodb executeAll -r us-west-1 -s dev`
46-
4744
Note: Read the detailed section for more information on advanced options and configurations. Open a browser and go to the url http://localhost:8000/shell to access the web shell for dynamodb local.
4845

4946
## Install: sls dynamodb install
@@ -55,7 +52,7 @@ Note: This is useful if the sls dynamodb install failed in between to completely
5552
All CLI options are optional:
5653

5754
```
58-
--port -p Port to listen on. Default: 8000
55+
--port -p Port to listen on. Default: 8000
5956
--cors -c Enable CORS support (cross-origin resource sharing) for JavaScript. You must provide a comma-separated "allow" list of specific domains. The default setting for -cors is an asterisk (*), which allows public access.
6057
--inMemory -i DynamoDB; will run in memory, instead of using a database file. When you stop DynamoDB;, none of the data will be saved. Note that you cannot specify both -dbPath and -inMemory at once.
6158
--dbPath -d The directory where DynamoDB will write its database file. If you do not specify this option, the file will be written to the current directory. Note that you cannot specify both -dbPath and -inMemory at once. For the path, current working directory is <projectroot>/node_modules/serverless-dynamodb-local/dynamob. For example to create <projectroot>/node_modules/serverless-dynamodb-local/dynamob/<mypath> you should specify -d <mypath>/ or --dbPath <mypath>/ with a forwardslash at the end.
@@ -65,58 +62,38 @@ All CLI options are optional:
6562
--migration -m After starting dynamodb local, run dynamodb migrations.
6663
```
6764

68-
All the above options can be added to s-project.json to set default configuration: e.g
69-
70-
```json
71-
"custom": {
72-
"dynamodb": {
73-
"start": {
74-
"port": "8000",
75-
"inMemory": true,
76-
"migration": true
77-
}
78-
}
79-
}
65+
All the above options can be added to serverless.yml to set default configuration: e.g.
66+
67+
```yml
68+
custom:
69+
dynamodb:
70+
start:
71+
port: 8000
72+
inMemory: true
73+
migration: true
74+
migration:
75+
dir: ./offline/migrations
8076
```
8177

82-
## Migrations: sls dynamodb <migration-command>
83-
Migration-Commands create, execute, executeAll
78+
## Migrations: sls dynamodb create/execute/executeAll
8479
### Configurations
85-
In `s-project.json` add following to customize DynamoDB Migrations file directory and table prefixes/suffixes
86-
```json
87-
"custom": {
88-
"dynamodb": {
89-
"migration": {
90-
"dir": "dynamodbMigrations",
91-
"table_prefix": "",
92-
"table_suffix": ""
93-
}
94-
}
95-
}
80+
In `serverless.yml` add following to customize DynamoDB Migrations file directory and table prefixes/suffixes
81+
```yml
82+
custom:
83+
dynamodb:
84+
migration:
85+
dir: dynamodbMigrations
86+
table_prefix: prefix
87+
table_suffix": suffix
9688
```
9789

98-
In `s-project.json` add following to execute all the migration upon DynamoDB Local Start
99-
```json
100-
"custom": {
101-
"dynamodb": {
102-
"start": {
103-
"migration": true
104-
}
105-
}
106-
}
107-
```
108-
109-
For Migration-Commands execute/executeAll following optional parameters can be used
110-
90+
In `serverless.yml` add following to execute all the migration upon DynamoDB Local Start
91+
```yml
92+
custom:
93+
dynamodb:
94+
start:
95+
migration: true
11196
```
112-
--region -r Region that dynamodb should be remotely executed.
113-
--stage -s Stage that dynamodb should be remotely executed.
114-
--table_prefix -t Dynamodb Table name prefixs (E.g. for prefix = production- and abstract table-name = users, after adding the prefix it will be production-users)
115-
--table_suffix -x Table name suffix (E.g for suffix = -test and abstract table-name = users, after adding the suffix it will be users-test )
116-
--profile -p Use another AWS Profile to execute migration
117-
--name -n Execute a migration template with the given name (This is only for execute command and not applicable for executeAll).
118-
```
119-
12097
### Migration Template
12198
```json
12299
{
@@ -178,7 +155,6 @@ For Migration-Commands execute/executeAll following optional parameters can be u
178155
"attr_2": "attr_2_value"
179156
}]
180157
}
181-
182158
```
183159
Before modifying the migration template, refer the (Dynamodb Client SDK): http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property and (Dynamodb Document Client SDK): http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#put-property links.
184160

@@ -206,6 +182,9 @@ new AWS.DynamoDB({
206182
### Using with serverless-offline plugin
207183
When using this plugin with serverless-offline, it is difficult to use above syntax since the code should use DynamoDB Local for development, and use DynamoDB Online after provisioning in AWS. Therefore we suggest you to use [serverless-dynamodb-client](https://github.com/99xt/serverless-dynamodb-client) plugin in your code.
208184
185+
## Reference Project
186+
* [serverless-react-boilerplate](https://github.com/99xt/serverless-react-boilerplate)
187+
209188
## Links
210189
* [Dynamodb local documentation](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html)
211190
* [Contact Us](mailto:[email protected])

0 commit comments

Comments
 (0)