Skip to content

Commit e7e114c

Browse files
committed
move exports to top level
1 parent 0999652 commit e7e114c

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

javascript_client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"ts-jest": "^25.2.0"
2222
},
2323
"scripts": {
24-
"test": "jest",
24+
"test": "tsc && jest",
2525
"prepublishOnly": "tsc"
2626
},
2727
"dependencies": {
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1-
import graphqlRubyClient from "../index"
1+
import {sync} from "../index"
2+
import childProcess from "child_process"
23

3-
it("exports the sync function", () => {
4-
expect(graphqlRubyClient.sync).toBeInstanceOf(Function)
4+
describe("root module", () => {
5+
it("exports the sync function", () => {
6+
expect(sync).toBeInstanceOf(Function)
7+
})
8+
9+
it("exports things at root level", () => {
10+
// Make sure that the compiled JavaScript
11+
// has all the expected exports.
12+
var testScript = "var client = require('./dist/index'); console.log(JSON.stringify({ keys: Object.keys(client).sort() }))"
13+
var output = childProcess.execSync("node -e \"" + testScript + "\"")
14+
var outputData = JSON.parse(output.toString())
15+
var expectedKeys = [
16+
"AblyLink",
17+
"ActionCableLink",
18+
"PusherLink",
19+
"addGraphQLSubscriptions",
20+
"createRelaySubscriptionHandler",
21+
"generateClient",
22+
"sync"
23+
]
24+
expect(outputData.keys).toEqual(expectedKeys)
25+
})
526
})

javascript_client/src/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import sync from "./sync"
22
import { generateClient } from "./sync/generateClient"
3-
export default {
3+
import ActionCableLink from "./subscriptions/ActionCableLink"
4+
import PusherLink from "./subscriptions/PusherLink"
5+
import AblyLink from "./subscriptions/AblyLink"
6+
import addGraphQLSubscriptions from "./subscriptions/addGraphQLSubscriptions"
7+
import createHandler from "./subscriptions/createHandler"
8+
9+
export {
410
sync,
5-
generateClient
11+
generateClient,
12+
ActionCableLink,
13+
PusherLink,
14+
AblyLink,
15+
addGraphQLSubscriptions,
16+
createHandler as createRelaySubscriptionHandler,
617
}

0 commit comments

Comments
 (0)