Files
archived-next-auth/packages/docs/scripts/generate-providers.js
Balázs Orbán 3fe7a64e7a chore: monorepo 1 (#3804)
* fix labeler

* try fixing test runs in GitHub Actions

* pass flags to test command

* test version pr

* move versoin-pr action

* remove --dry-run flag

* re-enable testing, re-add semantic release for now

* add docs

* use `yarn.lock` and different docs port

* simplify dev app config

* fix coverage report

* fix provider source links

* fix more links
2022-02-04 16:01:26 +01:00

22 lines
569 B
JavaScript

const path = require("path")
const fs = require("fs")
const providersPath = path.join(process.cwd(), "/docs/providers")
const files = fs.readdirSync(providersPath, "utf8")
const result = files.reduce((acc, file) => {
if (file === "overview.md") return acc
const provider = fs.readFileSync(path.join(providersPath, file), "utf8")
const { id, title } = provider.match(
/id: (?<id>.+)\ntitle: (?<title>.+)\n/
).groups
acc[id] = title
return acc
}, {})
fs.writeFileSync(
path.join(process.cwd(), "providers.json"),
JSON.stringify(result, null, 2)
)