From a14115aa3b2d6928c56b42b76d685524d77b84da Mon Sep 17 00:00:00 2001 From: claudiahdz Date: Mon, 4 Nov 2019 21:05:13 +0200 Subject: [PATCH] chore(docs): fix docs building process --- Makefile | 46 +++++++++++++++++++++++----------------------- docs/package.json | 5 +++++ package.json | 6 +----- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 96b9740a0b194..6161d851167ab 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ misc_mandocs = $(shell find docs/content/using-npm -name '*.md' \ mandocs = $(cli_mandocs) $(files_mandocs) $(misc_mandocs) -all: doc +all: docs latest: @echo "Installing latest published npm" @@ -39,14 +39,17 @@ dev: install link: uninstall node bin/npm-cli.js link -f -clean: markedclean marked-manclean doc-clean +clean: markedclean marked-manclean docs-clean rm -rf npmrc node bin/npm-cli.js cache clean --force uninstall: node bin/npm-cli.js rm npm -g -f -doc: $(mandocs) +docs: $(mandocs) + cd docs && node ../bin/npm-cli.js run build:static echo>&2 && cd .. + find docs/public -name '*.html' -exec \ + node scripts/docs-build.js {} \; markedclean: rm -rf node_modules/marked node_modules/.bin/marked .building_marked @@ -54,25 +57,26 @@ markedclean: marked-manclean: rm -rf node_modules/marked-man node_modules/.bin/marked-man .building_marked-man -docclean: doc-clean -doc-clean: +docsclean: docs-clean +docs-clean: rm -rf \ .building_marked \ .building_marked-man \ - man + man \ + docs/public ## build-time tools for the documentation 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/doc-build.sh package.json $(build-doc-tools) +man/man1/npm-README.1: README.md scripts/docs-build.js package.json $(build-doc-tools) @[ -d man/man1 ] || mkdir -p man/man1 - scripts/doc-build.sh $< $@ + node scripts/docs-build.js $< $@ -man/man1/%.1: docs/content/cli-commands/%.md scripts/doc-build.sh package.json $(build-doc-tools) +man/man1/%.1: docs/content/cli-commands/%.md scripts/docs-build.js package.json $(build-doc-tools) @[ -d man/man1 ] || mkdir -p man/man1 - scripts/doc-build.sh $< $@ + node scripts/docs-build.js $< $@ man/man1/npx.1: node_modules/libnpx/libnpx.1 cat $< | sed s/libnpx/npx/ > $@ @@ -80,16 +84,16 @@ man/man1/npx.1: node_modules/libnpx/libnpx.1 man/man5/npm-json.5: man/man5/package.json.5 cp $< $@ -man/man5/npm-global.5: man/man5/folders.5 +man/man5/npm-global.5: man/man5/foslders.5 cp $< $@ -man/man5/%.5: docs/content/configuring-npm/%.md scripts/doc-build.sh package.json $(build-doc-tools) +man/man5/%.5: docs/content/configuring-npm/%.md scripts/docs-build.js package.json $(build-doc-tools) @[ -d man/man5 ] || mkdir -p man/man5 - scripts/doc-build.sh $< $@ + node scripts/docs-build.js $< $@ -man/man7/%.7: docs/content/using-npm/%.md scripts/doc-build.sh package.json $(build-doc-tools) +man/man7/%.7: docs/content/using-npm/%.md scripts/docs-build.js package.json $(build-doc-tools) @[ -d man/man7 ] || mkdir -p man/man7 - scripts/doc-build.sh $< $@ + node scripts/docs-build.js $< $@ marked: node_modules/.bin/marked @@ -101,11 +105,7 @@ marked-man: node_modules/.bin/marked-man node_modules/.bin/marked-man: node bin/npm-cli.js install marked-man --no-global --no-timing --no-save -doc: man - -man: $(cli_docs) - -test: doc +test: docs node bin/npm-cli.js test tag: @@ -117,17 +117,17 @@ ls-ok: gitclean: git clean -fd -publish: gitclean ls-ok link doc-clean doc +publish: gitclean ls-ok link docs-clean docs @git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true git push origin $(BRANCH) &&\ git push origin --tags &&\ node bin/npm-cli.js publish --tag=$(PUBLISHTAG) -release: gitclean ls-ok markedclean marked-manclean doc-clean doc +release: gitclean ls-ok markedclean marked-manclean docs-clean doc node bin/npm-cli.js prune --production --no-save @bash scripts/release.sh sandwich: @[ $$(whoami) = "root" ] && (echo "ok"; echo "ham" > sandwich) || (echo "make it yourself" && exit 13) -.PHONY: all latest install dev link doc clean uninstall test man doc-clean docclean release ls-ok realclean +.PHONY: all latest install dev link doc clean uninstall test man docs-clean docclean release ls-ok realclean diff --git a/docs/package.json b/docs/package.json index b760e0037c103..456f854434d95 100644 --- a/docs/package.json +++ b/docs/package.json @@ -3,6 +3,11 @@ "description": "npm cli docs", "version": "0.1.0", "author": "Tanya Brassie ", + "license": "Artistic-2.0", + "repository": { + "type": "git", + "url": "https://github.com/npm/cli" + }, "dependencies": { "babel-plugin-styled-components": "^1.10.6", "eslint": "^6.3.0", diff --git a/package.json b/package.json index cc36a80fb490c..f11479434d63e 100644 --- a/package.json +++ b/package.json @@ -290,12 +290,8 @@ "tar-stream": "^2.1.0" }, "scripts": { - "docs:man": "make -j4 doc", - "docs:html": "cd docs && npm run build:static", - "docs:create": "npm run docs:man && npm run docs:html", "dumpconf": "env | grep npm | sort | uniq", - "prepublishOnly": "npm run docs:html", - "prepare": "node bin/npm-cli.js rebuild && node bin/npm-cli.js --no-audit --no-timing prune --prefix=. --no-global && rimraf test/*/*/node_modules && npm run docs:man", + "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 docs", "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true", "licenses": "licensee --production --errors-only", "tap": "tap -J --timeout 300 --no-esm",