Skip to content

Commit 5ce3d10

Browse files
authoredNov 1, 2024
build: stop pre-compiling lint-md
PR-URL: nodejs#55266 Reviewed-By: Claudio Wunder <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>

11 files changed

+229
-24600
lines changed
 

‎.github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,16 @@ updates:
2222
applies-to: version-updates
2323
patterns:
2424
- '*'
25+
26+
- package-ecosystem: npm
27+
directory: /tools/lint-md
28+
schedule:
29+
interval: monthly
30+
commit-message:
31+
prefix: tools
32+
open-pull-requests-limit: 10
33+
groups:
34+
lint-md:
35+
applies-to: version-updates
36+
patterns:
37+
- '*'

‎.github/workflows/tools.yml

-19
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ on:
2828
- histogram
2929
- icu
3030
# - libuv
31-
- lint-md-dependencies
3231
- llhttp
3332
- minimatch
3433
- nbytes
@@ -187,24 +186,6 @@ jobs:
187186
# cat temp-output
188187
# tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
189188
# rm temp-output
190-
- id: lint-md-dependencies
191-
subsystem: tools
192-
label: tools
193-
run: |
194-
cd tools/lint-md
195-
npm ci
196-
NEW_VERSION=$(npm outdated --parseable | cut -d: -f4 | xargs)
197-
if [ "$NEW_VERSION" != "" ]; then
198-
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
199-
rm -rf package-lock.json node_modules
200-
# Include $NEW_VERSION to explicitly update the package.json
201-
# entry for the dependency and also so that semver-major updates
202-
# are not skipped.
203-
npm install --ignore-scripts $NEW_VERSION
204-
npm install --ignore-scripts
205-
cd ../..
206-
make lint-md-rollup
207-
fi
208189
- id: llhttp
209190
subsystem: deps
210191
label: dependencies

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ tools/*/*.i.tmp
114114
/tools/doc/node_modules
115115
/tools/clang-format/node_modules
116116
/tools/eslint/node_modules
117+
/tools/lint-md/node_modules
117118

118119
# === Rules for test artifacts ===
119120
/*.tap

‎Makefile

+8-17
Original file line numberDiff line numberDiff line change
@@ -1335,21 +1335,6 @@ bench-addons-clean:
13351335
$(RM) -r benchmark/napi/*/build
13361336
$(RM) benchmark/napi/.buildstamp
13371337

1338-
.PHONY: lint-md-rollup
1339-
lint-md-rollup:
1340-
$(RM) tools/.*mdlintstamp
1341-
cd tools/lint-md && npm ci && npm run build
1342-
1343-
.PHONY: lint-md-clean
1344-
.NOTPARALLEL: lint-md-clean
1345-
lint-md-clean:
1346-
$(RM) -r tools/lint-md/node_modules
1347-
$(RM) tools/.*mdlintstamp
1348-
1349-
.PHONY: lint-md-build
1350-
lint-md-build:
1351-
$(warning Deprecated no-op target 'lint-md-build')
1352-
13531338
ifeq ("$(wildcard tools/.mdlintstamp)","")
13541339
LINT_MD_NEWER =
13551340
else
@@ -1361,8 +1346,13 @@ LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \
13611346
! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md' \
13621347
$(LINT_MD_NEWER))
13631348
run-lint-md = tools/lint-md/lint-md.mjs $(LINT_MD_FILES)
1349+
1350+
# Check for a specific file, as (empty) directories are persisted in git.
1351+
tools/lint-md/node_modules/remark-parse/package.json:
1352+
-cd tools/lint-md && $(call available-node,$(run-npm-ci))
1353+
13641354
# Lint all changed markdown files maintained by us
1365-
tools/.mdlintstamp: $(LINT_MD_FILES)
1355+
tools/.mdlintstamp: tools/lint-md/node_modules/remark-parse/package.json $(LINT_MD_FILES)
13661356
$(info Running Markdown linter...)
13671357
@$(call available-node,$(run-lint-md))
13681358
@touch $@
@@ -1372,7 +1362,7 @@ lint-md: lint-js-doc | tools/.mdlintstamp ## Lint the markdown documents maintai
13721362

13731363
run-format-md = tools/lint-md/lint-md.mjs --format $(LINT_MD_FILES)
13741364
.PHONY: format-md
1375-
format-md: ## Format the markdown documents maintained by us in the codebase.
1365+
format-md: tools/lint-md/node_modules/remark-parse/package.json ## Format the markdown documents maintained by us in the codebase.
13761366
@$(call available-node,$(run-format-md))
13771367

13781368

@@ -1601,6 +1591,7 @@ lint-clean: ## Remove linting artifacts.
16011591
$(RM) tools/.*lintstamp
16021592
$(RM) .eslintcache
16031593
$(RM) -r tools/eslint/node_modules
1594+
$(RM) -r tools/lint-md/node_modules
16041595
$(RM) tools/pip/site_packages
16051596

