Skip to content
Permalink
Browse files

Add documentation upload (#2)

* Build and upload docs to Github pages

* push-docs

* update help

* make
  • Loading branch information...
eugeneiiim committed Mar 6, 2019
1 parent 25b8c93 commit ee26c49c7f776f02038d14c806bb179585926f98
Showing with 61 additions and 4 deletions.
  1. +1 −1 .circleci/config.yml
  2. +52 −0 Makefile
  3. +7 −1 README.md
  4. +1 −2 package.json
@@ -10,7 +10,7 @@ jobs:
- checkout
- run: npm ci
- run: npm test
- run: npm run docs
- run: make docs

- store_artifacts:
path: coverage
@@ -0,0 +1,52 @@
.PHONY: help gh-pages docs push-docs

CURRENT_VERSION := $(shell node docs/current-version.js)
DOCS_DIR := ./docs-build/$(CURRENT_VERSION)

help:
@echo 'Makefile for `promise-utils` package'
@echo ''
@echo 'Usage:'
@echo ' make gh-pages Checkout `gh-pages` in `docs-build/`'
@echo ' make docs Generate the documentation in `docs-build/`'
@echo ' make push-docs Push the documentation to Github'
@echo ''

gh-pages:
rm -fr ./docs-build/ # Clean up old state
git worktree prune # Clean up old state
git fetch origin # Make sure up to date.
git worktree add --checkout ./docs-build/ gh-pages

docs:
# Make sure `npm ci` is run.
[ -d ./node_modules ] || npm ci

rm -rf $(DOCS_DIR)

# Generate new docs.
./node_modules/.bin/typedoc \
--excludeNotExported \
--excludePrivate \
--readme none \
--mode file \
--out $(DOCS_DIR) \
./src

push-docs: gh-pages docs
# Remove latest and place newly generated docs there.
rm -fr ./docs-build/latest/
cp -r $(DOCS_DIR) ./docs-build/latest/

# Update `versions.json` in `docs-build`.
node docs/update-versions.js $(CURRENT_VERSION)

# `git` add all updated paths
(cd ./docs-build/ && \
git add versions.json && \
git add $(CURRENT_VERSION) && \
git add latest)

# `git` push all the updates to the remote
cd ./docs-build/ && \
git push origin gh-pages
@@ -26,8 +26,14 @@ $ npm test

## Documentation

Build docs
```
$ npm run docs
$ make docs
```

Push docs to Github
```
$ make push-docs
```

## License
@@ -12,8 +12,7 @@
"lintFix": "npm run lintSrc --fix && npm run lintTest --fix",
"testCode": "nyc ava",
"test": "tsc && npm run testCode && npm run lint && ./bin/assert_no_file_modifications.sh",
"start": "grunt",
"docs": "typedoc --excludeNotExported --excludePrivate --readme none --mode file --out ./docs-build/$(node docs/current-version.js)/src"
"start": "grunt"
},
"repository": {
"type": "git",

0 comments on commit ee26c49

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.