Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version to client instance #1038

Merged
merged 6 commits into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Expect active development and potentially significant breaking changes in the `0

- ...

### 0.5.21

- Include a `version` field on every `ApolloClient` instance that represents the version of the 'apollo-client' package used to create it. [PR #1038](https://github.com/apollostack/apollo-client/pull/1038)

### 0.5.20

- Attach to `window` for devtools if not in production, so that improperly configured environments do get the dev tools. [PR #1037](https://github.com/apollostack/apollo-client/pull/1037)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-client",
"version": "0.5.20",
"version": "0.5.21",
"description": "A simple yet functional GraphQL client.",
"main": "./lib/src/index.js",
"typings": "./lib/src/index.d.ts",
Expand Down
6 changes: 4 additions & 2 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ cd ./lib/src && cp -r ./ ../../npm/ && cd ../../
node -e "var package = require('./package.json'); \
delete package.babel; delete package.scripts; delete package.options; \
package.main = 'index.js'; \
require('fs').writeFileSync('./npm/package.json', JSON.stringify(package, null, 2));"
var fs = require('fs'); \
fs.writeFileSync('./npm/version.js', 'exports.version = \"' + package.version + '\"'); \
fs.writeFileSync('./npm/package.json', JSON.stringify(package, null, 2));"

cp README.md npm/
cp LICENSE npm/
cp .npmignore npm/

echo 'deploying to npm...'
cd npm && npm publish
cd npm && npm publish --tag test-version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you maybe forget to remove this after testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg I am literally the worst.

8 changes: 8 additions & 0 deletions src/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ import {
addFragmentsToDocument,
} from './queries/getFromAST';

import {
version,
} from './version';

/**
* This type defines a "selector" function that receives state from the Redux store
* and returns the part of it that is managed by ApolloClient
Expand Down Expand Up @@ -108,6 +112,8 @@ export default class ApolloClient {
public shouldForceFetch: boolean;
public dataId: IdGetter;
public fieldWithArgs: (fieldName: string, args?: Object) => string;
public version: string;

private devToolsHookCb: Function;

/**
Expand Down Expand Up @@ -243,6 +249,8 @@ export default class ApolloClient {
if (connectToDevTools) {
(window as any).__APOLLO_CLIENT__ = this;
}

this.version = version;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const version = 'local';