Fix documentation previews in pull requests (#2015)

* migrate to openzeppelin-docs-preview script

* update netlify configuration

* update docs-preview-script dependency

* remove old docs directory from gitignore

* update oz-docs script for live reload

* update oz-docs scripts to latest

* replace child_process.execFileSync with spawnSync

* update oz-docs-preview
This commit is contained in:
Francisco Giordano
2019-12-02 19:13:13 -03:00
committed by GitHub
parent 0c644cc470
commit b56e00eb61
7 changed files with 2503 additions and 1156 deletions

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
if [ "$1" != "build" -a "$1" != "start" ];then
echo "usage: npm run docs (build|start)" >&2
exit 1
fi
set -o errexit
if [ ! -d openzeppelin-docs ]; then
git clone https://github.com/frangio/openzeppelin-docs.git openzeppelin-docs
fi
git -C openzeppelin-docs pull -q
if [ "$1" = "build" ]; then
npm run prepare-docs
cd docs
env DISABLE_PREPARE_DOCS= node ../openzeppelin-docs/build-local.js
elif [ "$1" = "start" ]; then
npx concurrently \
'nodemon --delay 1 -e "*" -w contracts -w "docs/*.hbs" -x npm run prepare-docs' \
'cd docs; env DISABLE_PREPARE_DOCS= nodemon --delay 1 -e adoc,yml ../openzeppelin-docs/build-local.js' \
'http-server -c-1 openzeppelin-docs/build/site'
fi

View File

@ -1,8 +1,12 @@
#!/usr/bin/env bash
set -o errexit
OUTDIR=docs/modules/api/pages/
npm ci
if [ ! -d node_modules ]; then
npm ci
fi
rm -rf "$OUTDIR"
solidity-docgen -t docs -o "$OUTDIR" -e contracts/mocks,contracts/examples

View File

@ -7,15 +7,11 @@ const path = require('path');
const cp = require('child_process');
const match = require('micromatch');
function exec (cmd, ...args) {
cp.execFileSync(cmd, args, { stdio: 'inherit' });
}
function readJSON (path) {
return JSON.parse(fs.readFileSync(path));
}
exec('npm', 'run', 'compile');
cp.spawnSync('npm', ['run', 'compile'], { stdio: 'inherit' });
const pkgFiles = readJSON('package.json').files;