build: run `npm install` for doc builds in tarball

Run `npm install` before building the documentation from release
tarballs. The doctool currently depends on `js-yaml`, which
is imported from the `tools/eslint` subtree; however, release
tarballs don’t contain that directory.

Running `npm install` is clearly not a beautiful solution,
but it works.

Fixes: https://github.com/nodejs/node/issues/7872
PR-URL: https://github.com/nodejs/node/pull/8413
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Anna Henningsen 2016-09-05 22:34:06 +02:00
Родитель 2eb3fa14f8
Коммит 9391cb0fde
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: D8B9F5AEAE84E4CF
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -39,6 +39,7 @@ EXEEXT := $(shell $(PYTHON) -c \
NODE_EXE = node$(EXEEXT)
NODE ?= ./$(NODE_EXE)
NODE_G_EXE = node_g$(EXEEXT)
NPM ?= ./deps/npm/bin/npm-cli.js
# Flags for packaging.
BUILD_DOWNLOAD_FLAGS ?= --download=all
@ -311,11 +312,25 @@ out/doc/%: doc/%
# check if ./node is actually set, else use user pre-installed binary
gen-json = tools/doc/generate.js --format=json $< > $@
out/doc/api/%.json: doc/api/%.md
[ -e tools/doc/node_modules/js-yaml/package.json ] || \
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
if [ -x $(NODE) ]; then \
cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
else \
cd tools/doc && node ../../$(NPM) install; \
fi
[ -x $(NODE) ] && $(NODE) $(gen-json) || node $(gen-json)
# check if ./node is actually set, else use user pre-installed binary
gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html --template=doc/template.html $< > $@
out/doc/api/%.html: doc/api/%.md
[ -e tools/doc/node_modules/js-yaml/package.json ] || \
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
if [ -x $(NODE) ]; then \
cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
else \
cd tools/doc && node ../../$(NPM) install; \
fi
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
docopen: out/doc/api/all.html