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

chores: upgrade to node 20 #77

Merged
merged 8 commits into from
Apr 15, 2024
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
184 changes: 52 additions & 132 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install
env:
Expand All @@ -44,22 +34,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v2
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install
env:
Expand All @@ -74,23 +54,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Use Node.js 16
uses: actions/setup-node@v1
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install
env:
Expand All @@ -110,23 +80,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/checkout@v4

- uses: actions/cache@v2
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install
env:
Expand All @@ -143,23 +103,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Use Node.js 16
uses: actions/setup-node@v1
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install
env:
Expand All @@ -171,7 +121,7 @@ jobs:
run: yarn build:storybook

- name: Store storybook
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: storybook-static
retention-days: 1
Expand All @@ -187,23 +137,13 @@ jobs:
os: [macos-latest, ubuntu-20.04, windows-latest]

steps:
- uses: actions/checkout@v1

- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/checkout@v4

- uses: actions/cache@v2
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install required python deps
run: python3 -m pip install setuptools
Expand All @@ -225,7 +165,7 @@ jobs:
GITHUB_PR_BUILDS_KEY: ${{ secrets.PR_BUILDS_TOKEN }}

- name: Store compiled source
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: compiled-${{ matrix.os }}
retention-days: 1
Expand All @@ -246,23 +186,13 @@ jobs:
needs: compile

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Use Node.js 16
uses: actions/setup-node@v1
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install
env:
Expand All @@ -271,7 +201,7 @@ jobs:
run: yarn --immutable

- name: Fetch compiled source
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: compiled-${{ matrix.os }}
path: build
Expand All @@ -280,7 +210,7 @@ jobs:
run: yarn run pack

- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: app-builds
retention-days: 15
Expand Down Expand Up @@ -310,14 +240,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: electron-${{ matrix.os }}-test-results
path: playwright-report

- name: Upload video recordings
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: electron-${{ matrix.os }}-recordings
Expand Down Expand Up @@ -347,23 +277,13 @@ jobs:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/checkout@v4

- uses: actions/cache@v2
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "20"
cache: "yarn"

- name: Install
env:
Expand All @@ -375,7 +295,7 @@ jobs:
run: yarn playwright install --with-deps

- name: Fetch compiled source
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: compiled-ubuntu-20.04
path: build
Expand All @@ -387,7 +307,7 @@ jobs:
PWTEST_VIDEO: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: video-web-linux-test-results
Expand All @@ -399,13 +319,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch compiled source
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: compiled-ubuntu-20.04
path: build

- name: Fetch storybook build
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: storybook-static
path: build/renderer/storybook
Expand Down Expand Up @@ -435,7 +355,7 @@ jobs:
if: github.event_name != 'pull_request'
steps:
- name: Fetch compiled source
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: compiled-ubuntu-20.04
path: build
Expand All @@ -455,7 +375,7 @@ jobs:
if: github.event_name != 'pull_request'
steps:
- name: Fetch binaries
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: app-builds
path: app-builds
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.18.1
20.12.2
18 changes: 10 additions & 8 deletions .vitest/setupAfterEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import dotenv from "dotenv";
import { vi } from "vitest";
import nock from "nock";
import isCI from "is-ci";
import { dirname } from "path";
import { fileURLToPath } from "url";
import { Blob } from "buffer";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";

// Text Encoder doesn't existing on jsdom
import { TextEncoder, TextDecoder } from "util";
global.TextEncoder = TextEncoder as unknown as typeof global.TextEncoder;
global.TextDecoder = TextDecoder as unknown as typeof global.TextDecoder;

globalThis.Blob = Blob as unknown as typeof globalThis.Blob;
import { TextEncoder, TextDecoder } from "node:util";
if (typeof global.TextDecoder === undefined) {
global.TextEncoder = TextEncoder as unknown as typeof global.TextEncoder;
global.TextDecoder = TextDecoder as unknown as typeof global.TextDecoder;
}

import { Blob } from "node:buffer";
global.Blob = Blob as unknown as typeof globalThis.Blob;

dotenv.config();

Expand Down
28 changes: 28 additions & 0 deletions .yarn/patches/@graphql-codegen-cli-npm-5.0.2-2b55a036e6
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/cjs/presets.js b/cjs/presets.js
index ebb92da5b491cec307b43ef98db1e55ce7dbbec6..63abaab0f76fe970c855013637e9b2932f6e7e81 100644
--- a/cjs/presets.js
+++ b/cjs/presets.js
@@ -4,8 +4,8 @@ exports.getPresetByName = void 0;
const path_1 = require("path");
async function getPresetByName(name, loader) {
const possibleNames = [
- `@graphql-codegen/${name}`,
`@graphql-codegen/${name}-preset`,
+ `@graphql-codegen/${name}`,
name,
(0, path_1.resolve)(process.cwd(), name),
];
diff --git a/esm/presets.js b/esm/presets.js
index 3699c39aaf2348a65e090ec34b790d3e7d5cf3b6..4a396f71083fe9ad18d697b4c3a0f352303030e6 100644
--- a/esm/presets.js
+++ b/esm/presets.js
@@ -1,8 +1,8 @@
import { resolve } from 'path';
export async function getPresetByName(name, loader) {
const possibleNames = [
- `@graphql-codegen/${name}`,
`@graphql-codegen/${name}-preset`,
+ `@graphql-codegen/${name}`,
name,
resolve(process.cwd(), name),
];
Loading
Loading