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

Version 7; Upgrade dependancies and set minimum node to ^14.21.3 #157

Merged
merged 6 commits into from
Jul 19, 2023
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
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/es
/lib
/node8
23 changes: 14 additions & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
"plugins": [
"prettier"
],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"rules": {
"no-underscore-dangle": 0,
"arrow-body-style": 0,
"arrow-parens": 0,
"prefer-template": 0,
"no-use-before-define": 0,
"no-else-return": 0,
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}],
"prettier/prettier": ["error"],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}
],
"prettier/prettier": [
"error"
],
"no-plusplus": 0,
"prefer-destructuring": 0,
"no-prototype-builtins": 0,
Expand Down
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[ignore]
<PROJECT_ROOT>/lib/.*
<PROJECT_ROOT>/es/.*
<PROJECT_ROOT>/node8/.*
.*/node_modules/ajv.*
.*/node_modules/acorn.*
.*/node_modules/async.*
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12, 14, 16]
node-version: [14, 16, 18]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules
Expand All @@ -25,28 +25,28 @@ jobs:
env:
CI: true
- name: Test – Eslint, Tslint, Tscheck
if: ${{ always() && matrix.node-version == '12' }}
if: ${{ always() && matrix.node-version == '14' }}
run: yarn lint
- name: Flow checks
if: ${{ always() && matrix.node-version == '12' }}
if: ${{ always() && matrix.node-version == '14' }}
run: yarn flow
- name: Publish Test Report
if: ${{ always() && matrix.node-version == '12' }}
if: ${{ always() && matrix.node-version == '14' }}
uses: mikepenz/action-junit-report@v2
with:
check_name: JUnit Annotations for Node ${{ matrix.node-version }}
report_paths: '**/coverage/junit/**/*.xml'
report_paths: "**/coverage/junit/**/*.xml"

publish:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta'
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- name: Use Node.js 14
uses: actions/setup-node@v3
with:
node-version: 12
node-version: 14
- name: Install node_modules
run: yarn install
- name: Build
Expand All @@ -56,4 +56,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ node_modules
# Transpiled code
/es
/lib
/node8
/mjs

