From 109fbb526ab7aff4cef65616351d22e8fdf885a9 Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Mon, 18 May 2020 17:09:33 +0200 Subject: [PATCH 1/5] Build system fixes for macos (#486) On macos, GNU make eagerly avoids calling into the shell, so exposing node commands through $PATH doesn't work half of the time. Also, refactor build system a bit to have less repitition so that the build is easier to maintain. Or at least I think so. --- common.mk | 18 ++++++++++++++++-- fluent-bundle/makefile | 16 +++++++--------- fluent-dedent/makefile | 15 ++++++--------- fluent-dom/makefile | 17 +++++++---------- fluent-gecko/makefile | 6 +++--- fluent-langneg/makefile | 16 +++++++--------- fluent-react/makefile | 14 ++++++++------ fluent-sequence/makefile | 16 +++++++--------- fluent-syntax/makefile | 16 +++++++--------- makefile | 4 ++-- 10 files changed, 70 insertions(+), 68 deletions(-) diff --git a/common.mk b/common.mk index 28e3ca4d3..d884c2b6c 100644 --- a/common.mk +++ b/common.mk @@ -1,12 +1,17 @@ # This makefile is intended to be included by each package's makefile. The # paths are relative to the package directory. -ROOT := $(CURDIR)/.. +ROOT := $(dir $(lastword $(MAKEFILE_LIST))) SOURCES := $(wildcard src/*) VERSION := $(shell node -pe "require('./package.json').version") export SHELL := /bin/bash -export PATH := $(CURDIR)/node_modules/.bin:$(ROOT)/node_modules/.bin:$(PATH) +ESLINT ?= $(ROOT)node_modules/.bin/eslint +TSC ?= $(ROOT)node_modules/.bin/tsc +NYC ?= $(ROOT)node_modules/.bin/nyc +MOCHA ?= $(ROOT)node_modules/.bin/mocha +ROLLUP ?= $(ROOT)node_modules/.bin/rollup +TYPEDOC ?= $(ROOT)node_modules/.bin/typedoc # Common maintenance tasks. .PHONY: clean lint test build html @@ -25,4 +30,13 @@ depsclean: @rm -rf node_modules @echo -e " $(OK) deps clean" +# Shared recipes +.PHONY: mocha-test + +mocha-test: + @$(NYC) --reporter=text --reporter=html $(MOCHA) \ + --recursive --ui tdd \ + --require esm $(TEST_REQUIRES) \ + test/**/*_test.js + OK := \033[32;01m✓\033[0m diff --git a/fluent-bundle/makefile b/fluent-bundle/makefile index 834d83239..4c0f99ca8 100644 --- a/fluent-bundle/makefile +++ b/fluent-bundle/makefile @@ -4,30 +4,27 @@ GLOBAL := FluentBundle include ../common.mk lint: - @eslint --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts - @eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/ + @$(ESLINT) --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts + @$(ESLINT) --config $(ROOT)/eslint_test.json --max-warnings 0 test/ @echo -e " $(OK) lint" .PHONY: compile compile: esm/.compiled esm/.compiled: $(SOURCES) - @tsc + @$(TSC) @touch $@ @echo -e " $(OK) esm/ compiled" .PHONY: test test: esm/.compiled - @nyc --reporter=text --reporter=html mocha \ - --recursive --ui tdd \ - --require esm \ - test/**/*_test.js + @$(MAKE) mocha-test .PHONY: build build: index.js index.js: esm/.compiled - @rollup $(CURDIR)/esm/index.js \ + @$(ROLLUP) $(CURDIR)/esm/index.js \ --banner "/* $(PACKAGE)@$(VERSION) */" \ --amd.id $(PACKAGE) \ --name $(GLOBAL) \ @@ -36,7 +33,7 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @typedoc src \ + @$(TYPEDOC) src \ --out ../html/bundle \ --mode file \ --excludeNotExported \ @@ -48,6 +45,7 @@ html: clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js + @rm -rf ../html/bundle @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-dedent/makefile b/fluent-dedent/makefile index 0c064efcf..e5bd515cd 100644 --- a/fluent-dedent/makefile +++ b/fluent-dedent/makefile @@ -4,30 +4,27 @@ GLOBAL := FluentDedent include ../common.mk lint: - @eslint --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts - @eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/ + @$(ESLINT) --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts + @$(ESLINT) --config $(ROOT)/eslint_test.json --max-warnings 0 test/ @echo -e " $(OK) lint" .PHONY: compile compile: esm/.compiled esm/.compiled: $(SOURCES) - @tsc + @$(TSC) @touch $@ @echo -e " $(OK) esm/ compiled" .PHONY: test test: esm/.compiled - @nyc --reporter=text --reporter=html mocha \ - --recursive --ui tdd \ - --require esm \ - test/**/*_test.js + @$(MAKE) mocha-test .PHONY: build build: index.js index.js: esm/.compiled - @rollup $(CURDIR)/esm/index.js \ + @$(ROLLUP) $(CURDIR)/esm/index.js \ --banner "/* $(PACKAGE)@$(VERSION) */" \ --amd.id $(PACKAGE) \ --name $(GLOBAL) \ @@ -36,7 +33,7 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @typedoc src \ + @$(TYPEDOC) src \ --out ../html/dedent \ --mode file \ --excludeNotExported \ diff --git a/fluent-dom/makefile b/fluent-dom/makefile index 7c10690db..2b4e90eb0 100644 --- a/fluent-dom/makefile +++ b/fluent-dom/makefile @@ -5,31 +5,27 @@ DEPS := cached-iterable:CachedIterable include ../common.mk lint: - @eslint --config $(ROOT)/eslint_js.json --max-warnings 0 src/ - @eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/ + @$(ESLINT) --config $(ROOT)/eslint_js.json --max-warnings 0 src/ + @$(ESLINT) --config $(ROOT)/eslint_test.json --max-warnings 0 test/ @echo -e " $(OK) lint" .PHONY: compile compile: esm/.compiled esm/.compiled: $(SOURCES) - @tsc + @$(TSC) @touch $@ @echo -e " $(OK) esm/ compiled" .PHONY: test test: esm/.compiled - @nyc --reporter=text --reporter=html mocha \ - --recursive --ui tdd \ - --require esm \ - --require ./test/index \ - test/**/*_test.js + @$(MAKE) mocha-test TEST_REQUIRES="--require ./test/index" .PHONY: build build: index.js index.js: esm/.compiled - @rollup $(CURDIR)/esm/index.js \ + @$(ROLLUP) $(CURDIR)/esm/index.js \ --banner "/* $(PACKAGE)@$(VERSION) */" \ --amd.id $(PACKAGE) \ --name $(GLOBAL) \ @@ -39,7 +35,7 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @typedoc src \ + @$(TYPEDOC) src \ --out ../html/dom \ --mode file \ --excludeNotExported \ @@ -51,5 +47,6 @@ html: clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js + @rm -rf ../html/dom @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-gecko/makefile b/fluent-gecko/makefile index de38c0234..2fd82423e 100644 --- a/fluent-gecko/makefile +++ b/fluent-gecko/makefile @@ -7,7 +7,7 @@ version = $(1)@$(shell node -e "\ console.log(require('../$(1)/package.json').version)") lint: - @eslint --config $(ROOT)/eslint_js.json --max-warnings 0 src/ + @$(ESLINT) --config $(ROOT)/eslint_js.json --max-warnings 0 src/ @echo -e " $(OK) lint" test: ; @@ -17,7 +17,7 @@ build: FluentSyntax.jsm fluent-react.js FluentSyntax.jsm: $(SOURCES) $(MAKE) -sC ../fluent-syntax compile - @rollup $(CURDIR)/src/fluent-syntax.js \ + @$(ROLLUP) $(CURDIR)/src/fluent-syntax.js \ --config ./xpcom_config.js \ --no-treeshake \ --no-freeze \ @@ -27,7 +27,7 @@ FluentSyntax.jsm: $(SOURCES) fluent-react.js: $(SOURCES) $(MAKE) -sC ../fluent-react compile - @rollup $(CURDIR)/src/fluent-react.js \ + @$(ROLLUP) $(CURDIR)/src/fluent-react.js \ --config ./vendor_config.js \ --output.intro "/* $(call version,fluent-react) */" \ --output.file ./dist/$@ diff --git a/fluent-langneg/makefile b/fluent-langneg/makefile index 48a044ab9..927c919bd 100644 --- a/fluent-langneg/makefile +++ b/fluent-langneg/makefile @@ -4,30 +4,27 @@ GLOBAL := FluentLangNeg include ../common.mk lint: - @eslint --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts - @eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/ + @$(ESLINT) --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts + @$(ESLINT) --config $(ROOT)/eslint_test.json --max-warnings 0 test/ @echo -e " $(OK) lint" .PHONY: compile compile: esm/.compiled esm/.compiled: $(SOURCES) - @tsc + @$(TSC) @touch $@ @echo -e " $(OK) esm/ compiled" .PHONY: test test: esm/.compiled - @nyc --reporter=text --reporter=html mocha \ - --recursive --ui tdd \ - --require esm \ - test/**/*_test.js + @$(MAKE) mocha-test .PHONY: build build: index.js index.js: $(SOURCES) - @rollup $(CURDIR)/esm/index.js \ + @$(ROLLUP) $(CURDIR)/esm/index.js \ --banner "/* $(PACKAGE)@$(VERSION) */" \ --amd.id $(PACKAGE) \ --name $(GLOBAL) \ @@ -36,7 +33,7 @@ index.js: $(SOURCES) @echo -e " $(OK) $@ built" html: - @typedoc src \ + @$(TYPEDOC) src \ --out ../html/langneg \ --mode file \ --excludeNotExported \ @@ -48,5 +45,6 @@ html: clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js + @rm -rf ../html/langneg @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-react/makefile b/fluent-react/makefile index 53c099bae..d7fd6e978 100644 --- a/fluent-react/makefile +++ b/fluent-react/makefile @@ -1,30 +1,31 @@ PACKAGE := @fluent/react GLOBAL := FluentReact +JEST ?= node_modules/.bin/jest include ../common.mk lint: - @eslint --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts - @eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/ + @$(ESLINT) --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts + @$(ESLINT) --config $(ROOT)/eslint_test.json --max-warnings 0 test/ @echo -e " $(OK) lint" .PHONY: compile compile: esm/.compiled esm/.compiled: $(SOURCES) - @tsc + @$(TSC) @touch $@ @echo -e " $(OK) esm/ compiled" .PHONY: test test: esm/.compiled - @jest --collect-coverage + @$(JEST) --collect-coverage .PHONY: build build: index.js index.js: esm/.compiled - @rollup $(CURDIR)/esm/index.js \ + @$(ROLLUP) $(CURDIR)/esm/index.js \ --banner "/* $(PACKAGE)@$(VERSION) */" \ --amd.id $(PACKAGE) \ --name $(GLOBAL) \ @@ -34,7 +35,7 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @typedoc src \ + @$(TYPEDOC) src \ --out ../html/react \ --mode file \ --excludeNotExported \ @@ -46,5 +47,6 @@ html: clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js + @rm -rf ../html/react @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-sequence/makefile b/fluent-sequence/makefile index f3ab1795e..07e33fa72 100644 --- a/fluent-sequence/makefile +++ b/fluent-sequence/makefile @@ -4,30 +4,27 @@ GLOBAL := FluentSequence include ../common.mk lint: - @eslint --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts - @eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/ + @$(ESLINT) --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts + @$(ESLINT) --config $(ROOT)/eslint_test.json --max-warnings 0 test/ @echo -e " $(OK) lint" .PHONY: compile compile: esm/.compiled esm/.compiled: $(SOURCES) - @tsc + @$(TSC) @touch $@ @echo -e " $(OK) esm/ compiled" .PHONY: test test: esm/.compiled - @nyc --reporter=text --reporter=html mocha \ - --recursive --ui tdd \ - --require esm \ - test/**/*_test.js + @$(MAKE) mocha-test .PHONY: build build: index.js index.js: esm/.compiled - @rollup $(CURDIR)/esm/index.js \ + @$(ROLLUP) $(CURDIR)/esm/index.js \ --banner "/* $(PACKAGE)@$(VERSION) */" \ --amd.id $(PACKAGE) \ --name $(GLOBAL) \ @@ -36,7 +33,7 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @typedoc src \ + @$(TYPEDOC) src \ --out ../html/sequence \ --mode file \ --excludeNotExported \ @@ -48,5 +45,6 @@ html: clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js + @rm -rf ../html/sequence @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-syntax/makefile b/fluent-syntax/makefile index adb8bc751..334be5434 100644 --- a/fluent-syntax/makefile +++ b/fluent-syntax/makefile @@ -4,30 +4,27 @@ GLOBAL := FluentSyntax include ../common.mk lint: - @eslint --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts - @eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/ + @$(ESLINT) --config $(ROOT)/eslint_ts.json --max-warnings 0 src/*.ts + @$(ESLINT) --config $(ROOT)/eslint_test.json --max-warnings 0 test/ @echo -e " $(OK) lint" .PHONY: compile compile: esm/.compiled esm/.compiled: $(SOURCES) - @tsc + @$(TSC) @touch $@ @echo -e " $(OK) esm/ compiled" .PHONY: test test: esm/.compiled - @nyc --reporter=text --reporter=html mocha \ - --recursive --ui tdd \ - --require esm \ - test/**/*_test.js + @$(MAKE) mocha-test .PHONY: build build: index.js index.js: esm/.compiled - @rollup $(CURDIR)/esm/index.js \ + @$(ROLLUP) $(CURDIR)/esm/index.js \ --banner "/* $(PACKAGE)@$(VERSION) */" \ --amd.id $(PACKAGE) \ --name $(GLOBAL) \ @@ -36,7 +33,7 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @typedoc src \ + @$(TYPEDOC) src \ --out ../html/syntax \ --mode file \ --excludeNotExported \ @@ -48,6 +45,7 @@ html: clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js + @rm -rf ../html/syntax @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/makefile b/makefile index 16db2725e..527cd9be1 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ export SHELL := /bin/bash -export PATH := $(CURDIR)/node_modules/.bin:$(PATH) +GH_PAGES ?= $(CURDIR)/node_modules/.bin/gh-pages TARGETS := all dist lint test build html deps depsclean PACKAGES := $(wildcard fluent-*) @@ -14,7 +14,7 @@ $(PACKAGES): .PHONY: $(TARGETS) $(PACKAGES) deploy-html: - gh-pages -d html + $(GH_PAGES) -d html clean: $(PACKAGES) @echo From 0b79a37fe5594b9bdfb6659ab690b32ce055aa15 Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Mon, 18 May 2020 17:28:36 +0200 Subject: [PATCH 2/5] Use shared rollup cmd for most libs --- common.mk | 8 ++++++++ fluent-bundle/makefile | 7 +------ fluent-dedent/makefile | 7 +------ fluent-langneg/makefile | 7 +------ fluent-sequence/makefile | 7 +------ fluent-syntax/makefile | 7 +------ 6 files changed, 13 insertions(+), 30 deletions(-) diff --git a/common.mk b/common.mk index d884c2b6c..2173fda09 100644 --- a/common.mk +++ b/common.mk @@ -13,6 +13,14 @@ MOCHA ?= $(ROOT)node_modules/.bin/mocha ROLLUP ?= $(ROOT)node_modules/.bin/rollup TYPEDOC ?= $(ROOT)node_modules/.bin/typedoc +ROLLUP_CMD = $(ROLLUP) $(CURDIR)/esm/index.js \ + --banner "/* $(PACKAGE)@$(VERSION) */" \ + --amd.id $(PACKAGE) \ + --name $(GLOBAL) \ + --output.format umd \ + --output.file \ + $(NULL) + # Common maintenance tasks. .PHONY: clean lint test build html diff --git a/fluent-bundle/makefile b/fluent-bundle/makefile index 4c0f99ca8..49b968993 100644 --- a/fluent-bundle/makefile +++ b/fluent-bundle/makefile @@ -24,12 +24,7 @@ test: esm/.compiled build: index.js index.js: esm/.compiled - @$(ROLLUP) $(CURDIR)/esm/index.js \ - --banner "/* $(PACKAGE)@$(VERSION) */" \ - --amd.id $(PACKAGE) \ - --name $(GLOBAL) \ - --output.format umd \ - --output.file $@ + @$(ROLLUP_CMD) $@ @echo -e " $(OK) $@ built" html: diff --git a/fluent-dedent/makefile b/fluent-dedent/makefile index e5bd515cd..219ed82b8 100644 --- a/fluent-dedent/makefile +++ b/fluent-dedent/makefile @@ -24,12 +24,7 @@ test: esm/.compiled build: index.js index.js: esm/.compiled - @$(ROLLUP) $(CURDIR)/esm/index.js \ - --banner "/* $(PACKAGE)@$(VERSION) */" \ - --amd.id $(PACKAGE) \ - --name $(GLOBAL) \ - --output.format umd \ - --output.file $@ + @$(ROLLUP_CMD) $@ @echo -e " $(OK) $@ built" html: diff --git a/fluent-langneg/makefile b/fluent-langneg/makefile index 927c919bd..5518a25cf 100644 --- a/fluent-langneg/makefile +++ b/fluent-langneg/makefile @@ -24,12 +24,7 @@ test: esm/.compiled build: index.js index.js: $(SOURCES) - @$(ROLLUP) $(CURDIR)/esm/index.js \ - --banner "/* $(PACKAGE)@$(VERSION) */" \ - --amd.id $(PACKAGE) \ - --name $(GLOBAL) \ - --output.format umd \ - --output.file $@ + @$(ROLLUP_CMD) $@ @echo -e " $(OK) $@ built" html: diff --git a/fluent-sequence/makefile b/fluent-sequence/makefile index 07e33fa72..dd716a429 100644 --- a/fluent-sequence/makefile +++ b/fluent-sequence/makefile @@ -24,12 +24,7 @@ test: esm/.compiled build: index.js index.js: esm/.compiled - @$(ROLLUP) $(CURDIR)/esm/index.js \ - --banner "/* $(PACKAGE)@$(VERSION) */" \ - --amd.id $(PACKAGE) \ - --name $(GLOBAL) \ - --output.format umd \ - --output.file $@ + @$(ROLLUP_CMD) $@ @echo -e " $(OK) $@ built" html: diff --git a/fluent-syntax/makefile b/fluent-syntax/makefile index 334be5434..775ac4660 100644 --- a/fluent-syntax/makefile +++ b/fluent-syntax/makefile @@ -24,12 +24,7 @@ test: esm/.compiled build: index.js index.js: esm/.compiled - @$(ROLLUP) $(CURDIR)/esm/index.js \ - --banner "/* $(PACKAGE)@$(VERSION) */" \ - --amd.id $(PACKAGE) \ - --name $(GLOBAL) \ - --output.format umd \ - --output.file $@ + @$(ROLLUP_CMD) $@ @echo -e " $(OK) $@ built" html: From 533184dfac5b5c39977dc1ad7c664335b95f98f4 Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Mon, 18 May 2020 17:43:24 +0200 Subject: [PATCH 3/5] Use shared typedoc command --- common.mk | 10 ++++++++++ fluent-bundle/makefile | 10 ++-------- fluent-dedent/makefile | 8 +------- fluent-dom/makefile | 10 ++-------- fluent-langneg/makefile | 10 ++-------- fluent-react/makefile | 10 ++-------- fluent-sequence/makefile | 10 ++-------- fluent-syntax/makefile | 10 ++-------- 8 files changed, 23 insertions(+), 55 deletions(-) diff --git a/common.mk b/common.mk index 2173fda09..d40546cc2 100644 --- a/common.mk +++ b/common.mk @@ -4,6 +4,7 @@ ROOT := $(dir $(lastword $(MAKEFILE_LIST))) SOURCES := $(wildcard src/*) VERSION := $(shell node -pe "require('./package.json').version") +DOC_DESTINATION := $(subst @fluent, ../html, $(PACKAGE)) export SHELL := /bin/bash ESLINT ?= $(ROOT)node_modules/.bin/eslint @@ -21,6 +22,15 @@ ROLLUP_CMD = $(ROLLUP) $(CURDIR)/esm/index.js \ --output.file \ $(NULL) +TYPEDOC_CMD = $(TYPEDOC) src \ + --out $(DOC_DESTINATION) \ + --mode file \ + --excludeNotExported \ + --excludePrivate \ + --logger none \ + --hideGenerator \ + $(NULL) + # Common maintenance tasks. .PHONY: clean lint test build html diff --git a/fluent-bundle/makefile b/fluent-bundle/makefile index 49b968993..1f6c2f60a 100644 --- a/fluent-bundle/makefile +++ b/fluent-bundle/makefile @@ -28,19 +28,13 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @$(TYPEDOC) src \ - --out ../html/bundle \ - --mode file \ - --excludeNotExported \ - --excludePrivate \ - --logger none \ - --hideGenerator + @$(TYPEDOC_CMD) @echo -e " $(OK) html built" clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js - @rm -rf ../html/bundle + @rm -rf $(DOC_DESTINATION) @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-dedent/makefile b/fluent-dedent/makefile index 219ed82b8..32a87fb1a 100644 --- a/fluent-dedent/makefile +++ b/fluent-dedent/makefile @@ -28,13 +28,7 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @$(TYPEDOC) src \ - --out ../html/dedent \ - --mode file \ - --excludeNotExported \ - --excludePrivate \ - --logger none \ - --hideGenerator + @$(TYPEDOC_CMD) @echo -e " $(OK) html built" clean: diff --git a/fluent-dom/makefile b/fluent-dom/makefile index 2b4e90eb0..af3541810 100644 --- a/fluent-dom/makefile +++ b/fluent-dom/makefile @@ -35,18 +35,12 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @$(TYPEDOC) src \ - --out ../html/dom \ - --mode file \ - --excludeNotExported \ - --excludePrivate \ - --logger none \ - --hideGenerator + @$(TYPEDOC_CMD) @echo -e " $(OK) html built" clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js - @rm -rf ../html/dom + @rm -rf $(DOC_DESTINATION) @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-langneg/makefile b/fluent-langneg/makefile index 5518a25cf..d59d7e6cf 100644 --- a/fluent-langneg/makefile +++ b/fluent-langneg/makefile @@ -28,18 +28,12 @@ index.js: $(SOURCES) @echo -e " $(OK) $@ built" html: - @$(TYPEDOC) src \ - --out ../html/langneg \ - --mode file \ - --excludeNotExported \ - --excludePrivate \ - --logger none \ - --hideGenerator + @$(TYPEDOC_CMD) @echo -e " $(OK) html built" clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js - @rm -rf ../html/langneg + @rm -rf $(DOC_DESTINATION) @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-react/makefile b/fluent-react/makefile index d7fd6e978..cd24bfdfd 100644 --- a/fluent-react/makefile +++ b/fluent-react/makefile @@ -35,18 +35,12 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @$(TYPEDOC) src \ - --out ../html/react \ - --mode file \ - --excludeNotExported \ - --excludePrivate \ - --logger none \ - --hideGenerator + @$(TYPEDOC_CMD) @echo -e " $(OK) html built" clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js - @rm -rf ../html/react + @rm -rf $(DOC_DESTINATION) @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-sequence/makefile b/fluent-sequence/makefile index dd716a429..719275fd5 100644 --- a/fluent-sequence/makefile +++ b/fluent-sequence/makefile @@ -28,18 +28,12 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @$(TYPEDOC) src \ - --out ../html/sequence \ - --mode file \ - --excludeNotExported \ - --excludePrivate \ - --logger none \ - --hideGenerator + @$(TYPEDOC_CMD) @echo -e " $(OK) html built" clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js - @rm -rf ../html/sequence + @rm -rf $(DOC_DESTINATION) @rm -rf .nyc_output coverage @echo -e " $(OK) clean" diff --git a/fluent-syntax/makefile b/fluent-syntax/makefile index 775ac4660..d1c390817 100644 --- a/fluent-syntax/makefile +++ b/fluent-syntax/makefile @@ -28,19 +28,13 @@ index.js: esm/.compiled @echo -e " $(OK) $@ built" html: - @$(TYPEDOC) src \ - --out ../html/syntax \ - --mode file \ - --excludeNotExported \ - --excludePrivate \ - --logger none \ - --hideGenerator + @$(TYPEDOC_CMD) @echo -e " $(OK) html built" clean: @rm -f esm/*.js esm/*.d.ts esm/.compiled @rm -f index.js - @rm -rf ../html/syntax + @rm -rf $(DOC_DESTINATION) @rm -rf .nyc_output coverage @echo -e " $(OK) clean" From aba0023d3c7d2b5c9f197e4dfaff774d5914a26d Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Tue, 19 May 2020 10:41:07 +0200 Subject: [PATCH 4/5] Review: move mocha-test to MOCHA_CMD --- common.mk | 15 ++++++--------- fluent-bundle/makefile | 2 +- fluent-dedent/makefile | 2 +- fluent-dom/makefile | 3 ++- fluent-langneg/makefile | 2 +- fluent-sequence/makefile | 2 +- fluent-syntax/makefile | 2 +- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/common.mk b/common.mk index d40546cc2..e8b14223f 100644 --- a/common.mk +++ b/common.mk @@ -31,6 +31,12 @@ TYPEDOC_CMD = $(TYPEDOC) src \ --hideGenerator \ $(NULL) +MOCHA_CMD =@$(NYC) --reporter=text --reporter=html $(MOCHA) \ + --recursive --ui tdd \ + --require esm $(TEST_REQUIRES) \ + test/**/*_test.js \ + $(NULL) + # Common maintenance tasks. .PHONY: clean lint test build html @@ -48,13 +54,4 @@ depsclean: @rm -rf node_modules @echo -e " $(OK) deps clean" -# Shared recipes -.PHONY: mocha-test - -mocha-test: - @$(NYC) --reporter=text --reporter=html $(MOCHA) \ - --recursive --ui tdd \ - --require esm $(TEST_REQUIRES) \ - test/**/*_test.js - OK := \033[32;01m✓\033[0m diff --git a/fluent-bundle/makefile b/fluent-bundle/makefile index 1f6c2f60a..bad475dad 100644 --- a/fluent-bundle/makefile +++ b/fluent-bundle/makefile @@ -18,7 +18,7 @@ esm/.compiled: $(SOURCES) .PHONY: test test: esm/.compiled - @$(MAKE) mocha-test + @$(MOCHA_CMD) .PHONY: build build: index.js diff --git a/fluent-dedent/makefile b/fluent-dedent/makefile index 32a87fb1a..f2ca8d13a 100644 --- a/fluent-dedent/makefile +++ b/fluent-dedent/makefile @@ -18,7 +18,7 @@ esm/.compiled: $(SOURCES) .PHONY: test test: esm/.compiled - @$(MAKE) mocha-test + @$(MOCHA_CMD) .PHONY: build build: index.js diff --git a/fluent-dom/makefile b/fluent-dom/makefile index af3541810..a5b2fa463 100644 --- a/fluent-dom/makefile +++ b/fluent-dom/makefile @@ -18,8 +18,9 @@ esm/.compiled: $(SOURCES) @echo -e " $(OK) esm/ compiled" .PHONY: test +test: TEST_REQUIRES=--require ./test/index test: esm/.compiled - @$(MAKE) mocha-test TEST_REQUIRES="--require ./test/index" + @$(MOCHA_CMD) .PHONY: build build: index.js diff --git a/fluent-langneg/makefile b/fluent-langneg/makefile index d59d7e6cf..6846b5eb4 100644 --- a/fluent-langneg/makefile +++ b/fluent-langneg/makefile @@ -18,7 +18,7 @@ esm/.compiled: $(SOURCES) .PHONY: test test: esm/.compiled - @$(MAKE) mocha-test + @$(MOCHA_CMD) .PHONY: build build: index.js diff --git a/fluent-sequence/makefile b/fluent-sequence/makefile index 719275fd5..3380f67a8 100644 --- a/fluent-sequence/makefile +++ b/fluent-sequence/makefile @@ -18,7 +18,7 @@ esm/.compiled: $(SOURCES) .PHONY: test test: esm/.compiled - @$(MAKE) mocha-test + @$(MOCHA_CMD) .PHONY: build build: index.js diff --git a/fluent-syntax/makefile b/fluent-syntax/makefile index d1c390817..8a3c47ccd 100644 --- a/fluent-syntax/makefile +++ b/fluent-syntax/makefile @@ -18,7 +18,7 @@ esm/.compiled: $(SOURCES) .PHONY: test test: esm/.compiled - @$(MAKE) mocha-test + @$(MOCHA_CMD) .PHONY: build build: index.js From 9047f66198ae7e29926ba826323de541aa857c2c Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Tue, 19 May 2020 11:01:08 +0200 Subject: [PATCH 5/5] MOCHA_EXTRA_REQUIRES --- common.mk | 3 ++- fluent-dom/makefile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common.mk b/common.mk index e8b14223f..9a96b5d8c 100644 --- a/common.mk +++ b/common.mk @@ -33,7 +33,8 @@ TYPEDOC_CMD = $(TYPEDOC) src \ MOCHA_CMD =@$(NYC) --reporter=text --reporter=html $(MOCHA) \ --recursive --ui tdd \ - --require esm $(TEST_REQUIRES) \ + --require esm \ + $(MOCHA_EXTRA_ARGS) \ test/**/*_test.js \ $(NULL) diff --git a/fluent-dom/makefile b/fluent-dom/makefile index a5b2fa463..8ab8150b6 100644 --- a/fluent-dom/makefile +++ b/fluent-dom/makefile @@ -18,7 +18,7 @@ esm/.compiled: $(SOURCES) @echo -e " $(OK) esm/ compiled" .PHONY: test -test: TEST_REQUIRES=--require ./test/index +test: MOCHA_EXTRA_ARGS=--require ./test/index test: esm/.compiled @$(MOCHA_CMD)