Skip to content

Commit

Permalink
chore(docs): fix docs building process
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiahdz committed Nov 4, 2019
1 parent 11a339c commit a14115a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
46 changes: 23 additions & 23 deletions Makefile
Expand Up @@ -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"
Expand All @@ -39,57 +39,61 @@ 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

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/ > $@

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

Expand All @@ -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:
Expand All @@ -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
5 changes: 5 additions & 0 deletions docs/package.json
Expand Up @@ -3,6 +3,11 @@
"description": "npm cli docs",
"version": "0.1.0",
"author": "Tanya Brassie <tanyabrassie@tanyascmachine2.home>",
"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",
Expand Down
6 changes: 1 addition & 5 deletions package.json
Expand Up @@ -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",
Expand Down

0 comments on commit a14115a

Please sign in to comment.