From 1a70414a30a4232c3792e85560417eb29d694a86 Mon Sep 17 00:00:00 2001 From: estrada9166 Date: Thu, 8 Mar 2018 22:03:49 -0500 Subject: [PATCH 1/2] build: search missing dependencies on lint-md This will search if there are some dependencies that are missing. It will run with lint-md Fixes: #18981 Fixes: #19189 (comment) Fixes: #18978 --- Makefile | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 89739f3eadeb45..d3b8e0ed1ec076 100644 --- a/Makefile +++ b/Makefile @@ -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)) @@ -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 + @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/ @@ -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 From 415a7c64a662149b9a27176d35176d1e80b04407 Mon Sep 17 00:00:00 2001 From: estrada9166 Date: Fri, 9 Mar 2018 09:15:21 -0500 Subject: [PATCH 2/2] build: search missing dependencies on lint-md This will search if there are some dependencies that are missing. It will run with lint-md. It will check dependencies for remark-cli and remark-preset-lint-node --- Makefile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index d3b8e0ed1ec076..0489fe0f572367 100644 --- a/Makefile +++ b/Makefile @@ -659,9 +659,9 @@ run-npm-install = $(PWD)/$(NPM) install --production find-missing-modules = \ cat package.json \ | sed -n -e '/dependencies/,/}/ p' \ - | sed -n -e '/$(1)/,/:/ p' \ + | sed -n -e '/"/,/":/ p' \ + | sed '1d' \ | sed 's/[",]//g' \ - | sed 's/[},]//g' \ | cut -f1 -d":"\ | while read dependency; \ do \ @@ -672,7 +672,7 @@ find-missing-modules = \ exit 1; \ fi \ done - + tools/doc/node_modules/js-yaml/package.json: cd tools/doc && $(call available-node,$(run-npm-install)) @@ -1089,10 +1089,15 @@ lint-md-build: tools/remark-cli/node_modules \ .PHONY: lint-md ifneq ("","$(wildcard tools/remark-cli/node_modules/)") -tools/find-missing-dependencies: \ +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" - @cd tools/remark-preset-lint-node && $(call find-missing-modules,remark-lint) + @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) @@ -1113,7 +1118,8 @@ tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES) @$(call available-node,$(run-lint-misc-md)) @touch $@ -tools/.mdlintstamp: tools/find-missing-dependencies \ +tools/.mdlintstamp: tools/find-missing-dependencies/remark-cli \ + tools/find-missing-dependencies/remark-preset-lint-node \ tools/.miscmdlintstamp \ tools/.docmdlintstamp