Skip to content

Commit

Permalink
chore(tsdocs): build apidocs for @loopback/docs during pack
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed May 21, 2019
1 parent 9aa76a9 commit 4e4a400
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
7 changes: 4 additions & 3 deletions bin/build-docs-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ DIR=`dirname $0`
REPO_ROOT=$DIR/..
pushd $REPO_ROOT >/dev/null

# Update README duplicates inside docs/site/readmes
node docs/bin/copy-readmes.js
# Update apidocs
lerna bootstrap --scope @loopback/tsdocs
lerna run --scope @loopback/docs prepack

# Clean up sandbox/loopback.io directory
rm -rf sandbox/loopback.io/
Expand All @@ -31,7 +32,7 @@ rm -rf sandbox/loopback.io/
git clone --depth 1 https://github.com/strongloop/loopback.io.git sandbox/loopback.io

# Bootstrap the `loopback.io` package
lerna bootstrap --scope loopback.io-workflow-scripts
lerna bootstrap --scope @loopback/docs --scope loopback.io-workflow-scripts

pushd $REPO_ROOT/sandbox/loopback.io/ >/dev/null

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"scripts": {
"build:apidocs": "lb-apidocs --html-file=index.html",
"prepack": "node ./bin/copy-readmes",
"prepack": "node ./bin/copy-readmes && cd .. && npm run tsdocs",
"clean": "lb-clean loopback-docs*.tgz package api-docs apidocs site/readmes site/apidocs"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"version": "npm run update-packages && git add greenkeeper.json \"**/package-lock.json\" && npm run update-template-deps && npm run apidocs",
"outdated": "npm outdated --depth 0 && lerna exec --no-bail \"npm outdated --depth 0\"",
"apidocs": "node bin/run-lerna run build:apidocs",
"tsdocs": "lerna run --scope @loopback/tsdocs tsdocs",
"tsdocs": "lerna run --scope @loopback/tsdocs build:tsdocs",
"coverage:ci": "node packages/build/bin/run-nyc report --reporter=text-lcov | coveralls",
"precoverage": "npm test",
"coverage": "open coverage/index.html",
Expand Down
8 changes: 7 additions & 1 deletion packages/tsdocs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It's built on top of https://api-extractor.com/:
### Build api reports and doc models

```sh
npm run extract-apidocs
npm run extract-apidocs -- --report
```

The command above will traverse all TypeScript packages in the monorepo and run
Expand Down Expand Up @@ -42,6 +42,12 @@ npm run update-apidocs
It adds Jekyll metadata to markdown files in `loopback-next/docs/site/apidocs`
and generates `loopback-next/docs/site/apidocs/index.md` as the index page.

To run all steps together:

```sh
npm run build:apidocs
```

## Installation

```sh
Expand Down
2 changes: 1 addition & 1 deletion packages/tsdocs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"private": true,
"scripts": {
"tsdocs": "npm run build && npm run -s extract-apidocs && npm run -s document-apidocs && npm run -s update-apidocs",
"build:tsdocs": "npm run build && npm run -s extract-apidocs && npm run -s document-apidocs && npm run -s update-apidocs",
"extract-apidocs": "node bin/extract-apis",
"document-apidocs": "api-documenter markdown -i ../../docs/apidocs/models -o ../../docs/site/apidocs",
"update-apidocs": "node bin/update-apidocs",
Expand Down

0 comments on commit 4e4a400

Please sign in to comment.