Skip to content

Commit 1ec0467

Browse files
committed
Conflicts: dynamodb/core.js dynamodb/installer.js index.js
2 parents d4a64a6 + 7597f89 commit 1ec0467

File tree

4 files changed

+55
-243
lines changed

4 files changed

+55
-243
lines changed

dynamodb/core.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

dynamodb/installer.js

Lines changed: 0 additions & 96 deletions
This file was deleted.

index.js

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const _ = require('lodash'),
44
BbPromise = require('bluebird'),
55
tables = require('./tables/core'),
6-
dynamodb = require('./dynamodb/core');
6+
dynamodbLocal = require('dynamodb-localhost');
77

88
module.exports = function(S) { // Always pass in the ServerlessPlugin Class
99
const SCli = require(S.getServerlessPath('utils/cli'));
@@ -45,6 +45,12 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
4545
context: 'dynamodb',
4646
contextAction: 'remove'
4747
});
48+
S.addAction(this.install.bind(this), {
49+
handler: 'dynamodbInstall',
50+
description: 'Install dynamodb local database. This is a single time operation.',
51+
context: 'dynamodb',
52+
contextAction: 'install'
53+
});
4854
S.addAction(this.start.bind(this), {
4955
handler: 'dynamodbStart',
5056
description: 'Start dynamodb local database',
@@ -101,7 +107,15 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
101107
*/
102108

103109
remove() {
104-
return dynamodb.remove();
110+
return new BbPromise(function(resolve, reject) {
111+
dynamodbLocal.remove(resolve);
112+
});
113+
}
114+
115+
install() {
116+
return new BbPromise(function(resolve, reject) {
117+
dynamodbLocal.install(resolve);
118+
});
105119
}
106120

107121
table(evt) {
@@ -132,18 +146,18 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
132146
options = _.merge({
133147
sharedDb: evt.options.sharedDb || true
134148
},
135-
evt.options, { downloadFrom: config.downloadFrom },
149+
evt.options,
136150
config && config.start
137-
),
138-
_spinner = SCli.spinner();
151+
);
139152
if (options.create) {
140-
dynamodb.start(options).then(function() {
141-
console.log(""); // seperator
142-
self.table(evt).then(resolve, reject);
143-
});
153+
dynamodbLocal.start(options);
154+
console.log(""); // seperator
155+
self.table(evt);
156+
resolve();
144157
} else {
145-
_spinner.start();
146-
dynamodb.start(options, _spinner).then(resolve, reject);
158+
dynamodbLocal.start(options);
159+
console.log("");
160+
resolve();
147161
}
148162
});
149163
}

package.json

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"name": "serverless-dynamodb-local",
3-
"version": "0.1.0",
4-
"engines": {
5-
"node": ">=4.0"
6-
},
7-
"description": "Serverless dynamodb local plugin",
8-
"author": "99xtechnology.com",
9-
"license": "MIT",
10-
"repository": {
11-
"type": "git",
12-
"url": "https://github.com/99xt/serverless-dynamodb-local"
13-
},
14-
"keywords": [
2+
"name": "serverless-dynamodb-local",
3+
"version": "0.1.0",
4+
"engines": {
5+
"node": ">=4.0"
6+
},
7+
"description": "Serverless dynamodb local plugin",
8+
"author": "99xtechnology.com",
9+
"license": "MIT",
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/99xt/serverless-dynamodb-local"
13+
},
14+
"keywords": [
1515
"serverless framework plugin",
1616
"serverless applications",
1717
"serverless plugins",
@@ -26,20 +26,21 @@
2626
"amazon web services",
2727
"serverless.com"
2828
],
29-
"main": "index.js",
30-
"bin": {},
31-
"scripts": {
32-
"test": "echo \"Warning: no test specified\" && exit 0"
33-
},
34-
"devDependencies": {
35-
"chai": "^3.2.0",
36-
"mocha": "^2.2.5"
37-
},
38-
"dependencies": {
39-
"aws-sdk": "^2.3.19",
40-
"bluebird": "^3.0.6",
41-
"lodash": "^4.13.1",
42-
"mkdirp": "^0.5.0",
43-
"tar": "^2.0.0"
44-
}
29+
"main": "index.js",
30+
"bin": {},
31+
"scripts": {
32+
"test": "echo \"Warning: no test specified\" && exit 0"
33+
},
34+
"devDependencies": {
35+
"chai": "^3.2.0",
36+
"mocha": "^2.2.5"
37+
},
38+
"dependencies": {
39+
"aws-sdk": "^2.3.19",
40+
"bluebird": "^3.0.6",
41+
"dynamodb-localhost": "0.0.2",
42+
"lodash": "^4.13.1",
43+
"mkdirp": "^0.5.0",
44+
"tar": "^2.0.0"
45+
}
4546
}

0 commit comments

Comments
 (0)