16061597
HAS_DOCKER ?= $(shell command -v docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)

‎eslint.config.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export default [
5454
'test/message/esm_display_syntax_error.mjs',
5555
'tools/github_reporter/**',
5656
'tools/icu/**',
57-
'tools/lint-md/lint-md.mjs',
5857
],
5958
},
6059
// #endregion

‎tools/lint-md/.gitignore

-1
This file was deleted.

‎tools/lint-md/lint-md.mjs

+16-23,892
Large diffs are not rendered by default.

‎tools/lint-md/lint-md.src.mjs

-53
This file was deleted.

‎tools/lint-md/package-lock.json

+180-598
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tools/lint-md/package.json

-9
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,12 @@
22
"name": "lint-md",
33
"description": "markdown linting",
44
"version": "1.0.0",
5-
"scripts": {
6-
"build": "rollup -f es -p '@rollup/plugin-node-resolve={exportConditions: [\"node\"]}' -p @rollup/plugin-commonjs -p rollup-plugin-cleanup lint-md.src.mjs --file lint-md.mjs"
7-
},
85
"dependencies": {
96
"remark-parse": "^11.0.0",
107
"remark-preset-lint-node": "^5.1.2",
118
"remark-stringify": "^11.0.0",
129
"to-vfile": "^8.0.0",
1310
"unified": "^11.0.5",
1411
"vfile-reporter": "^8.1.1"
15-
},
16-
"devDependencies": {
17-
"@rollup/plugin-commonjs": "^28.0.1",
18-
"@rollup/plugin-node-resolve": "^15.3.0",
19-
"rollup": "^4.24.0",
20-
"rollup-plugin-cleanup": "^3.2.1"
2112
}
2213
}

‎vcbuild.bat

+11-10
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ if /i "%1"=="lint-js-build" set lint_js_build=1&goto arg-ok
122122
if /i "%1"=="lint-js-fix" set lint_js_fix=1&goto arg-ok
123123
if /i "%1"=="jslint" set lint_js=1&echo Please use lint-js instead of jslint&goto arg-ok
124124
if /i "%1"=="lint-md" set lint_md=1&goto arg-ok
125-
if /i "%1"=="lint-md-build" set lint_md_build=1&goto arg-ok
126125
if /i "%1"=="lint" set lint_cpp=1&set lint_js=1&set lint_md=1&goto arg-ok
127126
if /i "%1"=="lint-ci" set lint_cpp=1&set lint_js_ci=1&goto arg-ok
128127
if /i "%1"=="format-md" set format_md=1&goto arg-ok
@@ -750,24 +749,21 @@ echo running lint-js
750749
goto lint-js-fix
751750

752751
:lint-js-fix
753-
if not defined lint_js_fix goto lint-md-build
752+
if not defined lint_js_fix goto lint-md
754753
if not exist tools\eslint\node_modules\eslint goto no-lint
755754
echo running lint-js-fix
756755
%node_exe% tools\eslint\node_modules\eslint\bin\eslint.js --cache --max-warnings=0 --report-unused-disable-directives --rule "@stylistic/js/linebreak-style: 0" eslint.config.mjs benchmark doc lib test tools --fix
757756
goto lint-md-build
758757

759-
:no-lint
760-
echo Linting is not available through the source tarball.
761-
echo Use the git repo instead: $ git clone https://github.com/nodejs/node.git
762-
goto lint-md-build
763-
764758
:lint-md-build
765-
if not defined lint_md_build goto lint-md
766-
echo "Deprecated no-op target 'lint_md_build'"
767-
goto lint-md
759+
if not defined lint_md if not defined format_md goto lint-md
760+
cd tools\lint-md
761+
%npm_exe% ci
762+
cd ..\..
768763

769764
:lint-md
770765
if not defined lint_md goto format-md
766+
if not exist tools\lint-md\node_modules goto no-lint
771767
echo Running Markdown linter on docs...
772768
SETLOCAL ENABLEDELAYEDEXPANSION
773769
set lint_md_files=
@@ -782,6 +778,7 @@ goto format-md
782778

783779
:format-md
784780
if not defined format_md goto exit
781+
if not exist tools\lint-md\node_modules goto no-lint
785782
echo Running Markdown formatter on docs...
786783
SETLOCAL ENABLEDELAYEDEXPANSION
787784
set lint_md_files=
@@ -792,6 +789,10 @@ for /D %%D IN (doc\*) do (
792789
)
793790
%node_exe% tools\lint-md\lint-md.mjs --format %lint_md_files%
794791
ENDLOCAL
792+
793+
:no-lint
794+
echo Linting is not available through the source tarball.
795+
echo Use the git repo instead: $ git clone https://github.com/nodejs/node.git
795796
goto exit
796797

797798
:create-msvs-files-failed

0 commit comments

Comments
 (0)
Please sign in to comment.