feat(oas-cli): combine admin + store + custom OAS (#3411)

This commit is contained in:
Patrick
2023-03-10 04:37:59 -05:00
committed by GitHub
parent ef4a36794e
commit 966aea65c2
16 changed files with 818 additions and 39 deletions

View File

@@ -19,9 +19,8 @@ const redoclyConfigPath = path.resolve(
const run = async () => {
const outputPath = isDryRun ? await getTmpDirectory() : docsApiPath
await generateOASSources(outputPath)
for (const apiType of ["store", "admin"]) {
await generateOASSource(outputPath, apiType)
const inputJsonFile = path.resolve(outputPath, `${apiType}.oas.json`)
const outputYamlFile = path.resolve(outputPath, `${apiType}.oas.yaml`)
@@ -34,11 +33,8 @@ const run = async () => {
}
}
const generateOASSources = async (outDir, isDryRun) => {
const params = ["oas", `--out-dir=${outDir}`]
if (isDryRun) {
params.push("--dry-run")
}
const generateOASSource = async (outDir, apiType) => {
const params = ["oas", `--type=${apiType}`, `--out-dir=${outDir}`]
const { all: logs } = await execa("medusa-oas", params, {
cwd: basePath,
all: true,
@@ -78,6 +74,7 @@ const circularReferenceCheck = async (srcFile) => {
`🔴 Unhandled circular references - ${fileName} - Please patch in docs-util/redocly/config.yaml`
)
}
console.log(`🟢 All circular references handled`)
}
const generateReference = async (srcFile, apiType) => {