Skip to content

Commit a23e15f

Browse files
authored
Merge pull request #3564 from hey-api/refactor/deps-yaml-env
fix: replace js-yaml and dotenv dependencies
2 parents e4782cd + 4983148 commit a23e15f

7 files changed

Lines changed: 91 additions & 61 deletions

File tree

.changeset/changelog.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { getInfo, getInfoFromPullRequest } from '@changesets/get-github-info';
2-
import { config } from 'dotenv';
3-
4-
config();
52

63
/**
74
* @returns {string}

dev/openapi-python.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import 'dotenv/config';
2-
1+
import fs from 'node:fs';
32
import path from 'node:path';
3+
import { parseEnv } from 'node:util';
44

55
import { defineConfig } from '@hey-api/openapi-python';
66

77
import { getInput } from './inputs';
88
import { getPreset } from './python/presets';
99

10+
process.env = {
11+
...process.env,
12+
...parseEnv(fs.readFileSync(path.resolve(__dirname, '.env'), 'utf-8')),
13+
};
14+
1015
export default defineConfig(() => [
1116
{
1217
input: getInput(),

dev/openapi-ts.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import 'dotenv/config';
2-
1+
import fs from 'node:fs';
32
import path from 'node:path';
3+
import { parseEnv } from 'node:util';
44

55
import { defineConfig } from '@hey-api/openapi-ts';
66

77
import { getInput } from './inputs';
88
import { getPreset } from './typescript/presets';
99

10+
process.env = {
11+
...process.env,
12+
...parseEnv(fs.readFileSync(path.resolve(__dirname, '.env'), 'utf-8')),
13+
};
14+
1015
export default defineConfig(() => [
1116
{
1217
input: getInput(),

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"@typescript-eslint/eslint-plugin": "8.54.0",
6161
"@typescript/native-preview": "7.0.0-dev.20260309.1",
6262
"@vitest/coverage-v8": "4.0.18",
63-
"dotenv": "17.3.1",
6463
"eslint": "9.39.2",
6564
"eslint-plugin-simple-import-sort": "12.1.1",
6665
"eslint-plugin-sort-destructure-keys": "2.0.0",

packages/json-schema-ref-parser/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@
5252
"dependencies": {
5353
"@jsdevtools/ono": "7.1.3",
5454
"@types/json-schema": "7.0.15",
55-
"js-yaml": "4.1.1"
55+
"yaml": "2.8.2"
5656
},
5757
"devDependencies": {
58-
"@types/js-yaml": "4.0.9",
5958
"typescript": "5.9.3"
6059
},
6160
"engines": {

packages/json-schema-ref-parser/src/parsers/yaml.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import yaml from 'js-yaml';
2-
import { JSON_SCHEMA } from 'js-yaml';
1+
import { parse } from 'yaml';
32

43
import type { FileInfo, JSONSchema, Plugin } from '../types';
54
import { ParserError } from '../util/errors';
@@ -16,8 +15,7 @@ export const yamlParser: Plugin = {
1615
}
1716

1817
try {
19-
const yamlSchema = yaml.load(data, { schema: JSON_SCHEMA }) as JSONSchema;
20-
return yamlSchema;
18+
return parse(data) as JSONSchema;
2119
} catch (error: any) {
2220
throw new ParserError(error?.message || 'Parser Error', file.url);
2321
}

pnpm-lock.yaml

Lines changed: 74 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)