mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 20:57:44 +00:00
feat: upgrade js-yaml package (#403)
* feat: upgraded js-yaml package from v.3 to v.4 with YAML 1.2 support * feat: removed timestamp type from YAML schema
This commit is contained in:
committed by
GitHub
parent
4cbd04ecae
commit
35fc48c667
@@ -2,7 +2,6 @@ import { basename, dirname, extname, join, resolve } from 'path';
|
||||
import { blue, gray, green, red, yellow } from 'colorette';
|
||||
import { performance } from "perf_hooks";
|
||||
import * as glob from 'glob-promise';
|
||||
import * as yaml from 'js-yaml';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as readline from 'readline';
|
||||
@@ -13,6 +12,8 @@ import {
|
||||
LintConfig,
|
||||
ResolveError,
|
||||
YamlParseError,
|
||||
parseYaml,
|
||||
stringifyYaml
|
||||
} from '@redocly/openapi-core';
|
||||
import { Totals, outputExtensions } from './types';
|
||||
|
||||
@@ -87,7 +88,7 @@ export function dumpBundle(obj: any, format: BundleOutputFormat, dereference?: b
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
return yaml.safeDump(obj, {
|
||||
return stringifyYaml(obj, {
|
||||
noRefs: !dereference,
|
||||
});
|
||||
}
|
||||
@@ -131,11 +132,11 @@ export async function promptUser(query: string, hideUserInput = false): Promise<
|
||||
}
|
||||
|
||||
export function readYaml(filename: string) {
|
||||
return yaml.safeLoad(fs.readFileSync(filename, 'utf-8'), { filename });
|
||||
return parseYaml(fs.readFileSync(filename, 'utf-8'), { filename });
|
||||
}
|
||||
|
||||
export function writeYaml(data: any, filename: string, noRefs = false) {
|
||||
const content = yaml.safeDump(data, { noRefs });
|
||||
const content = stringifyYaml(data, { noRefs });
|
||||
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
process.stderr.write(content);
|
||||
|
||||
Reference in New Issue
Block a user