@@ -82,6 +82,7 @@ NODE_EXE = node$(EXEEXT)
82
82
NODE ?= "$(PWD ) /$(NODE_EXE ) "
83
83
NODE_G_EXE = node_g$(EXEEXT )
84
84
NPM ?= ./deps/npm/bin/npm-cli.js
85
+ NPX ?= ./deps/npm/bin/npx-cli.js
85
86
86
87
# Flags for packaging.
87
88
BUILD_DOWNLOAD_FLAGS ?= --download=all
@@ -103,6 +104,16 @@ available-node = \
103
104
exit 1; \
104
105
fi;
105
106
107
+ available-npx = \
108
+ if [ -x "$(NPX ) " ] && [ -e "$(NPX ) " ]; then \
109
+ "$(NPX ) " $(1 ) ; \
110
+ elif [ -x ` command -v npx ` ] && [ -e ` command -v npx ` ] && [ ` command -v npx ` ]; then \
111
+ ` command -v npx ` $(1 ) ; \
112
+ else \
113
+ echo "No available npx, cannot run \"npx $(1 ) \""; \
114
+ exit 1; \
115
+ fi;
116
+
106
117
.PHONY : all
107
118
# BUILDTYPE=Debug builds both release and debug builds. If you want to compile
108
119
# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
@@ -333,7 +344,6 @@ coverage-run-js: ## Run JavaScript tests with coverage.
333
344
# This does not run tests of third-party libraries inside deps.
334
345
test : all # # Run default tests, linters, and build docs.
335
346
$(MAKE ) -s tooltest
336
- $(MAKE ) -s test-doc
337
347
$(MAKE ) -s build-addons
338
348
$(MAKE ) -s build-js-native-api-tests
339
349
$(MAKE ) -s build-node-api-tests
@@ -369,7 +379,7 @@ test-valgrind: all ## Run tests using valgrind.
369
379
test-check-deopts : all
370
380
$(PYTHON ) tools/test.py $(PARALLEL_ARGS ) --mode=$(BUILDTYPE_LOWER ) --check-deopts parallel sequential
371
381
372
- DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.mjs doc/api/addons.md
382
+ DOCBUILDSTAMP_PREREQS = doc/api/addons.md
373
383
374
384
ifeq ($(OSTYPE ) ,aix)
375
385
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS ) out/$(BUILDTYPE ) /node.exp
@@ -385,7 +395,7 @@ test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules
385
395
echo " Skipping .docbuildstamp (no crypto and/or no ICU)" ; \
386
396
else \
387
397
$(RM ) -r test/addons/?? _* /; \
388
- [ -x $( NODE ) ] && $( NODE ) $< || node $< ; \
398
+ $( call available-npx, --prefix $< api-docs-tooling -t addon-verify -i doc/api/addons.md -o test/addons/) \
389
399
[ $$ ? -eq 0 ] && touch $@ ; \
390
400
fi
391
401
@@ -559,11 +569,6 @@ NATIVE_SUITES ?= addons js-native-api node-api
559
569
# CI_* variables should be kept synchronized with the ones in vcbuild.bat
560
570
CI_NATIVE_SUITES ?= $(NATIVE_SUITES ) benchmark
561
571
CI_JS_SUITES ?= $(JS_SUITES ) pummel
562
- ifeq ($(node_use_openssl_and_icu ) , false)
563
- CI_DOC := doctool
564
- else
565
- CI_DOC =
566
- endif
567
572
568
573
.PHONY : test-ci-native
569
574
@@ -596,7 +601,7 @@ test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tes
596
601
out/Release/cctest --gtest_output=xml:out/junit/cctest.xml
597
602
$(PYTHON ) tools/test.py $(PARALLEL_ARGS ) -p tap --logfile test.tap \
598
603
--mode=$(BUILDTYPE_LOWER ) --flaky-tests=$(FLAKY_TESTS ) \
599
- $(TEST_CI_ARGS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) $( CI_DOC )
604
+ $(TEST_CI_ARGS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES )
600
605
$(NODE ) ./test/embedding/test-embedding.js
601
606
$(info Clean up any leftover processes, error if found.)
602
607
ps awwx | grep Release/node | grep -v grep | cat
@@ -658,18 +663,6 @@ test-tick-processor: all ## Run tick processor tests.
658
663
test-hash-seed : all # # Verifu that the hash seed used by V8 for hashing is random.
659
664
$(NODE ) test/pummel/test-hash-seed.js
660
665
661
- .PHONY : test-doc
662
- test-doc : doc-only lint-md # # Build, lint, and verify the docs.
663
- @if [ " $( shell $( node_use_openssl_and_icu) ) " != " true" ]; then \
664
- echo " Skipping test-doc (no crypto and/or no ICU)" ; \
665
- else \
666
- $(PYTHON ) tools/test.py $(PARALLEL_ARGS ) doctool; \
667
- fi
668
-
669
- .PHONY : test-doc-ci
670
- test-doc-ci : doc-only # # Build, lint, and verify the docs (CI).
671
- $(PYTHON ) tools/test.py --shell $(NODE ) $(TEST_CI_ARGS ) $(PARALLEL_ARGS ) doctool
672
-
673
666
.PHONY : test-known-issues
674
667
test-known-issues : all # # Run tests for known issues.
675
668
$(PYTHON ) tools/test.py $(PARALLEL_ARGS ) known_issues
@@ -779,14 +772,10 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
779
772
$(warning Use the git repo instead: $$ git clone https://github.com/nodejs/node.git)
780
773
endif
781
774
782
- apidoc_dirs = out/doc out/doc/api out/doc/api/assets
775
+ apidoc_dirs = out/doc out/doc/api
783
776
skip_apidoc_files = doc/api/quic.md
784
777
785
- apidoc_sources = $(filter-out $(skip_apidoc_files ) , $(wildcard doc/api/* .md) )
786
- apidocs_html = $(addprefix out/,$(apidoc_sources:.md=.html ) )
787
- apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json ) )
788
-
789
- apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/* ) ) )
778
+ run-npm-ci = $(PWD ) /$(NPM ) ci
790
779
791
780
tools/doc/node_modules : tools/doc/package.json
792
781
@if [ " $( shell $( node_use_openssl_and_icu) ) " != " true" ]; then \
@@ -797,11 +786,11 @@ tools/doc/node_modules: tools/doc/package.json
797
786
798
787
.PHONY : doc-only
799
788
doc-only : tools/doc/node_modules \
800
- $(apidoc_dirs ) $( apiassets ) # # Build the docs with the local or the global Node.js binary.
789
+ $(apidoc_dirs ) # # Builds the docs with the local or the global Node.js binary.
801
790
@if [ " $( shell $( node_use_openssl_and_icu) ) " != " true" ]; then \
802
- echo " Skipping doc-only (no crypto and/ or no ICU )" ; \
791
+ echo " Skipping doc-only (no crypto or no icu )" ; \
803
792
else \
804
- $(MAKE ) out /doc/ api/all. html out/ doc/api/all.json out/doc/api/stability ; \
793
+ $(call available-npx, --prefix tools /doc api-docs-tooling -t legacy- html-all legacy-json-all api-links -i doc/api/\ * .md -i lib/\ * .js --ignore $( skip_apidoc_files ) -o out/doc/api/ -c file:// $( PWD ) /CHANGELOG.md) \
805
794
fi
806
795
807
796
.PHONY : doc
@@ -817,72 +806,12 @@ out/doc/api: doc/api
817
806
mkdir -p $@
818
807
cp -r doc/api out/doc
819
808
820
- # If it's a source tarball, assets are already in doc/api/assets
821
- out/doc/api/assets :
822
- mkdir -p $@
823
- if [ -d doc/api/assets ]; then cp -r doc/api/assets out/doc/api; fi ;
824
-
825
- # If it's not a source tarball, we need to copy assets from doc/api_assets
826
- out/doc/api/assets/% : doc/api_assets/% | out/doc/api/assets
827
- @cp $< $@ ; $(RM ) out/doc/api/assets/README.md
828
-
829
-
830
- run-npm-ci = $(PWD ) /$(NPM ) ci
831
-
832
- LINK_DATA = out/doc/apilinks.json
833
- VERSIONS_DATA = out/previous-doc-versions.json
834
- gen-api = tools/doc/generate.mjs --node-version=$(FULLVERSION ) \
835
- --apilinks=$(LINK_DATA ) $< --output-directory=out/doc/api \
836
- --versions-file=$(VERSIONS_DATA )
837
- gen-apilink = tools/doc/apilinks.mjs $(LINK_DATA ) $(wildcard lib/* .js)
838
-
839
- $(LINK_DATA ) : $(wildcard lib/* .js) tools/doc/apilinks.mjs | out/doc
840
- $(call available-node, $(gen-apilink ) )
841
-
842
- # Regenerate previous versions data if the current version changes
843
- $(VERSIONS_DATA ) : CHANGELOG.md src/node_version.h tools/doc/versions.mjs
844
- $(call available-node, tools/doc/versions.mjs $@ )
845
-
846
- node_use_icu = $(call available-node,"-p" "typeof Intl === 'object'")
847
-
848
- out/doc/api/% .json out/doc/api/% .html : doc/api/% .md tools/doc/generate.mjs \
849
- tools/doc/markdown.mjs tools/doc/html.mjs tools/doc/json.mjs \
850
- tools/doc/apilinks.mjs $(VERSIONS_DATA ) | $(LINK_DATA ) out/doc/api
851
- @if [ " $( shell $( node_use_icu) ) " != " true" ]; then \
852
- echo " Skipping documentation generation (no ICU)" ; \
853
- else \
854
- $(call available-node, $(gen-api ) ) \
855
- fi
856
-
857
- out/doc/api/all.html : $(apidocs_html ) tools/doc/allhtml.mjs \
858
- tools/doc/apilinks.mjs | out/doc/api
859
- @if [ " $( shell $( node_use_icu) ) " != " true" ]; then \
860
- echo " Skipping HTML single-page doc generation (no ICU)" ; \
861
- else \
862
- $(call available-node, tools/doc/allhtml.mjs) \
863
- fi
864
-
865
- out/doc/api/all.json : $(apidocs_json ) tools/doc/alljson.mjs | out/doc/api
866
- @if [ " $( shell $( node_use_icu) ) " != " true" ]; then \
867
- echo " Skipping JSON single-file generation (no ICU)" ; \
868
- else \
869
- $(call available-node, tools/doc/alljson.mjs) \
870
- fi
871
-
872
- .PHONY : out/doc/api/stability
873
- out/doc/api/stability : out/doc/api/all.json tools/doc/stability.mjs | out/doc/api
874
- @if [ " $( shell $( node_use_icu) ) " != " true" ]; then \
875
- echo " Skipping stability indicator generation (no ICU)" ; \
876
- else \
877
- $(call available-node, tools/doc/stability.mjs) \
878
- fi
879
-
880
809
.PHONY : docopen
881
- docopen : out/ doc/api/all.html # # Open the documentation in a web browser.
810
+ docopen : doc-only # # Open the documentation in a web browser.
882
811
@$(PYTHON ) -mwebbrowser file://$(abspath $< )
883
812
884
813
.PHONY : docserve
885
- docserve : $( apidocs_html ) $( apiassets ) # # Serve the documentation on localhost:8000.
814
+ docserve : doc-only # # Serve the documentation on localhost:8000.
886
815
@$(PYTHON ) -m http.server 8000 --bind 127.0.0.1 --directory out/doc/api
887
816
888
817
.PHONY : docclean
@@ -1396,7 +1325,12 @@ tools/.mdlintstamp: tools/lint-md/node_modules/remark-parse/package.json $(LINT_
1396
1325
@touch $@
1397
1326
1398
1327
.PHONY : lint-md
1399
- lint-md : lint-js-doc | tools/.mdlintstamp # # Lint the markdown documents maintained by us in the codebase.
1328
+ lint-md : lint-js-doc lint-docs | tools/.mdlintstamp # # Lint the markdown documents maintained by us in the codebase.
1329
+
1330
+ .PHONY : lint-docs
1331
+ lint-docs : tools/doc/node_modules
1332
+ $(info Running API Doc linter...)
1333
+ $(call available-npx, --prefix tools/doc api-docs-tooling -i doc/api/* .md)
1400
1334
1401
1335
run-format-md = tools/lint-md/lint-md.mjs --format $(LINT_MD_FILES )
1402
1336
.PHONY : format-md
0 commit comments