Skip to content

Commit 4eae556

Browse files
authored
Merge pull request #17 from opencomponents/prettier
prettier
2 parents b7bca07 + ef14073 commit 4eae556

File tree

11 files changed

+2212
-852
lines changed

11 files changed

+2212
-852
lines changed

.babelrc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"presets": [
3-
"latest",
4-
"stage-3"
5-
]
2+
"presets": ["env"],
3+
"plugins": ["transform-async-to-generator", "transform-object-rest-spread"]
64
}

.eslintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"extends": "airbnb",
33
"rules": {
4-
"jsx-a11y/img-has-alt": "off",
4+
"arrow-parens": "off",
55
"comma-dangle": "off",
66
"import/no-extraneous-dependencies": "off",
7-
"jsx-a11y/href-no-hash": "off"
7+
"jsx-a11y/href-no-hash": "off",
8+
"jsx-a11y/img-has-alt": "off"
89
},
910
"env": {
1011
"jest": true

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ const options = {
2929
registry.app.use('/graphql', graphql(options));
3030
```
3131

32-
> N.B.: `configuration` in the example above is the object used to configure the OpenComponents Registry
32+
> N.B.: `configuration` in the example above is the object used to configure the OpenComponents Registry.
3333
3434
![query-registry](query-registry-v1.1.3.png "query-registry")

__tests__/__snapshots__/index.test.js.snap

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Array [
88
],
99
Array [
1010
"Content-Length",
11-
"789",
11+
"1108",
1212
],
1313
]
1414
`;
@@ -61,6 +61,32 @@ Object {
6161
"repository": null,
6262
"version": "4.5.6",
6363
},
64+
Object {
65+
"allVersions": Array [
66+
"0.40.7",
67+
"0.40.1",
68+
"0.39.8",
69+
"0.38.1",
70+
"0.37.11",
71+
"0.37.8",
72+
"0.37.4",
73+
"0.37.2",
74+
"0.37.0",
75+
"0.36.27",
76+
"0.36.26",
77+
"0.36.25",
78+
"0.36.21",
79+
"0.36.13",
80+
"0.36.4",
81+
"0.36.1",
82+
],
83+
"author": null,
84+
"description": "The OpenComponents client-side javascript client",
85+
"name": "oc-client",
86+
"parameters": Array [],
87+
"repository": null,
88+
"version": "0.40.7",
89+
},
6490
],
6591
"registry": Object {
6692
"dependencies": Array [

__tests__/__snapshots__/shema.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ GraphQLSchema {
8282
"__Type": "__Type",
8383
"__TypeKind": "__TypeKind",
8484
},
85-
"astNode": null,
85+
"astNode": undefined,
8686
}
8787
`;

__tests__/index.test.js

Lines changed: 73 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,48 +69,83 @@ describe('index', () => {
6969

7070
test('expect res setHeader and end to match snapshot', async () => {
7171
fetch.mockResponses(
72-
[JSON.stringify({
73-
href: options.baseUrl,
74-
ocVersion: '1.2.3',
75-
type: 'mock-registry'
76-
})],
77-
[JSON.stringify({
78-
name: 'oc-apod',
79-
description: 'This component displays picture, title, description and date of the NASA\'s Astronomy Picture of the Day',
80-
version: '1.3.0',
81-
allVersions: ['1.0.0', '1.1.0', '1.1.1', '1.2.0', '1.3.0'],
82-
oc: {
83-
parameters: {
84-
apiKey: {
85-
type: 'string',
86-
mandatory: true,
87-
example: 'DEMO_KEY',
88-
description: 'The NASA Open APIs key'
72+
[
73+
JSON.stringify({
74+
href: options.baseUrl,
75+
ocVersion: '1.2.3',
76+
type: 'mock-registry'
77+
})
78+
],
79+
[
80+
JSON.stringify({
81+
name: 'oc-apod',
82+
description:
83+
"This component displays picture, title, description and date of the NASA's Astronomy Picture of the Day",
84+
version: '1.3.0',
85+
allVersions: ['1.0.0', '1.1.0', '1.1.1', '1.2.0', '1.3.0'],
86+
oc: {
87+
parameters: {
88+
apiKey: {
89+
type: 'string',
90+
mandatory: true,
91+
example: 'DEMO_KEY',
92+
description: 'The NASA Open APIs key'
93+
}
8994
}
9095
}
91-
}
92-
})],
93-
[JSON.stringify({
94-
components: [
95-
`${options.baseUrl}oc-a-component`
96-
]
97-
})],
98-
[JSON.stringify({
99-
name: 'oc-a-component',
100-
description: 'Awesome OpenComponent',
101-
version: '4.5.6',
102-
allVersions: ['4.5.4', '4.5.5', '4.5.6'],
103-
oc: {
104-
parameters: {
105-
id: {
106-
type: 'string',
107-
mandatory: true,
108-
example: '789',
109-
description: 'The Id'
96+
})
97+
],
98+
[
99+
JSON.stringify({
100+
components: [
101+
`${options.baseUrl}oc-a-component`,
102+
`${options.baseUrl}oc-client`
103+
]
104+
})
105+
],
106+
[
107+
JSON.stringify({
108+
name: 'oc-a-component',
109+
description: 'Awesome OpenComponent',
110+
version: '4.5.6',
111+
allVersions: ['4.5.4', '4.5.5', '4.5.6'],
112+
oc: {
113+
parameters: {
114+
id: {
115+
type: 'string',
116+
mandatory: true,
117+
example: '789',
118+
description: 'The Id'
119+
}
110120
}
111121
}
112-
}
113-
})]
122+
})
123+
],
124+
[
125+
JSON.stringify({
126+
name: 'oc-client',
127+
description: 'The OpenComponents client-side javascript client',
128+
version: '0.40.7',
129+
allVersions: [
130+
'0.40.7',
131+
'0.40.1',
132+
'0.39.8',
133+
'0.38.1',
134+
'0.37.11',
135+
'0.37.8',
136+
'0.37.4',
137+
'0.37.2',
138+
'0.37.0',
139+
'0.36.27',
140+
'0.36.26',
141+
'0.36.25',
142+
'0.36.21',
143+
'0.36.13',
144+
'0.36.4',
145+
'0.36.1'
146+
]
147+
})
148+
]
114149
);
115150

116151
const req = {
@@ -131,4 +166,3 @@ describe('index', () => {
131166
expect(JSON.parse(res.end.mock.calls)).toMatchSnapshot();
132167
});
133168
});
134-

dist/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
44

55
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
66

7-
/* eslint-disable arrow-body-style */
8-
97
var graphqlHTTP = require('express-graphql');
108
var fetch = require('node-fetch');
119
var schema = require('./schema');
@@ -52,7 +50,9 @@ var makeComponent = function () {
5250

5351
if (info.oc && info.oc.parameters) {
5452
parameters = Object.keys(info.oc.parameters).map(function (key) {
55-
return _extends({ key: key }, info.oc.parameters[key]);
53+
return _extends({
54+
key: key
55+
}, info.oc.parameters[key]);
5656
});
5757
}
5858

0 commit comments

Comments
 (0)