Skip to content

Commit f70d7ca

Browse files
committed
docs: add publishing commands
1 parent ff042f4 commit f70d7ca

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

readme.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ module.exports = async () => {
9898

9999
await serverless.init();
100100
const service = await serverless.variables.populateService();
101-
const resources = service.resources.filter(r => Object.keys(r).includes("Resources"))[0]
101+
const resources = service.resources.filter(r => Object.keys(r).includes('Resources'))[0];
102102

103103
const tables = Object.keys(resources)
104104
.map(name => resources[name])
@@ -108,40 +108,37 @@ module.exports = async () => {
108108
return {
109109
tables,
110110
port: 8000
111-
}
112-
}
111+
};
112+
};
113113
```
114114

115-
Or read table definitions from a CloudFormation template (example handles a !Sub on TableName, i.e. TableName: !Sub "${env}-users" ):
115+
Or read table definitions from a CloudFormation template (example handles a !Sub on TableName, i.e. TableName: !Sub "\${env}-users" ):
116116

117117
```js
118-
119118
const yaml = require('js-yaml');
120-
const fs = require('fs');
119+
const fs = require('fs');
121120
const {CLOUDFORMATION_SCHEMA} = require('cloudformation-js-yaml-schema');
122121

123122
module.exports = async () => {
124-
125-
const cf = yaml.safeLoad(
126-
fs.readFileSync('../cf-templates/example-stack.yaml', 'utf8'),
127-
{schema: CLOUDFORMATION_SCHEMA }
128-
);
123+
const cf = yaml.safeLoad(fs.readFileSync('../cf-templates/example-stack.yaml', 'utf8'), {
124+
schema: CLOUDFORMATION_SCHEMA
125+
});
129126
var tables = [];
130-
Object.keys(cf.Resources).forEach((item) => {
127+
Object.keys(cf.Resources).forEach(item => {
131128
tables.push(cf.Resources[item]);
132129
});
133130

134131
tables = tables
135132
.filter(r => r.Type === 'AWS::DynamoDB::Table')
136-
.map((r) => {
133+
.map(r => {
137134
let table = r.Properties;
138-
if (typeof x.TableName === "object") {
139-
table.TableName = table.TableName.data.replace('${env}','test');
135+
if (typeof x.TableName === 'object') {
136+
table.TableName = table.TableName.data.replace('${env}', 'test');
140137
}
141138
delete table.TimeToLiveSpecification; //errors on dynamo-local
142139
return table;
143140
});
144-
141+
145142
return {
146143
tables,
147144
port: 8000
@@ -205,6 +202,15 @@ Perhaps something is using your port specified in `jest-dynamodb-config.js`.
205202

206203
- [jest-mongodb](https://github.com/shelfio/jest-mongodb)
207204

205+
## Publish
206+
207+
```sh
208+
$ git checkout master
209+
$ yarn version
210+
$ yarn publish
211+
$ git push origin master --tags
212+
```
213+
208214
## License
209215

210216
MIT © [Shelf](https://shelf.io)

0 commit comments

Comments
 (0)