Skip to content

Commit 4515e7c

Browse files
committed
chore(docs): fix docs building process
1 parent 11a339c commit 4515e7c

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

Makefile

+23-23
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ misc_mandocs = $(shell find docs/content/using-npm -name '*.md' \
2222

2323
mandocs = $(cli_mandocs) $(files_mandocs) $(misc_mandocs)
2424

25-
all: doc
25+
all: docs
2626

2727
latest:
2828
@echo "Installing latest published npm"
@@ -39,57 +39,61 @@ dev: install
3939
link: uninstall
4040
node bin/npm-cli.js link -f
4141

42-
clean: markedclean marked-manclean doc-clean
42+
clean: markedclean marked-manclean docs-clean
4343
rm -rf npmrc
4444
node bin/npm-cli.js cache clean --force
4545

4646
uninstall:
4747
node bin/npm-cli.js rm npm -g -f
4848

49-
doc: $(mandocs)
49+
docs: $(mandocs)
50+
cd docs && node ../bin/npm-cli.js run build:static echo>&2 && cd ..
51+
find docs/public -name '*.html' -exec \
52+
node scripts/docs-build.js {} \;
5053

5154
markedclean:
5255
rm -rf node_modules/marked node_modules/.bin/marked .building_marked
5356

5457
marked-manclean:
5558
rm -rf node_modules/marked-man node_modules/.bin/marked-man .building_marked-man
5659

57-
docclean: doc-clean
58-
doc-clean:
60+
docsclean: docs-clean
61+
docs-clean:
5962
rm -rf \
6063
.building_marked \
6164
.building_marked-man \
62-
man
65+
man \
66+
docs/public
6367

6468
## build-time tools for the documentation
6569
build-doc-tools := node_modules/.bin/marked \
6670
node_modules/.bin/marked-man
6771

6872
# use `npm install marked-man` for this to work.
69-
man/man1/npm-README.1: README.md scripts/doc-build.sh package.json $(build-doc-tools)
73+
man/man1/npm-README.1: README.md scripts/docs-build.js package.json $(build-doc-tools)
7074
@[ -d man/man1 ] || mkdir -p man/man1
71-
scripts/doc-build.sh $< $@
75+
node scripts/docs-build.js $< $@
7276

73-
man/man1/%.1: docs/content/cli-commands/%.md scripts/doc-build.sh package.json $(build-doc-tools)
77+
man/man1/%.1: docs/content/cli-commands/%.md scripts/docs-build.js package.json $(build-doc-tools)
7478
@[ -d man/man1 ] || mkdir -p man/man1
75-
scripts/doc-build.sh $< $@
79+
node scripts/docs-build.js $< $@
7680

7781
man/man1/npx.1: node_modules/libnpx/libnpx.1
7882
cat $< | sed s/libnpx/npx/ > $@
7983

8084
man/man5/npm-json.5: man/man5/package.json.5
8185
cp $< $@
8286

83-
man/man5/npm-global.5: man/man5/folders.5
87+
man/man5/npm-global.5: man/man5/foslders.5
8488
cp $< $@
8589

86-
man/man5/%.5: docs/content/configuring-npm/%.md scripts/doc-build.sh package.json $(build-doc-tools)
90+
man/man5/%.5: docs/content/configuring-npm/%.md scripts/docs-build.js package.json $(build-doc-tools)
8791
@[ -d man/man5 ] || mkdir -p man/man5
88-
scripts/doc-build.sh $< $@
92+
node scripts/docs-build.js $< $@
8993

90-
man/man7/%.7: docs/content/using-npm/%.md scripts/doc-build.sh package.json $(build-doc-tools)
94+
man/man7/%.7: docs/content/using-npm/%.md scripts/docs-build.js package.json $(build-doc-tools)
9195
@[ -d man/man7 ] || mkdir -p man/man7
92-
scripts/doc-build.sh $< $@
96+
node scripts/docs-build.js $< $@
9397

9498
marked: node_modules/.bin/marked
9599

@@ -101,11 +105,7 @@ marked-man: node_modules/.bin/marked-man
101105
node_modules/.bin/marked-man:
102106
node bin/npm-cli.js install marked-man --no-global --no-timing --no-save
103107

104-
doc: man
105-
106-
man: $(cli_docs)
107-
108-
test: doc
108+
test: docs
109109
node bin/npm-cli.js test
110110

111111
tag:
@@ -117,17 +117,17 @@ ls-ok:
117117
gitclean:
118118
git clean -fd
119119

120-
publish: gitclean ls-ok link doc-clean doc
120+
publish: gitclean ls-ok link docs-clean docs
121121
@git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true
122122
git push origin $(BRANCH) &&\
123123
git push origin --tags &&\
124124
node bin/npm-cli.js publish --tag=$(PUBLISHTAG)
125125

126-
release: gitclean ls-ok markedclean marked-manclean doc-clean doc
126+
release: gitclean ls-ok markedclean marked-manclean docs-clean doc
127127
node bin/npm-cli.js prune --production --no-save
128128
@bash scripts/release.sh
129129

130130
sandwich:
131131
@[ $$(whoami) = "root" ] && (echo "ok"; echo "ham" > sandwich) || (echo "make it yourself" && exit 13)
132132

133-
.PHONY: all latest install dev link doc clean uninstall test man doc-clean docclean release ls-ok realclean
133+
.PHONY: all latest install dev link doc clean uninstall test man docs-clean docclean release ls-ok realclean

docs/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
"description": "npm cli docs",
44
"version": "0.1.0",
55
"author": "Tanya Brassie <[email protected]>",
6+
"license": "Artistic-2.0",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/npm/cli"
10+
},
611
"dependencies": {
712
"babel-plugin-styled-components": "^1.10.6",
813
"eslint": "^6.3.0",

package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,9 @@
290290
"tar-stream": "^2.1.0"
291291
},
292292
"scripts": {
293-
"docs:man": "make -j4 doc",
294-
"docs:html": "cd docs && npm run build:static",
295-
"docs:create": "npm run docs:man && npm run docs:html",
296293
"dumpconf": "env | grep npm | sort | uniq",
297-
"prepublishOnly": "npm run docs:html",
298-
"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",
294+
"prepare": "node bin/npm-cli.js rebuild && node bin/npm-cli.js --no-audit --no-timing prune --prefix=. --no-global && rimraf test/*/*/node_modules",
295+
"prepublishOnly": "make -j4 docs",
299296
"preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true",
300297
"licenses": "licensee --production --errors-only",
301298
"tap": "tap -J --timeout 300 --no-esm",

0 commit comments

Comments
 (0)