mirror of
https://github.com/OpenZeppelin/openzeppelin-contracts.git
synced 2021-05-29 14:48:28 +03:00
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:
committed by
GitHub
parent
0c644cc470
commit
b56e00eb61
1
.gitignore
vendored
1
.gitignore
vendored
@@ -43,7 +43,6 @@ build/
|
||||
|
||||
# docs artifacts
|
||||
docs/modules/api
|
||||
openzeppelin-docs
|
||||
|
||||
# only used to package @openzeppelin/contracts
|
||||
contracts/build/
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[build]
|
||||
command = "npm run docs build"
|
||||
publish = "openzeppelin-docs/build/site"
|
||||
command = "npm run docs"
|
||||
publish = "build/site"
|
||||
|
||||
3609
package-lock.json
generated
3609
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,8 @@
|
||||
"scripts": {
|
||||
"compile": "scripts/compile.sh",
|
||||
"coverage": "scripts/coverage.sh",
|
||||
"docs": "scripts/docs.sh",
|
||||
"docs": "oz-docs -c docs",
|
||||
"docs:watch": "npm run docs watch contracts 'docs/*.hbs'",
|
||||
"prepare-docs": "scripts/prepare-docs.sh",
|
||||
"lint": "npm run lint:js && npm run lint:sol",
|
||||
"lint:fix": "npm run lint:js:fix",
|
||||
@@ -49,7 +50,6 @@
|
||||
"@openzeppelin/test-environment": "^0.1.1",
|
||||
"@openzeppelin/test-helpers": "^0.5.4",
|
||||
"chai": "^4.2.0",
|
||||
"concurrently": "^5.0.0",
|
||||
"eslint": "^6.5.1",
|
||||
"eslint-config-standard": "^14.1.0",
|
||||
"eslint-plugin-import": "^2.18.2",
|
||||
@@ -59,11 +59,10 @@
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"ethereumjs-util": "^6.2.0",
|
||||
"ganache-core-coverage": "https://github.com/OpenZeppelin/ganache-core-coverage/releases/download/2.5.3-coverage/ganache-core-coverage-2.5.3.tgz",
|
||||
"http-server": "^0.11.1",
|
||||
"lodash.startcase": "^4.4.0",
|
||||
"micromatch": "^4.0.2",
|
||||
"mocha": "^6.2.2",
|
||||
"nodemon": "^2.0.1",
|
||||
"openzeppelin-docs-preview": "github:OpenZeppelin/docs-preview-script",
|
||||
"solhint": "2.3.0",
|
||||
"solidity-coverage": "github:rotcivegaf/solidity-coverage#5875f5b7bc74d447f3312c9c0e9fc7814b482477",
|
||||
"solidity-docgen": "^0.3.13"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user