Skip to content

Commit

Permalink
build: make lint-md independent of local node
Browse files Browse the repository at this point in the history
PR-URL: #18272
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
joyeecheung authored and evanlucas committed Jan 30, 2018
1 parent b055c9e commit ce1eb0b
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1038,27 +1038,32 @@ lint-md-clean:
lint-md-build:
@if [ ! -d tools/remark-cli/node_modules ]; then \
echo "Markdown linter: installing remark-cli into tools/"; \
cd tools/remark-cli && ../../$(NODE) ../../$(NPM) install; fi
cd tools/remark-cli && $(call available-node,$(run-npm-install)) fi
@if [ ! -d tools/remark-preset-lint-node/node_modules ]; then \
echo "Markdown linter: installing remark-preset-lint-node into tools/"; \
cd tools/remark-preset-lint-node && ../../$(NODE) ../../$(NPM) install; fi
cd tools/remark-preset-lint-node && $(call available-node,$(run-npm-install)) fi


.PHONY: lint-md
ifneq ("","$(wildcard tools/remark-cli/node_modules/)")
LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu
LINT_MD_ROOT_DOCS := $(wildcard *.md)
LINT_MD_FILES := $(shell find $(LINT_MD_TARGETS) -type f \
-not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS)
LINT_DOC_MD_FILES = $(shell ls doc/**/*.md)

tools/.docmdlintstamp: $(LINT_DOC_MD_FILES)
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/
tools/.docmdlintstamp: $(LINT_MD_DOC_FILES)
@echo "Running Markdown linter on docs..."
@$(NODE) tools/remark-cli/cli.js -q -f $(LINT_DOC_MD_FILES)
@$(call available-node,$(run-lint-doc-md))
@touch $@

tools/.miscmdlintstamp: $(LINT_MD_FILES)
LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu
LINT_MD_ROOT_DOCS := $(wildcard *.md)
LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \
-not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS)
run-lint-misc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_MISC_FILES)
# Lint other changed markdown files maintained by us
tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES)
@echo "Running Markdown linter on misc docs..."
@$(NODE) tools/remark-cli/cli.js -q -f $(LINT_MD_FILES)
@$(call available-node,$(run-lint-misc-md))
@touch $@

tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
Expand Down

0 comments on commit ce1eb0b

Please sign in to comment.