Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: search missing dependencies on lint-md #19249

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,23 @@ available-node = \

run-npm-install = $(PWD)/$(NPM) install --production

find-missing-modules = \
cat package.json \
| sed -n -e '/dependencies/,/}/ p' \
| sed -n -e '/$(1)/,/:/ p' \
| sed 's/[",]//g' \
| sed 's/[},]//g' \
| cut -f1 -d":"\
| while read dependency; \
do \
if [ ! -d node_modules/$$dependency ]; then \
echo "The package $$dependency is missing on the package.json related to $(1)"; \
echo "To install it first run: $ make lint-md-clean"; \
echo "To install (requires internet access) run: $ make lint-md-build"; \
exit 1; \
fi \
done

tools/doc/node_modules/js-yaml/package.json:
cd tools/doc && $(call available-node,$(run-npm-install))

Expand Down Expand Up @@ -1072,6 +1089,11 @@ lint-md-build: tools/remark-cli/node_modules \
.PHONY: lint-md
ifneq ("","$(wildcard tools/remark-cli/node_modules/)")

tools/find-missing-dependencies: \
tools/remark-preset-lint-node/package.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do the same for tools/remark-cli/package.json? Thanks!

@echo "Checking that all the dependencies are installed"
@cd tools/remark-preset-lint-node && $(call find-missing-modules,remark-lint)

LINT_MD_DOC_FILES = $(shell ls doc/**/*.md)
run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES)
# Lint all changed markdown files under doc/
Expand All @@ -1091,7 +1113,9 @@ tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES)
@$(call available-node,$(run-lint-misc-md))
@touch $@

tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
tools/.mdlintstamp: tools/find-missing-dependencies \
tools/.miscmdlintstamp \
tools/.docmdlintstamp

# Lints the markdown documents maintained by us in the codebase.
lint-md: | tools/.mdlintstamp
Expand Down