diff options
author | isaacs <i@izs.me> | 2020-10-23 22:25:56 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-10-23 22:25:58 +0300 |
commit | cb25c343636517f0a310372d2552cdcdcaa99c61 (patch) | |
tree | 65cf3ce511811c0c81e7c5a6014201e743d401e6 | |
parent | b8dfae9911d117d462d7b4b770e52c2e859498af (diff) |
Rebuild minimal doc set on package.json changes
There's only a few with the @VERSION@ tag in them, so it's excessive to
rebuild our entire set of docs every time package.json is touched, since
this means redundantly rebuilding docs as part of every release.
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | package.json | 2 |
2 files changed, 13 insertions, 5 deletions
@@ -6,6 +6,12 @@ BRANCH = $(shell git rev-parse --abbrev-ref HEAD) markdowns = $(shell find docs -name '*.md' | grep -v 'index') README.md +# these docs have the @VERSION@ tag in them, so they have to be rebuilt +# whenever the package.json is touched, in case the version changed. +version_mandocs = $(shell grep -rl '@VERSION@' docs/content \ + |sed 's|.md|.1|g' \ + |sed 's|docs/content/commands/|man/man1/|g' ) + cli_mandocs = $(shell find docs/content/commands -name '*.md' \ |sed 's|.md|.1|g' \ |sed 's|docs/content/commands/|man/man1/|g' ) \ @@ -47,6 +53,8 @@ uninstall: mandocs: $(mandocs) +$(version_mandocs): package.json + htmldocs: cd docs && node dockhand.js >&2 @@ -73,11 +81,11 @@ build-doc-tools := node_modules/.bin/marked \ node_modules/.bin/marked-man # use `npm install marked-man` for this to work. -man/man1/npm-README.1: README.md scripts/docs-build.js package.json $(build-doc-tools) +man/man1/npm-README.1: README.md scripts/docs-build.js $(build-doc-tools) @[ -d man/man1 ] || mkdir -p man/man1 node scripts/docs-build.js $< $@ -man/man1/%.1: docs/content/commands/%.md scripts/docs-build.js package.json $(build-doc-tools) +man/man1/%.1: docs/content/commands/%.md scripts/docs-build.js $(build-doc-tools) @[ -d man/man1 ] || mkdir -p man/man1 node scripts/docs-build.js $< $@ @@ -87,11 +95,11 @@ man/man5/npm-json.5: man/man5/package.json.5 man/man5/npm-global.5: man/man5/folders.5 cp $< $@ -man/man5/%.5: docs/content/configuring-npm/%.md scripts/docs-build.js package.json $(build-doc-tools) +man/man5/%.5: docs/content/configuring-npm/%.md scripts/docs-build.js $(build-doc-tools) @[ -d man/man5 ] || mkdir -p man/man5 node scripts/docs-build.js $< $@ -man/man7/%.7: docs/content/using-npm/%.md scripts/docs-build.js package.json $(build-doc-tools) +man/man7/%.7: docs/content/using-npm/%.md scripts/docs-build.js $(build-doc-tools) @[ -d man/man7 ] || mkdir -p man/man7 node scripts/docs-build.js $< $@ diff --git a/package.json b/package.json index 8913f4142..b3b761bc0 100644 --- a/package.json +++ b/package.json @@ -194,7 +194,7 @@ }, "scripts": { "dumpconf": "env | grep npm | sort | uniq", - "prepare": "node bin/npm-cli.js rebuild && node bin/npm-cli.js --no-audit --no-timing prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 mandocs", + "prepare": "node bin/npm-cli.js rebuild && make -j4", "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true", "licenses": "licensee --production --errors-only", "test": "tap", |