coverage
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ If this error occurs you can do one of the following:
- Explicitly install core-js v2. E.g.
- `yarn add [email protected]
- Try referencing one of the non default imports:
- `import { RelayNetworkLayer } from 'react-relay-network-modern/node8';`
- `import { RelayNetworkLayer } from 'react-relay-network-modern/es';`

### Different builds
Expand All @@ -58,9 +57,6 @@ This library contains different builds for any purposes:
// last 5 versions, ie 9, defaults
import { RelayNetworkLayer } from 'react-relay-network-modern';

// For SSR on node 8 and above (native async/await)
import { RelayNetworkLayer } from 'react-relay-network-modern/node8';

// Source code without Flowtype declarations
import { RelayNetworkLayer } from 'react-relay-network-modern/es';
```
Expand Down
13 changes: 0 additions & 13 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ module.exports = {
es: {
plugins: ['@babel/plugin-proposal-class-properties'],
},
node8: {
presets: [
[
'@babel/preset-env',
{
targets: {
node: '8.0.0',
},
modules: 'commonjs',
},
],
],
},
test: {
presets: [
[
Expand Down
61 changes: 31 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"version": "0.0.0-semantically-released",
"description": "Network Layer for React Relay and Express (Batch Queries, AuthToken, Logging, Retry)",
"engines": {
"node": ">=10.17.0"
"node": ">=14.21.3"
},
"files": [
"es",
"lib",
"node8"
"lib"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -32,61 +31,63 @@
},
"homepage": "https://github.com/relay-tools/react-relay-network-modern#readme",
"dependencies": {
"core-js": "^3.0.0",
"@types/node": "^18.14.6",
"core-js": "^3.29.0",
"extract-files": "^9.0.0"
},
"peerDependencies": {
"relay-runtime": ">=1.4.0"
},
"devDependencies": {
"@babel/cli": "7.16.0",
"@babel/core": "7.16.0",
"@babel/plugin-proposal-class-properties": "7.16.0",
"@babel/plugin-proposal-object-rest-spread": "7.16.0",
"@babel/plugin-proposal-optional-chaining": "^7.4.4",
"@babel/cli": "7.21.0",
"@babel/core": "7.21.0",
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/plugin-transform-flow-strip-types": "7.16.0",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.16.0",
"@babel/preset-env": "7.20.2",
"@babel/preset-flow": "7.16.0",
"@babel/register": "7.16.0",
"@babel/register": "7.21.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "^24.8.0",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^4.3.0",
"eslint-module-utils": "^2.4.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-prettier": "^3.1.0",
"fetch-mock": "^7.3.3",
"babel-jest": "^29.4.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.35.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.6.0",
"eslint-module-utils": "^2.7.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"fetch-mock": "^9.11.0",
"flow-bin": "0.101.0",
"form-data": "^2.3.3",
"jest": "^24.8.0",
"prettier": "^1.18.2",
"form-data": "^4.0.0",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"prettier": "^2.8.4",
"relay-runtime": "^4.0.0",
"rimraf": "^2.6.3",
"rimraf": "^4.3.0",
"semantic-release": "^15.13.12",
"tslint": "^5.17.0",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"typescript": "^3.5.1"
"tslint-plugin-prettier": "^2.3.0",
"typescript": "^4.8.4"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"jest": {
"testEnvironment": "jsdom",
"roots": [
"<rootDir>/src"
]
},
"scripts": {
"build": "npm run build-lib && npm run build-es && npm run build-node8",
"build": "npm run build-lib && npm run build-es",
"build-lib": "rimraf lib && BABEL_ENV=lib babel src --ignore __tests__,__mocks__ -d lib && COPY_TO_FOLDER=lib npm run build-flow && COPY_TO_FOLDER=lib npm run build-dts ",
"build-es": "rimraf es && BABEL_ENV=es babel src --ignore __tests__,__mocks__ -d es && COPY_TO_FOLDER=es npm run build-flow && COPY_TO_FOLDER=es npm run build-dts",
"build-node8": "rimraf node8 && BABEL_ENV=node8 babel src --ignore __tests__,__mocks__ -d node8 && COPY_TO_FOLDER=node8 npm run build-flow && COPY_TO_FOLDER=node8 npm run build-dts",
"build-flow": "echo `$1` && find ./src -name '*.js' -not -path '*/__*' | while read filepath; do cp $filepath `echo ./${COPY_TO_FOLDER:-lib}$filepath | sed 's/.\\/src\\//\\//g'`.flow; done",
"build-dts": "echo `$1` && find ./src -name '*d.ts' -not -path '*/__*' | while read filepath; do cp $filepath `echo ./${COPY_TO_FOLDER:-lib}$filepath | sed 's/.\\/src\\//\\//g'`; done",
"lint": "npm run eslint && npm run tslint && npm run tscheck",
Expand Down
2 changes: 1 addition & 1 deletion src/express-middleware/graphqlBatchHTTPWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

type ExpressMiddleware = (req: any, res: any) => any;

export default function(graphqlHTTPMiddleware: ExpressMiddleware): ExpressMiddleware {
export default function (graphqlHTTPMiddleware: ExpressMiddleware): ExpressMiddleware {
return (req, res) => {
const subResponses = [];
return Promise.all(
Expand Down
30 changes: 15 additions & 15 deletions src/middlewares/__tests__/__snapshots__/auth-test.js.snap
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`middlewares/auth \`token\` option as string (with default \`prefix\` and \`header\`) 1`] = `
Object {
"body": "{\\"id\\":\\"1\\",\\"query\\":\\"\\",\\"variables\\":{}}",
"headers": Object {
{
"body": "{"id":"1","query":"","variables":{}}",
"headers": {
"Accept": "*/*",
"Authorization": "Bearer 123",
"Content-Type": "application/json",
Expand All @@ -14,9 +14,9 @@ Object {
`;

exports[`middlewares/auth \`token\` option as thunk (with custom \`prefix\` and \`header\`) 1`] = `
Object {
"body": "{\\"id\\":\\"1\\",\\"query\\":\\"\\",\\"variables\\":{}}",
"headers": Object {
{
"body": "{"id":"1","query":"","variables":{}}",
"headers": {
"Accept": "*/*",
"Content-Type": "application/json",
"MyAuthorization": "MyBearer 333",
Expand All @@ -27,12 +27,12 @@ Object {
`;

exports[`middlewares/auth \`tokenRefreshPromise\` should be called on 401 response 1`] = `
Array [
Array [
[
[
"/graphql",
Object {
"body": "{\\"id\\":\\"1\\",\\"query\\":\\"\\",\\"variables\\":{}}",
"headers": Object {
{
"body": "{"id":"1","query":"","variables":{}}",
"headers": {
"Accept": "*/*",
"Authorization": "Bearer 123",
"Content-Type": "application/json",
Expand All @@ -41,11 +41,11 @@ Array [
"signal": AbortSignal {},
},
],
Array [
[
"/graphql",
Object {
"body": "{\\"id\\":\\"1\\",\\"query\\":\\"\\",\\"variables\\":{}}",
"headers": Object {
{
"body": "{"id":"1","query":"","variables":{}}",
"headers": {
"Accept": "*/*",
"Authorization": "Bearer ValidToken",
"Content-Type": "application/json",
Expand Down
Loading