chore(docs): Refactor API Reference (#1883)

This commit is contained in:
Shahed Nasser
2022-08-05 15:06:12 +03:00
committed by GitHub
parent b126ab4dec
commit 73383cc466
625 changed files with 52358 additions and 11660 deletions

View File

@@ -3,6 +3,7 @@
const fs = require("fs")
const OAS = require("oas-normalize")
const swaggerInline = require("swagger-inline")
const { exec } = require("child_process")
// Storefront API
swaggerInline(
@@ -20,6 +21,7 @@ swaggerInline(
.catch((err) => {
console.log("Error in store")
console.error(err)
process.exit(0)
})
})
@@ -31,6 +33,12 @@ swaggerInline(
}
).then((gen) => {
fs.writeFileSync("./docs/api/store-spec3.yaml", gen)
exec("rm -rf docs/api/store/ && yarn run -- redocly split docs/api/store-spec3.yaml --outDir=docs/api/store/", (error, stdout, stderr) => {
if (error) {
throw new Error(`error: ${error.message}`)
}
console.log(`${stderr || stdout}`);
});
})
// Admin API
@@ -49,6 +57,7 @@ swaggerInline(
.catch((err) => {
console.log("Error in admin")
console.error(err)
process.exit(0)
})
})
@@ -60,4 +69,11 @@ swaggerInline(
}
).then((gen) => {
fs.writeFileSync("./docs/api/admin-spec3.yaml", gen)
exec("rm -rf docs/api/admin/ && yarn run -- redocly split docs/api/admin-spec3.yaml --outDir=docs/api/admin/", (error, stdout, stderr) => {
if (error) {
throw new Error(`error: ${error.message}`)
}
console.log(`${stderr || stdout}`);
return;
});
})