Skip to content

Commit 4aa9d61

Browse files
authored
Merge pull request #58 from bboure/feat/ci
Add tests and auto-deploy
2 parents 29fa15e + 3367a70 commit 4aa9d61

File tree

6 files changed

+906
-750
lines changed

6 files changed

+906
-750
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
tests:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Install dependencies
15+
run: |
16+
yarn install --frozen-lockfile
17+
- name: Run tests
18+
run: yarn run lint

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- uses: actions/setup-node@v1
14+
with:
15+
node-version: 12
16+
- run: yarn install
17+
- uses: JS-DevTools/npm-publish@v1
18+
with:
19+
token: ${{ secrets.NPM_TOKEN }}

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"singleQuote": true,
5+
"trailingComma": "all"
6+
}

package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"url": "git+https://github.com/bboure/serverless-appsync-simulator.git"
1212
},
1313
"scripts": {
14+
"lint": "eslint",
1415
"build": "babel src/ -d lib/ --delete-dir-on-start",
1516
"prepare": "yarn run build",
1617
"start-dev": "yarn run build -w --verbose"
@@ -19,27 +20,27 @@
1920
"/lib"
2021
],
2122
"dependencies": {
22-
"amplify-appsync-simulator": "^1.23.3",
23-
"amplify-nodejs-function-runtime-provider": "^1.1.5",
24-
"aws-sdk": "^2.720.0",
25-
"axios": "^0.19.2",
26-
"cfn-resolver-lib": "^1.1.6",
23+
"amplify-appsync-simulator": "^1.23.9",
24+
"amplify-nodejs-function-runtime-provider": "^1.1.6",
25+
"aws-sdk": "^2.792.0",
26+
"axios": "^0.21.0",
27+
"cfn-resolver-lib": "^1.1.7",
2728
"dataloader": "^2.0.0",
28-
"lodash": "^4.17.19",
29+
"lodash": "^4.17.20",
2930
"merge-graphql-schemas": "^1.5.8"
3031
},
3132
"devDependencies": {
32-
"@babel/cli": "^7.10.5",
33-
"@babel/core": "^7.10.5",
34-
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
35-
"@babel/preset-env": "^7.10.4",
33+
"@babel/cli": "^7.12.1",
34+
"@babel/core": "^7.12.3",
35+
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
36+
"@babel/preset-env": "^7.12.1",
3637
"babel-eslint": "^10.1.0",
37-
"eslint": "^7.5.0",
38-
"eslint-config-airbnb-base": "^14.2.0",
39-
"eslint-plugin-import": "^2.22.0",
38+
"eslint": "^7.13.0",
39+
"eslint-config-airbnb-base": "^14.2.1",
40+
"eslint-plugin-import": "^2.22.1",
4041
"eslint-plugin-node": "^11.1.0",
4142
"eslint-plugin-promise": "^4.2.1",
42-
"eslint-plugin-standard": "^4.0.1"
43+
"eslint-plugin-standard": "^4.1.0"
4344
},
4445
"keywords": [
4546
"serverless",

src/index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,23 @@ class ServerlessAppSyncSimulator {
113113

114114
const keyValueArrayToObject = (mapping) => {
115115
if (Array.isArray(mapping)) {
116-
return mapping.reduce((acc, { key, value }) => (
117-
{ ...acc, [key]: value }
118-
), {});
116+
return mapping.reduce(
117+
(acc, { key, value }) => ({ ...acc, [key]: value }),
118+
{},
119+
);
119120
}
120121
return mapping;
121122
};
122123

123124
this.resourceResolvers = {
124-
RefResolvers: { ...refResolvers, ...keyValueArrayToObject(this.options.refMap) },
125+
RefResolvers: {
126+
...refResolvers,
127+
...keyValueArrayToObject(this.options.refMap),
128+
},
125129
'Fn::GetAttResolvers': keyValueArrayToObject(this.options.getAttMap),
126-
'Fn::ImportValueResolvers': keyValueArrayToObject(this.options.importValueMap),
130+
'Fn::ImportValueResolvers': keyValueArrayToObject(
131+
this.options.importValueMap,
132+
),
127133
};
128134
}
129135

0 commit comments

Comments
 (0)