From 9391cb0fdeb5a247e60621abde79f0c323feb2a8 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 5 Sep 2016 22:34:06 +0200 Subject: [PATCH] build: run `npm install` for doc builds in tarball MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Johan Bergström Reviewed-By: James M Snell --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Makefile b/Makefile index 81700ed50f0..5705789b80e 100644 --- a/Makefile +++ b/Makefile @@ -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