Skip to content

Commit f274358

Browse files
committed
Added dynamodb-localhost plugin.start method not converted fully.
1 parent bbf687f commit f274358

File tree

2 files changed

+53
-37
lines changed

2 files changed

+53
-37
lines changed

index.js

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

89
module.exports = function(S) { // Always pass in the ServerlessPlugin Class
910
const SCli = require(S.getServerlessPath('utils/cli'));
@@ -45,6 +46,12 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
4546
context: 'dynamodb',
4647
contextAction: 'remove'
4748
});
49+
S.addAction(this.install.bind(this), {
50+
handler: 'dynamodbInstall',
51+
description: 'Install dynamodb local database. This is a single time operation.',
52+
context: 'dynamodb',
53+
contextAction: 'install'
54+
});
4855
S.addAction(this.start.bind(this), {
4956
handler: 'dynamodbStart',
5057
description: 'Start dynamodb local database',
@@ -101,7 +108,17 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
101108
*/
102109

103110
remove() {
104-
return dynamodb.remove();
111+
//return dynamodb.remove();
112+
return dynamodbLocal.remove(function(){
113+
114+
});
115+
}
116+
117+
install() {
118+
//return dynamodb.remove();
119+
return dynamodbLocal.install(function(){
120+
121+
});
105122
}
106123

107124
table(evt) {
@@ -132,18 +149,16 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
132149
options = _.merge({
133150
sharedDb: evt.options.sharedDb || true
134151
},
135-
evt.options, { downloadFrom: config.downloadFrom },
152+
evt.options,
136153
config && config.start
137-
),
138-
_spinner = SCli.spinner();
154+
);
139155
if (options.create) {
140-
dynamodb.start(options).then(function() {
156+
dynamodbLocal.start(options).then(function() {
141157
console.log(""); // seperator
142158
self.table(evt).then(resolve, reject);
143159
});
144160
} else {
145-
_spinner.start();
146-
dynamodb.start(options, _spinner).then(resolve, reject);
161+
dynamodbLocal.start(options).then(resolve, reject);
147162
}
148163
});
149164
}

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)