From 16f9e13bc38563a77e6d84ee055c69317c31070b Mon Sep 17 00:00:00 2001 From: ri7nz Date: Mon, 31 May 2021 16:33:22 +0800 Subject: [PATCH] chore(docs): add docs generator it's a combined tools with zx, bsdoc, and shellscript --- gendocs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 gendocs diff --git a/gendocs b/gendocs new file mode 100755 index 0000000..a84852e --- /dev/null +++ b/gendocs @@ -0,0 +1,31 @@ +#!/usr/bin/env zx + +let _ROOT = await $`pwd` +_ROOT = _ROOT.stdout; + +const objPackages = str => `{"packages": ${str}}` + +let stdOut = await $`lerna list --json` + +const {packages} = JSON.parse( + objPackages( + stdOut.stdout.trim() + ) +) + +const gen = async packages => { + packages.forEach(async _package => { + let {location, name} = _package; + await $`cd ${location} && yarn bsdoc build ${name}` + }) +} + +const copyTo = (pacakages, to) => { + packages.forEach( async _package => { + let {location, name} = _package; + await $`cp -r ${location}/docs/**/* ${to}` + }) +} + +await gen(packages) +await copyTo(packages, _ROOT.trim() + "/docs/")