Skip to content

Commit bc5947b

Browse files
authored
Correct the merge/commit handling to generate correct jquery queries. (f#62)
1 parent 4d3c2eb commit bc5947b

File tree

6 files changed

+2754
-98
lines changed

6 files changed

+2754
-98
lines changed

Makefile

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

graphql.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,12 @@
398398
mergedVariables[method][variable] = merge.variables[matchingKey]
399399
return '$' + variable.split('!')[0]
400400
})
401+
// remove the wrapping {}
402+
query = query.replace(/^\{|\}\s*$/g, '').trim()
403+
401404
var alias = query.trim().match(/^[^\(]+\:/)
402405
if (!alias) {
403-
alias = query.replace(/^\{|\}$/gm, '').trim().match(/^[^\(\{]+/)[0] + ':'
406+
alias = query.match(/^[^\(\{]+/)[0] + ':'
404407
} else {
405408
query = query.replace(/^[^\(]+\:/, '')
406409
}

graphql.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
"graphql.min.js"
1313
],
1414
"scripts": {
15-
"test": "make test",
16-
"build": "make build"
15+
"test": "jest --coverage",
16+
"build": "uglifyjs graphql.js -o graphql.min.js"
1717
},
1818
"repository": {
1919
"type": "git",
2020
"url": "git+https://github.com/f/graphql-client.git"
2121
},
22+
"devDependencies": {
23+
"jest": "^27.4.5",
24+
"jest-mock-random": "^1.1.1",
25+
"uglify-js": "^3.14.5"
26+
},
2227
"keywords": [
2328
"graphql",
2429
"graphql-client",

0 commit comments

Comments
 (0)