···11+import { ConfigError } from '../error';
22+33+export const checkNodeVersion = () => {
44+ if (typeof Bun !== 'undefined') {
55+ const [major] = Bun.version.split('.').map(Number);
66+ if (major! < 1) {
77+ throw new ConfigError(
88+ `Unsupported Bun version ${Bun.version}. Please use Bun 1.0.0 or newer.`,
99+ );
1010+ }
1111+ } else if (typeof process !== 'undefined' && process.versions?.node) {
1212+ const [major] = process.versions.node.split('.').map(Number);
1313+ if (major! < 18) {
1414+ throw new ConfigError(
1515+ `Unsupported Node version ${process.versions.node}. Please use Node 18 or newer.`,
1616+ );
1717+ }
1818+ }
1919+};
+5-2
packages/openapi-ts/src/config/init.ts
···2233import { loadConfig } from 'c12';
4455+import { ConfigError } from '../error';
56import type { Config, UserConfig } from '../types/config';
67import { isLegacyClient, setConfig } from '../utils/config';
78import { getInput } from './input';
···70717172 if (!input.path) {
7273 errors.push(
7373- new Error(
7474+ new ConfigError(
7475 'missing input - which OpenAPI specification should we use to generate your output?',
7576 ),
7677 );
···78797980 if (!output.path) {
8081 errors.push(
8181- new Error('missing output - where should we generate your output?'),
8282+ new ConfigError(
8383+ 'missing output - where should we generate your output?',
8484+ ),
8285 );
8386 }
8487