镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Closed
Changes from all commits
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
32 changes: 31 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 '/"/,/":/ p' \
| sed '1d' \
| 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,16 @@ lint-md-build: tools/remark-cli/node_modules \
.PHONY: lint-md
ifneq ("","$(wildcard tools/remark-cli/node_modules/)")

tools/find-missing-dependencies/remark-cli: \
tools/remark-cli/package.json
@echo "Checking that all the dependencies are installed on remark-cli"
@cd tools/remark-cli && $(call find-missing-modules,remark-cli)

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

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 +1118,10 @@ 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/remark-cli \
tools/find-missing-dependencies/remark-preset-lint-node \
tools/.miscmdlintstamp \
tools/.docmdlintstamp

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