Skip to content

Commit

Permalink
chore: upgraded Node version to 22 and removed dependency to node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Yarimizu14 committed Jul 4, 2024
1 parent a8bf379 commit 86f0734
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
with:
cache: npm
registry-url: "https://registry.npmjs.org"
node-version: "18.20.1"
node-version-file: "package.json"
# https://github.com/npm/cli/issues/7308
- if: runner.os == 'Windows'
run: npm install -g [email protected]
Expand Down
2 changes: 1 addition & 1 deletion integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"test:record": "AUTIFY_POLLY_RECORD=1 jest --testMatch **/dist/test/**/*.test.js --updateSnapshot"
},
"engines": {
"node": ">=20.15.0"
"node": ">=22.4.0"
},
"bugs": {
"url": "https://github.com/autifyhq/autify-cli/issues"
Expand Down
1 change: 1 addition & 0 deletions integration-test/src/bin/autify-cli-integration-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ const testPathPattern =

execSync(`npm run ${command} -- ${testPathPattern}`, {
stdio: "inherit",
env: { ...process.env, NODE_OPTIONS: "--no-deprecation" },
cwd: rootDir,
});
3 changes: 2 additions & 1 deletion integration-test/src/bin/autify-with-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const createPolly = async (args: string[]) => {
"..",
"..",
"__recordings__",
encodeURIComponent(args.join(" "))
encodeURIComponent(args.map((arg) => arg.replaceAll(/"+/g, "")).join(" "))
);
const polly = new Polly("polly-proxy", {
mode,
Expand Down Expand Up @@ -133,6 +133,7 @@ const autifyWithProxy = async (originalArgs: string[]) => {
AUTIFY_WEB_BASE_PATH: `http://127.0.0.1:${webProxy.port}/api/v1/`,
AUTIFY_MOBILE_BASE_PATH: `http://127.0.0.1:${mobileProxy.port}/api/v1/`,
},
shell: process.platform === "win32",
stdio: "inherit",
});
return new Promise<ProcStatus>((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/helpers/execAutifyCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const normalize = (stdout: string) =>
export const execAutifyCli = async (
args: string
): Promise<{ stdout: string; stderr: string }> => {
const command = `autify-with-proxy ${args}`;
const command = `autify-with-proxy ${process.platform === "win32" ? args.replaceAll(/"([^"]+)"/g, '""""$1""') : args}`;
const { stdout, stderr } = await promisify(exec)(command, { env });
return {
stdout: normalize(stripAnsi(stdout)),
Expand Down
2 changes: 1 addition & 1 deletion integration-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outDir": "dist",
"rootDir": "src",
"strict": true,
"target": "es2019",
"target": "es2021",
"esModuleInterop": true,
"types": ["express", "jest", "node", "which"]
},
Expand Down
136 changes: 2 additions & 134 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"inquirer": "^8.2.6",
"listr": "^0.14.3",
"node-emoji": "^1.11.0",
"node-fetch": "^2.7.0",
"node-stream-zip": "^1.15.0",
"per-env": "^1.0.2",
"shell-quote": "^1.8.1",
Expand All @@ -50,7 +49,6 @@
"@types/listr": "^0.14.9",
"@types/node": "^20.14.9",
"@types/node-emoji": "^1.8.2",
"@types/node-fetch": "^2.6.11",
"@types/shell-quote": "^1.7.5",
"@types/tar": "^6.1.13",
"@types/unzip-stream": "^0.3.4",
Expand Down Expand Up @@ -171,7 +169,7 @@
]
},
"engines": {
"node": ">=20.15.0"
"node": ">=22.4.0"
},
"bugs": "https://github.com/autifyhq/autify-cli/issues",
"keywords": [
Expand Down
1 change: 0 additions & 1 deletion src/autify/connect/client-manager/DebugServerClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { CLIError } from "@oclif/errors";
import fetch from "node-fetch";
import { ClientEvents } from "./ClientManager";
import AbortController from "abort-controller";

Expand Down
6 changes: 4 additions & 2 deletions src/autify/connect/installClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable unicorn/filename-case */
import { CLIError } from "@oclif/errors";
import { arch, env, platform } from "node:process";
import fetch from "node-fetch";
import {
createReadStream,
createWriteStream,
Expand Down Expand Up @@ -83,7 +82,10 @@ const download = async (workspaceDir: string, url: URL) => {
if (!response.ok)
throw new CLIError(`Failed to fetch ${url}: ${response.status}`);
const streamPipeline = promisify(pipeline);
await streamPipeline(response.body, createWriteStream(downloadPath));
if (response.body) {
await streamPipeline(response.body, createWriteStream(downloadPath));
}

return downloadPath;
};

Expand Down

0 comments on commit 86f0734

Please sign in to comment.