Skip to content

Commit 93939e7

Browse files
committed
Cleanup dependencies
Signed-off-by: Sora Morimoto <[email protected]>
1 parent 007b577 commit 93939e7

File tree

4 files changed

+81
-335
lines changed

4 files changed

+81
-335
lines changed

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"test:--another-array-type": "node tests/spec/another-array-type/test.js",
5757
"test:--axios": "node tests/spec/axios/test.js",
5858
"test:--axios--single-http-client": "node tests/spec/axiosSingleHttpClient/test.js",
59-
"test:--cli": "rimraf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js",
59+
"test:--cli": "shx rm -rf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js",
6060
"test:--default-as-success": "node tests/spec/defaultAsSuccess/test.js",
6161
"test:--default-response": "node tests/spec/defaultResponse/test.js",
6262
"test:--dot-path-params": "node tests/spec/dot-path-params/test.js",
@@ -101,31 +101,31 @@
101101
"validate:debug": "node --nolazy tests/validate.js"
102102
},
103103
"dependencies": {
104-
"@types/swagger-schema-official": "2.0.25",
105-
"cosmiconfig": "9.0.0",
104+
"@types/swagger-schema-official": "^2.0.25",
105+
"cosmiconfig": "^9.0.0",
106106
"didyoumean": "^1.2.2",
107107
"eta": "^2.2.0",
108-
"js-yaml": "4.1.0",
109-
"lodash": "4.17.21",
110-
"make-dir": "4.0.0",
111-
"nanoid": "3.3.6",
112-
"node-emoji": "2.1.3",
113-
"node-fetch": "^3.3.1",
108+
"js-yaml": "^4.1.0",
109+
"lodash": "^4.17.21",
110+
"nanoid": "^3.3.7",
111+
"node-emoji": "^2.1.3",
114112
"prettier": "3.2.5",
115113
"swagger-schema-official": "2.0.0-bab6bed",
116-
"swagger2openapi": "7.0.8",
114+
"swagger2openapi": "^7.0.8",
117115
"typescript": "5.4.5"
118116
},
119117
"devDependencies": {
120118
"@biomejs/biome": "1.7.2",
121-
"@types/lodash": "^4.14.195",
122-
"@types/node": "^20.4.1",
123-
"@types/prettier": "^3.0.0",
124-
"axios": "^1.4.0",
125-
"cross-env": "^7.0.3",
126-
"dotenv": "^16.3.1",
127-
"git-diff": "^2.0.6",
128-
"rimraf": "^5.0.1"
119+
"@types/lodash": "4.17.1",
120+
"@types/node": "20.12.8",
121+
"axios": "1.6.8",
122+
"cross-env": "7.0.3",
123+
"dotenv": "16.4.5",
124+
"git-diff": "2.0.6",
125+
"shx": "0.3.4"
129126
},
130-
"packageManager": "[email protected]"
127+
"packageManager": "[email protected]",
128+
"engines": {
129+
"node": ">=18.0.0"
130+
}
131131
}

src/util/file-system.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const fs = require("node:fs");
2-
const makeDir = require("make-dir");
32
const { resolve } = require("node:path");
43
const _ = require("lodash");
54
const { Logger } = require("./logger");
@@ -68,7 +67,7 @@ class FileSystem {
6867

6968
createDir = (path) => {
7069
try {
71-
makeDir.sync(path);
70+
fs.mkdirSync(path, { recursive: true });
7271
} catch (e) {
7372
this.logger.debug("failed to create dir", e);
7473
}

src/util/request.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
const _ = require("lodash");
2-
const https = require("node:https");
3-
const fetch = require("node-fetch-h2");
42

53
class Request {
64
/**
@@ -18,23 +16,30 @@ class Request {
1816
}
1917

2018
/**
21-
*
2219
* @param url {string}
2320
* @param disableStrictSSL
2421
* @param authToken
25-
* @param options {Partial<import("node-fetch").RequestInit>}
22+
* @param options {Partial<RequestInit>}
2623
* @return {Promise<string>}
2724
*/
2825
async download({ url, disableStrictSSL, authToken, ...options }) {
2926
/**
30-
* @type {Partial<import("node-fetch").RequestInit>}
27+
* @type {Partial<RequestInit>}
3128
*/
3229
const requestOptions = {};
3330

3431
if (disableStrictSSL && !_.startsWith(url, "http://")) {
35-
requestOptions.agent = new https.Agent({
36-
rejectUnauthorized: false,
32+
const undiciGlobalDispatcher =
33+
global[Symbol.for("undici.globalDispatcher.1")];
34+
if (!undiciGlobalDispatcher) {
35+
throw new Error("Could not find the global Undici dispatcher");
36+
}
37+
const newDispatcher = new undiciGlobalDispatcher.constructor({
38+
connect: {
39+
rejectUnauthorized: false,
40+
},
3741
});
42+
global[unidiciGlobalDispatcherSymbol] = newDispatcher;
3843
}
3944
if (authToken) {
4045
requestOptions.headers = {

0 commit comments

Comments
 (0)