@@ -4,51 +4,25 @@ SHELL = bash
44PUBLISHTAG = $(shell node scripts/publish-tag.js)
55BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
66
7- markdowns = $(shell find doc -name '* .md' | grep -v 'index') README.md
7+ markdowns = $(shell find docs -name '* .md' | grep -v 'index') README.md
88
9- html_docdeps = html/dochead.html \
10- html/docfoot.html \
11- scripts/doc-build.sh \
12- package.json
13-
14- cli_mandocs = $(shell find doc/cli -name '* .md' \
9+ cli_mandocs = $(shell find docs/content/cli-commands -name '* .md' \
1510 |sed 's|.md|.1|g' \
16- |sed 's|doc/ cli/|man/man1/|g' ) \
11+ |sed 's|docs/content/ cli-commands /|man/man1/|g' ) \
1712 man/man1/npm-README.1 \
1813 man/man1/npx.1
1914
20- files_mandocs = $(shell find doc/files -name '* .md' \
15+ files_mandocs = $(shell find docs/content/configuring-npm -name '* .md' \
2116 |sed 's|.md|.5|g' \
22- |sed 's|doc/files/|man/man5/|g' ) \
23- man/man5/npm-json.5 \
24- man/man5/npm-global.5
17+ |sed 's|docs/content/configuring-npm/|man/man5/|g' ) \
2518
26- misc_mandocs = $(shell find doc/misc -name '* .md' \
19+ misc_mandocs = $(shell find docs/content/using-npm -name '* .md' \
2720 |sed 's|.md|.7|g' \
28- |sed 's|doc/misc/|man/man7/|g' ) \
29- man/man7/npm-index.7
30-
31- cli_htmldocs = $(shell find doc/cli -name '* .md' \
32- |sed 's|.md|.html|g' \
33- |sed 's|doc/cli/|html/doc/cli/|g' ) \
34- html/doc/README.html
35-
36- files_htmldocs = $(shell find doc/files -name '* .md' \
37- |sed 's|.md|.html|g' \
38- |sed 's|doc/files/|html/doc/files/|g' ) \
39- html/doc/files/npm-json.html \
40- html/doc/files/npm-global.html
41-
42- misc_htmldocs = $(shell find doc/misc -name '* .md' \
43- |sed 's|.md|.html|g' \
44- |sed 's|doc/misc/|html/doc/misc/|g' ) \
45- html/doc/index.html
21+ |sed 's|docs/content/using-npm/|man/man7/|g' ) \
4622
4723mandocs = $(cli_mandocs ) $(files_mandocs ) $(misc_mandocs )
4824
49- htmldocs = $(cli_htmldocs ) $(files_htmldocs ) $(misc_htmldocs )
50-
51- all : doc
25+ all : docs
5226
5327latest :
5428 @echo " Installing latest published npm"
@@ -65,88 +39,67 @@ dev: install
6539link : uninstall
6640 node bin/npm-cli.js link -f
6741
68- clean : markedclean marked-manclean doc -clean
42+ clean : markedclean marked-manclean docs -clean
6943 rm -rf npmrc
7044 node bin/npm-cli.js cache clean --force
7145
7246uninstall :
7347 node bin/npm-cli.js rm npm -g -f
7448
75- doc : $(mandocs ) $(htmldocs )
49+ mandocs : $(mandocs )
50+
51+ htmldocs :
52+ cd docs && node ../bin/npm-cli.js install && \
53+ node ../bin/npm-cli.js run build:static echo>&2 && \
54+ rm -rf node_modules .cache public/* js public/* json public/404* public/page-data public/manifest*
55+
56+ docs : mandocs htmldocs
7657
7758markedclean :
7859 rm -rf node_modules/marked node_modules/.bin/marked .building_marked
7960
8061marked-manclean :
8162 rm -rf node_modules/marked-man node_modules/.bin/marked-man .building_marked-man
8263
83- docclean : doc -clean
84- doc -clean :
64+ docsclean : docs -clean
65+ docs -clean :
8566 rm -rf \
8667 .building_marked \
8768 .building_marked-man \
88- html/doc \
89- man
69+ man \
70+ docs/node_modules \
71+ docs/public \
72+ docs/.cache
9073
9174# # build-time tools for the documentation
9275build-doc-tools := node_modules/.bin/marked \
9376 node_modules/.bin/marked-man
9477
9578# use `npm install marked-man` for this to work.
96- man/man1/npm-README.1 : README.md scripts/doc -build.sh package.json $(build-doc-tools )
79+ man/man1/npm-README.1 : README.md scripts/docs -build.js package.json $(build-doc-tools )
9780 @[ -d man/man1 ] || mkdir -p man/man1
98- scripts/doc -build.sh $< $@
81+ node scripts/docs -build.js $< $@
9982
100- man/man1/% .1 : doc/ cli/% .md scripts/doc -build.sh package.json $(build-doc-tools )
83+ man/man1/% .1 : docs/content/ cli-commands /% .md scripts/docs -build.js package.json $(build-doc-tools )
10184 @[ -d man/man1 ] || mkdir -p man/man1
102- scripts/doc -build.sh $< $@
85+ node scripts/docs -build.js $< $@
10386
10487man/man1/npx.1 : node_modules/libnpx/libnpx.1
10588 cat $< | sed s/libnpx/npx/ > $@
10689
10790man/man5/npm-json.5 : man/man5/package.json.5
10891 cp $< $@
10992
110- man/man5/npm-global.5 : man/man5/npm- folders.5
93+ man/man5/npm-global.5 : man/man5/folders.5
11194 cp $< $@
11295
113- man/man5/% .5 : doc/files/ % .md scripts/doc -build.sh package.json $(build-doc-tools )
96+ man/man5/% .5 : docs/content/configuring-npm/ % .md scripts/docs -build.js package.json $(build-doc-tools )
11497 @[ -d man/man5 ] || mkdir -p man/man5
115- scripts/doc-build.sh $< $@
116-
117- doc/misc/npm-index.md : scripts/index-build.js package.json $(build-doc-tools )
118- node scripts/index-build.js > $@
98+ node scripts/docs-build.js $< $@
11999
120- html/doc/index.html : doc/misc/npm-index.md $(html_docdeps ) $(build-doc-tools )
121- @[ -d html/doc ] || mkdir -p html/doc
122- scripts/doc-build.sh $< $@
123-
124- man/man7/% .7 : doc/misc/% .md scripts/doc-build.sh package.json $(build-doc-tools )
100+ man/man7/% .7 : docs/content/using-npm/% .md scripts/docs-build.js package.json $(build-doc-tools )
125101 @[ -d man/man7 ] || mkdir -p man/man7
126- scripts/doc-build.sh $< $@
127-
128- html/doc/README.html : README.md $(html_docdeps ) $(build-doc-tools )
129- @[ -d html/doc ] || mkdir -p html/doc
130- scripts/doc-build.sh $< $@
131-
132- html/doc/cli/% .html : doc/cli/% .md $(html_docdeps ) $(build-doc-tools )
133- @[ -d html/doc/cli ] || mkdir -p html/doc/cli
134- scripts/doc-build.sh $< $@
135-
136- html/doc/files/npm-json.html : html/doc/files/package.json.html
137- cp $< $@
138-
139- html/doc/files/npm-global.html : html/doc/files/npm-folders.html
140- cp $< $@
141-
142- html/doc/files/% .html : doc/files/% .md $(html_docdeps ) $(build-doc-tools )
143- @[ -d html/doc/files ] || mkdir -p html/doc/files
144- scripts/doc-build.sh $< $@
145-
146- html/doc/misc/% .html : doc/misc/% .md $(html_docdeps ) $(build-doc-tools )
147- @[ -d html/doc/misc ] || mkdir -p html/doc/misc
148- scripts/doc-build.sh $< $@
149-
102+ node scripts/docs-build.js $< $@
150103
151104marked : node_modules/.bin/marked
152105
@@ -158,11 +111,7 @@ marked-man: node_modules/.bin/marked-man
158111node_modules/.bin/marked-man :
159112 node bin/npm-cli.js install marked-man --no-global --no-timing --no-save
160113
161- doc : man
162-
163- man : $(cli_docs )
164-
165- test : doc
114+ test : docs
166115 node bin/npm-cli.js test
167116
168117tag :
@@ -174,17 +123,17 @@ ls-ok:
174123gitclean :
175124 git clean -fd
176125
177- publish : gitclean ls-ok link doc -clean doc
126+ publish : gitclean ls-ok link docs -clean docs
178127 @git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true
179128 git push origin $(BRANCH ) && \
180129 git push origin --tags && \
181130 node bin/npm-cli.js publish --tag=$(PUBLISHTAG )
182131
183- release : gitclean ls-ok markedclean marked-manclean doc -clean doc
132+ release : gitclean ls-ok markedclean marked-manclean docs -clean doc
184133 node bin/npm-cli.js prune --production --no-save
185134 @bash scripts/release.sh
186135
187136sandwich :
188137 @[ $$ (whoami) = " root" ] && (echo " ok" ; echo " ham" > sandwich) || (echo " make it yourself" && exit 13)
189138
190- .PHONY : all latest install dev link doc clean uninstall test man doc -clean docclean release ls-ok realclean
139+ .PHONY : all latest install dev link doc clean uninstall test man docs -clean docclean release ls-ok realclean
0 commit comments