@@ -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,69 @@ 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+ find docs/public -name ' *.html' -exec \
56+ node scripts/docs-build.js {} \;
57+
58+ docs : mandocs htmldocs
7659
7760markedclean :
7861 rm -rf node_modules/marked node_modules/.bin/marked .building_marked
7962
8063marked-manclean :
8164 rm -rf node_modules/marked-man node_modules/.bin/marked-man .building_marked-man
8265
83- docclean : doc -clean
84- doc -clean :
66+ docsclean : docs -clean
67+ docs -clean :
8568 rm -rf \
8669 .building_marked \
8770 .building_marked-man \
88- html/doc \
89- man
71+ man \
72+ docs/node_modules \
73+ docs/public \
74+ docs/.cache
9075
9176# # build-time tools for the documentation
9277build-doc-tools := node_modules/.bin/marked \
9378 node_modules/.bin/marked-man
9479
9580# 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 )
81+ man/man1/npm-README.1 : README.md scripts/docs -build.js package.json $(build-doc-tools )
9782 @[ -d man/man1 ] || mkdir -p man/man1
98- scripts/doc -build.sh $< $@
83+ node scripts/docs -build.js $< $@
9984
100- man/man1/% .1 : doc/ cli/% .md scripts/doc -build.sh package.json $(build-doc-tools )
85+ man/man1/% .1 : docs/content/ cli-commands /% .md scripts/docs -build.js package.json $(build-doc-tools )
10186 @[ -d man/man1 ] || mkdir -p man/man1
102- scripts/doc -build.sh $< $@
87+ node scripts/docs -build.js $< $@
10388
10489man/man1/npx.1 : node_modules/libnpx/libnpx.1
10590 cat $< | sed s/libnpx/npx/ > $@
10691
10792man/man5/npm-json.5 : man/man5/package.json.5
10893 cp $< $@
10994
110- man/man5/npm-global.5 : man/man5/npm-folders .5
95+ man/man5/npm-global.5 : man/man5/foslders .5
11196 cp $< $@
11297
113- man/man5/% .5 : doc/files/ % .md scripts/doc -build.sh package.json $(build-doc-tools )
98+ man/man5/% .5 : docs/content/configuring-npm/ % .md scripts/docs -build.js package.json $(build-doc-tools )
11499 @[ -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 > $@
100+ node scripts/docs-build.js $< $@
119101
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 )
102+ man/man7/% .7 : docs/content/using-npm/% .md scripts/docs-build.js package.json $(build-doc-tools )
125103 @[ -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-
104+ node scripts/docs-build.js $< $@
150105
151106marked : node_modules/.bin/marked
152107
@@ -158,11 +113,7 @@ marked-man: node_modules/.bin/marked-man
158113node_modules/.bin/marked-man :
159114 node bin/npm-cli.js install marked-man --no-global --no-timing --no-save
160115
161- doc : man
162-
163- man : $(cli_docs )
164-
165- test : doc
116+ test : docs
166117 node bin/npm-cli.js test
167118
168119tag :
@@ -174,17 +125,17 @@ ls-ok:
174125gitclean :
175126 git clean -fd
176127
177- publish : gitclean ls-ok link doc -clean doc
128+ publish : gitclean ls-ok link docs -clean docs
178129 @git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true
179130 git push origin $(BRANCH ) && \
180131 git push origin --tags && \
181132 node bin/npm-cli.js publish --tag=$(PUBLISHTAG )
182133
183- release : gitclean ls-ok markedclean marked-manclean doc -clean doc
134+ release : gitclean ls-ok markedclean marked-manclean docs -clean doc
184135 node bin/npm-cli.js prune --production --no-save
185136 @bash scripts/release.sh
186137
187138sandwich :
188139 @[ $$ (whoami) = " root" ] && (echo " ok" ; echo " ham" > sandwich) || (echo " make it yourself" && exit 13)
189140
190- .PHONY : all latest install dev link doc clean uninstall test man doc -clean docclean release ls-ok realclean
141+ .PHONY : all latest install dev link doc clean uninstall test man docs -clean docclean release ls-ok realclean
0 commit comments