@@ -28,6 +28,8 @@ set upload=
28
28
set licensertf =
29
29
set lint_js =
30
30
set lint_cpp =
31
+ set lint_md =
32
+ set lint_md_build =
31
33
set build_testgc_addon =
32
34
set noetw =
33
35
set noetw_msi_arg =
@@ -53,6 +55,7 @@ set nghttp2_debug=
53
55
set link_module =
54
56
set no_cctest =
55
57
set openssl_no_asm =
58
+ set doc =
56
59
57
60
:next-arg
58
61
if " %1 " == " " goto args-done
@@ -71,7 +74,7 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok
71
74
if /i " %1 " == " noetw" set noetw = 1& goto arg-ok
72
75
if /i " %1 " == " noperfctr" set noperfctr = 1& goto arg-ok
73
76
if /i " %1 " == " licensertf" set licensertf = 1& goto arg-ok
74
- if /i " %1 " == " test" set test_args = %test_args% -J %common_test_suites% & set lint_cpp=1& set lint_js=1& goto arg-ok
77
+ if /i " %1 " == " test" set test_args = %test_args% -J %common_test_suites% & set lint_cpp=1& set lint_js=1& set lint_md=1 & goto arg-ok
75
78
if /i " %1 " == " test-ci" set test_args = %test_args% %test_ci_args% -p tap --logfile test.tap %common_test_suites% & set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap& goto arg-ok
76
79
if /i " %1 " == " build-addons" set build_addons = 1& goto arg-ok
77
80
if /i " %1 " == " build-addons-napi" set build_addons_napi = 1& goto arg-ok
@@ -98,7 +101,9 @@ if /i "%1"=="lint-js" set lint_js=1&goto arg-ok
98
101
if /i " %1 " == " jslint" set lint_js = 1& echo Please use lint-js instead of jslint& goto arg-ok
99
102
if /i " %1 " == " lint-js-ci" set lint_js_ci = 1& goto arg-ok
100
103
if /i " %1 " == " jslint-ci" set lint_js_ci = 1& echo Please use lint-js-ci instead of jslint-ci& goto arg-ok
101
- if /i " %1 " == " lint" set lint_cpp = 1& set lint_js=1& goto arg-ok
104
+ if /i " %1 " == " lint-md" set lint_md = 1& goto arg-ok
105
+ if /i " %1 " == " lint-md-build" set lint_md_build = 1& goto arg-ok
106
+ if /i " %1 " == " lint" set lint_cpp = 1& set lint_js=1& set lint_md=1& goto arg-ok
102
107
if /i " %1 " == " lint-ci" set lint_cpp = 1& set lint_js_ci=1& goto arg-ok
103
108
if /i " %1 " == " package" set package = 1& goto arg-ok
104
109
if /i " %1 " == " msi" set msi = 1& set licensertf=1& set download_arg=" --download=all" & set i18n_arg=small-icu& goto arg-ok
@@ -118,6 +123,7 @@ if /i "%1"=="debug-nghttp2" set debug_nghttp2=1&goto arg-ok
118
123
if /i " %1 " == " link-module" set " link_module = --link-module=%2 %link_module% " & goto arg-ok-2
119
124
if /i " %1 " == " no-cctest" set no_cctest = 1& goto arg-ok
120
125
if /i " %1 " == " openssl-no-asm" set openssl_no_asm = 1& goto arg-ok
126
+ if /i " %1 " == " doc" set doc = 1& goto arg-ok
121
127
122
128
echo Error: invalid command line option `%1 `.
123
129
exit /b 1
@@ -146,6 +152,7 @@ if defined build_release (
146
152
:: assign path to node_exe
147
153
set " node_exe = %config% \node.exe"
148
154
set " node_gyp_exe = " %node_exe% " deps\npm\node_modules\node-gyp\bin\node-gyp"
155
+ set " npm_exe = " %~dp0 %node_exe% " %~dp0 deps\npm\bin\npm-cli.js"
149
156
if " %target_env% " == " vs2017" set " node_gyp_exe = %node_gyp_exe% --msvs_version=2017"
150
157
151
158
if " %config% " == " Debug" set configure_flags = %configure_flags% --debug
@@ -179,7 +186,11 @@ call :getnodeversion || exit /b 1
179
186
180
187
if defined TAG set configure_flags = %configure_flags% --tag=%TAG%
181
188
182
- if " %target% " == " Clean" rmdir /Q /S " %~dp0 %config% \node-v%FULLVERSION% -win-%target_arch% " > nul 2 > nul
189
+ if not " %target% " == " Clean" goto skip-clean
190
+ rmdir /Q /S " %~dp0 %config% \node-v%FULLVERSION% -win-%target_arch% " > nul 2 > nul
191
+ rmdir /Q /S " %~dp0 tools\remark-cli\node_modules"
192
+ rmdir /Q /S " %~dp0 tools\remark-preset-lint-node\node_modules"
193
+ :skip-clean
183
194
184
195
if defined noprojgen if defined nobuild if not defined sign if not defined msi goto licensertf
185
196
@@ -235,7 +246,7 @@ goto exit
235
246
236
247
:wix-not-found
237
248
echo Build skipped. To generate installer, you need to install Wix.
238
- goto run
249
+ goto build-doc
239
250
240
251
:msbuild-found
241
252
@@ -342,7 +353,7 @@ exit /b 1
342
353
343
354
:msi
344
355
@ rem Skip msi generation if not requested
345
- if not defined msi goto run
356
+ if not defined msi goto build-doc
346
357
347
358
:msibuild
348
359
echo Building node-v%FULLVERSION% -%target_arch% .msi
@@ -357,7 +368,7 @@ if errorlevel 1 echo Failed to sign msi&goto exit
357
368
358
369
:upload
359
370
@ rem Skip upload if not requested
360
- if not defined upload goto run
371
+ if not defined upload goto build-doc
361
372
362
373
if not defined SSHCONFIG (
363
374
echo SSHCONFIG is not set for upload
@@ -385,6 +396,30 @@ ssh -F %SSHCONFIG% %STAGINGSERVER% "touch nodejs/%DISTTYPEDIR%/v%FULLVERSION%/no
385
396
if errorlevel 1 goto exit
386
397
387
398
399
+ :build-doc
400
+ @ rem Build documentation if requested
401
+ if not defined doc goto run
402
+ if not exist %node_exe% (
403
+ echo Failed to find node.exe
404
+ goto run
405
+ )
406
+ mkdir %config% \doc
407
+ robocopy /e doc\api %config% \doc\api
408
+ robocopy /e doc\api_assets %config% \doc\api\assets
409
+
410
+ if exist " tools\doc\node_modules\js-yaml\package.json" goto doc-skip-js-yaml
411
+ SETLOCAL
412
+ cd tools\doc
413
+ %npm_exe% install
414
+ cd ..\..
415
+ if errorlevel 1 goto exit
416
+ ENDLOCAL
417
+ :doc-skip-js-yaml
418
+ for %%F in (%config% \doc\api\*.md) do (
419
+ %node_exe% tools\doc\generate.js --format=json %%F > %%~dF%%~pF%%~nF .json
420
+ %node_exe% tools\doc\generate.js --node-version=v%FULLVERSION% --format=html --analytics=%DOCS_ANALYTICS% %%F > %%~dF%%~pF%%~nF .html
421
+ )
422
+
388
423
:run
389
424
@ rem Run tests if requested.
390
425
@@ -528,28 +563,73 @@ goto exit
528
563
529
564
:lint-js
530
565
if defined lint_js_ci goto lint-js-ci
531
- if not defined lint_js goto exit
566
+ if not defined lint_js goto lint-md-build
532
567
if not exist tools\node_modules\eslint goto no-lint
533
568
echo running lint-js
534
569
%config% \node tools\node_modules\eslint\bin\eslint.js --cache --rule " linebreak-style: 0" --ext=.js,.mjs,.md .eslintrc.js benchmark doc lib test tools
535
- goto exit
570
+ goto lint-md-build
536
571
537
572
:lint-js-ci
538
573
echo running lint-js-ci
539
574
%config% \node tools\lint-js.js -J -f tap -o test-eslint.tap benchmark doc lib test tools
540
- goto exit
575
+ goto lint-md-build
541
576
542
577
:no-lint
543
578
echo Linting is not available through the source tarball.
544
579
echo Use the git repo instead: $ git clone https://github.com/nodejs/node.git
580
+ goto lint-md-build
581
+
582
+ :lint-md-build
583
+ if not defined lint_md_build goto lint-md
584
+ SETLOCAL
585
+ echo Markdown linter: installing remark-cli into tools\
586
+ cd tools\remark-cli
587
+ %npm_exe% install
588
+ cd ..\..
589
+ if errorlevel 1 goto lint-md-build-failed
590
+ echo Markdown linter: installing remark-preset-lint-node into tools\
591
+ cd tools\remark-preset-lint-node
592
+ %npm_exe% install
593
+ cd ..\..
594
+ if errorlevel 1 goto lint-md-build-failed
595
+ ENDLOCAL
596
+ goto lint-md
597
+
598
+ :if errorlevel 1 goto lint-md-build-failed
599
+ ENDLOCAL
600
+ echo Failed to install markdown linter
601
+ exit /b 1
602
+
603
+ :lint-md
604
+ if not defined lint_md goto exit
605
+ if not exist tools\remark-cli\node_modules goto lint-md-no-tools
606
+ if not exist tools\remark-preset-lint-node\node_modules goto lint-md-no-tools
607
+ echo Running Markdown linter on docs...
608
+ SETLOCAL ENABLEDELAYEDEXPANSION
609
+ set lint_md_files =
610
+ cd doc
611
+ for /D %%D IN (*) do (
612
+ for %%F IN (%%D \*.md) do (
613
+ set " lint_md_files = " doc\%%F " !lint_md_files! "
614
+ )
615
+ )
616
+ cd ..
617
+ %config% \node tools\remark-cli\cli.js -q -f %lint_md_files%
618
+ ENDLOCAL
545
619
goto exit
546
620
621
+ :lint-md-no-tools
622
+ echo The markdown linter is not installed.
623
+ echo To install (requires internet access) run: vcbuild lint-md-build
624
+ goto exit
625
+
626
+
547
627
:create-msvs-files-failed
548
628
echo Failed to create vc project files.
549
629
goto exit
550
630
551
631
:help
552
- echo vcbuild.bat [debug/release] [msi] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm]
632
+ echo vcbuild.bat [debug/release] [msi] [doc] [ test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build ] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm]
553
633
echo Examples:
554
634
echo vcbuild.bat : builds release build
555
635
echo vcbuild.bat debug : builds debug build
@@ -558,7 +638,7 @@ echo vcbuild.bat test : builds debug build and runs tests
558
638
echo vcbuild.bat build-release : builds the release distribution as used by nodejs.org
559
639
echo vcbuild.bat enable-vtune : builds nodejs with Intel VTune profiling support to profile JavaScript
560
640
echo vcbuild.bat link-module my_module.js : bundles my_module as built-in module
561
- echo vcbuild.bat lint : runs the C++ and JavaScript linter
641
+ echo vcbuild.bat lint : runs the C++, documentation and JavaScript linter
562
642
echo vcbuild.bat no-cctest : skip building cctest.exe
563
643
goto exit
564
644
0 commit comments