Skip to content

Commit

Permalink
Update dependencies (#50)
Browse files Browse the repository at this point in the history
* Export OperationTypeNode as value (graphql#3316)

* Convert const "enum-like" maps to TS enums (graphql#3317)

* Deprecate 'ASTKindToNode' (graphql#3318)

* Add message that we only support TS >= 4.1.0 (graphql#3319)

* Update deps (graphql#3320)

* 16.0.0-rc.5

* jsutils: add test for Path functions (graphql#2478)

Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>

* lexer: fix expression to decode surrogate pairs (graphql#3278)

* Lexer: use standard JS functions to handle Unicode (graphql#3322)

* GraphQLError-test: merge check of source with rest of the properties (graphql#3324)

* GraphQLError: fix empty `locations` if error got nodes without locations (graphql#3325)

* GraphQLError: enumerate only spec prescribed properties (graphql#3326)

* GraphQLField: relax default value of TArgs to `any` (graphql#3328)

* 16.0.0-rc.6

* Fix release instructions (graphql#3329)

* use GITHUB_TOKEN (graphql#3330)

* GraphQLError: Add test to check order of fields in JSON.stringify (graphql#3336)

* Fix TS error caused by importing internal files directly (graphql#3339)

* Use default GITHUB_ACTOR if unset (graphql#3331)

Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>

* 16.0.0-rc.7

* version: force proper typing on version literals

Types should be generic and stay the same across different versions
E.g. `preReleaseTag` should be typed `string | null` even if it's a
`null` literal for this particular release

* build-npm: fix type inference during TS declarations build

* version-test: fix validation of `versionInfo.preReleaseTag` (graphql#3345)

* 16.0.0

* checkgit.sh: Added a check for local modifications (graphql#3347)

* GraphQLError-test: text how extensions is inherited from originalError (graphql#3348)

* fix lockfile

* update graphql version

* Remove unused upstream file

* Upgrade deps

* add changeset

Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>
Co-authored-by: Christoph Zwerschke <cito@online.de>
  • Loading branch information
3 people committed Nov 1, 2021
1 parent ecfd106 commit 9e9653f
Show file tree
Hide file tree
Showing 8 changed files with 2,142 additions and 1,710 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-lemons-switch.md
@@ -0,0 +1,5 @@
---
'graphql-executor': patch
---

Update dependencies
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Expand Up @@ -112,9 +112,7 @@ jobs:
strategy:
matrix:
node_version_to_setup: [12, 14, 16]
graphql_version:
- 15
- rc
graphql_version: [15, 16]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -146,9 +144,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
graphql_version:
- 15
- rc
graphql_version: [15, 16]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -274,7 +270,7 @@ jobs:
- name: Deploy to `npm` branch
run: npm run gitpublish:npm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy-to-deno-branch:
name: Deploy to `deno` branch
Expand Down Expand Up @@ -310,4 +306,4 @@ jobs:
- name: Deploy to `deno` branch
run: npm run gitpublish:deno
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions integrationTests/ts/internalImports-test.ts
@@ -0,0 +1,8 @@
import type { NameNode } from 'graphql/language';

// Parser class is internal API so so any changes to it are never considered breaking changes.
// We just want to test that we are able to import it.
import { Parser } from 'graphql/language/parser';

const parser = new Parser('foo');
const ast: NameNode = parser.parseName();
3,736 changes: 2,054 additions & 1,682 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions package.json
Expand Up @@ -5,17 +5,10 @@
"license": "MIT",
"main": "index",
"module": "index.mjs",
"types": "NotSupportedTSVersion.d.ts",
"typesVersions": {
">=4.1.0": {
"*": [
"index.d.ts"
],
"*/*": [
"*/index.d.ts"
],
"*/*/*": [
"*/*"
"*"
]
}
},
Expand Down Expand Up @@ -61,7 +54,7 @@
"directory": "npmDist"
},
"peerDependencies": {
"graphql": "^15.0.0 || ^16.0.0-rc"
"graphql": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"@babel/core": "7.15.8",
Expand Down
34 changes: 26 additions & 8 deletions resources/build-npm.js
Expand Up @@ -35,33 +35,51 @@ if (require.main === module) {
}
}

const tsProgram = ts.createProgram(['src/index.ts'], {
...ts.getDefaultCompilerOptions(),
// Based on https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#getting-the-dts-from-a-javascript-file
const tsConfig = JSON.parse(
fs.readFileSync(require.resolve('../tsconfig.json'), 'utf-8'),
);
assert(
tsConfig.compilerOptions,
'"tsconfig.json" should have `compilerOptions`',
);
const tsOptions = {
...tsConfig.compilerOptions,
noEmit: false,
declaration: true,
declarationDir: './npmDist',
emitDeclarationOnly: true,
});
};

const tsResult = tsProgram.emit(undefined, (filepath, body) => {
const tsHost = ts.createCompilerHost(tsOptions);
tsHost.writeFile = (filepath, body) => {
writeGeneratedFile(filepath, body);
});
};

const tsProgram = ts.createProgram(['src/index.ts'], tsOptions, tsHost);
const tsResult = tsProgram.emit();
assert(
!tsResult.emitSkipped,
'Fail to generate `*.d.ts` files, please run `npm run check`',
);

assert(packageJSON.types, 'Missing "types".');
assert(packageJSON.types === undefined, 'Unexpected "types" in package.json');
const supportedTSVersions = Object.keys(packageJSON.typesVersions);
assert(
supportedTSVersions.length === 1,
'Property "typesVersions" should have exactly one key.',
);
// TODO: revisit once TS implements https://github.com/microsoft/TypeScript/issues/44795
// TODO: revisit once TS implements https://github.com/microsoft/TypeScript/issues/32166
const notSupportedTSVersionFile = 'NotSupportedTSVersion.d.ts';
fs.writeFileSync(
path.join('./npmDist', packageJSON.types),
path.join('./npmDist', notSupportedTSVersionFile),
// Provoke syntax error to show this message
`"Package 'graphql' support only TS versions that are ${supportedTSVersions[0]}".`,
);
packageJSON.typesVersions = {
...packageJSON.typesVersions,
'*': { '*': [notSupportedTSVersionFile] },
};

fs.copyFileSync('./LICENSE', './npmDist/LICENSE');
fs.copyFileSync('./README.md', './npmDist/README.md');
Expand Down
10 changes: 7 additions & 3 deletions resources/gitpublish.sh
Expand Up @@ -23,19 +23,23 @@ if [ -z "${DIST_DIR}" ]; then
exit 1;
fi;

if [ -z "${GH_TOKEN}" ]; then
echo 'Must provide GH_TOKEN as environment variable!'
if [ -z "${GITHUB_TOKEN}" ]; then
echo 'Must provide GITHUB_TOKEN as environment variable!'
exit 1;
fi;

if [ -z "${GITHUB_ACTOR}" ]; then
echo 'Must provide GITHUB_ACTOR as environment variable!'
fi;

if [ ! -d $DIST_DIR ]; then
echo "Directory '${DIST_DIR}' does not exist!"
exit 1;
fi;

# Create empty directory
rm -rf $BRANCH
git clone -b $BRANCH -- "https://${GITHUB_ACTOR}:${GH_TOKEN}@github.com/yaacovCR/graphql-executor.git" $BRANCH
git clone -b $BRANCH -- "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/yaacovCR/graphql-executor.git" $BRANCH

# Remove existing files first
rm -rf $BRANCH/**/*
Expand Down
36 changes: 36 additions & 0 deletions src/jsutils/__tests__/Path-test.ts
@@ -0,0 +1,36 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';

import { addPath, pathToArray } from '../Path';

describe('Path', () => {
it('can create a Path', () => {
const first = addPath(undefined, 1, 'First');

expect(first).to.deep.equal({
prev: undefined,
key: 1,
typename: 'First',
});
});

it('can add a new key to an existing Path', () => {
const first = addPath(undefined, 1, 'First');
const second = addPath(first, 'two', 'Second');

expect(second).to.deep.equal({
prev: first,
key: 'two',
typename: 'Second',
});
});

it('can convert a Path to an array of its keys', () => {
const root = addPath(undefined, 0, 'Root');
const first = addPath(root, 'one', 'First');
const second = addPath(first, 2, 'Second');

const path = pathToArray(second);
expect(path).to.deep.equal([0, 'one', 2]);
});
});

0 comments on commit 9e9653f

Please sign in to comment.