File tree Expand file tree Collapse file tree 10 files changed +87
-135
lines changed Expand file tree Collapse file tree 10 files changed +87
-135
lines changed Original file line number Diff line number Diff line change 11# This makefile is intended to be included by each package's makefile. The
22# paths are relative to the package directory.
33
4- ROOT := $(CURDIR ) /..
4+ ROOT := $(dir $( lastword $( MAKEFILE_LIST ) ) )
55SOURCES := $(wildcard src/* )
66VERSION := $(shell node -pe "require('./package.json') .version")
7+ DOC_DESTINATION := $(subst @fluent, ../html, $(PACKAGE ) )
78
89export SHELL := /bin/bash
9- export PATH := $(CURDIR ) /node_modules/.bin:$(ROOT ) /node_modules/.bin:$(PATH )
10+ ESLINT ?= $(ROOT ) node_modules/.bin/eslint
11+ TSC ?= $(ROOT ) node_modules/.bin/tsc
12+ NYC ?= $(ROOT ) node_modules/.bin/nyc
13+ MOCHA ?= $(ROOT ) node_modules/.bin/mocha
14+ ROLLUP ?= $(ROOT ) node_modules/.bin/rollup
15+ TYPEDOC ?= $(ROOT ) node_modules/.bin/typedoc
16+
17+ ROLLUP_CMD = $(ROLLUP ) $(CURDIR ) /esm/index.js \
18+ --banner "/* $(PACKAGE ) @$(VERSION ) */" \
19+ --amd.id $(PACKAGE ) \
20+ --name $(GLOBAL ) \
21+ --output.format umd \
22+ --output.file \
23+ $(NULL )
24+
25+ TYPEDOC_CMD = $(TYPEDOC ) src \
26+ --out $(DOC_DESTINATION ) \
27+ --mode file \
28+ --excludeNotExported \
29+ --excludePrivate \
30+ --logger none \
31+ --hideGenerator \
32+ $(NULL )
33+
34+ MOCHA_CMD =@$(NYC ) --reporter=text --reporter=html $(MOCHA ) \
35+ --recursive --ui tdd \
36+ --require esm \
37+ $(MOCHA_EXTRA_ARGS ) \
38+ test/**/*_test.js \
39+ $(NULL )
1040
1141# Common maintenance tasks.
1242.PHONY : clean lint test build html
Original file line number Diff line number Diff line change @@ -4,50 +4,37 @@ GLOBAL := FluentBundle
44include ../common.mk
55
66lint :
7- @eslint --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
8- @eslint --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
7+ @$( ESLINT ) --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
8+ @$( ESLINT ) --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
99 @echo -e " $( OK) lint"
1010
1111.PHONY : compile
1212compile : esm/.compiled
1313
1414esm/.compiled : $(SOURCES )
15- @tsc
15+ @$( TSC )
1616 @touch $@
1717 @echo -e " $( OK) esm/ compiled"
1818
1919.PHONY : test
2020test : esm/.compiled
21- @nyc --reporter=text --reporter=html mocha \
22- --recursive --ui tdd \
23- --require esm \
24- test/** /* _test.js
21+ @$(MOCHA_CMD )
2522
2623.PHONY : build
2724build : index.js
2825
2926index.js : esm/.compiled
30- @rollup $(CURDIR ) /esm/index.js \
31- --banner " /* $( PACKAGE) @$( VERSION) */" \
32- --amd.id $(PACKAGE ) \
33- --name $(GLOBAL ) \
34- --output.format umd \
35- --output.file $@
27+ @$(ROLLUP_CMD ) $@
3628 @echo -e " $( OK) $@ built"
3729
3830html :
39- @typedoc src \
40- --out ../html/bundle \
41- --mode file \
42- --excludeNotExported \
43- --excludePrivate \
44- --logger none \
45- --hideGenerator
31+ @$(TYPEDOC_CMD )
4632 @echo -e " $( OK) html built"
4733
4834clean :
4935 @rm -f esm/* .js esm/* .d.ts esm/.compiled
5036 @rm -f index.js
37+ @rm -rf $(DOC_DESTINATION )
5138 @rm -rf .nyc_output coverage
5239 @echo -e " $( OK) clean"
5340
Original file line number Diff line number Diff line change @@ -4,45 +4,31 @@ GLOBAL := FluentDedent
44include ../common.mk
55
66lint :
7- @eslint --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
8- @eslint --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
7+ @$( ESLINT ) --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
8+ @$( ESLINT ) --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
99 @echo -e " $( OK) lint"
1010
1111.PHONY : compile
1212compile : esm/.compiled
1313
1414esm/.compiled : $(SOURCES )
15- @tsc
15+ @$( TSC )
1616 @touch $@
1717 @echo -e " $( OK) esm/ compiled"
1818
1919.PHONY : test
2020test : esm/.compiled
21- @nyc --reporter=text --reporter=html mocha \
22- --recursive --ui tdd \
23- --require esm \
24- test/** /* _test.js
21+ @$(MOCHA_CMD )
2522
2623.PHONY : build
2724build : index.js
2825
2926index.js : esm/.compiled
30- @rollup $(CURDIR ) /esm/index.js \
31- --banner " /* $( PACKAGE) @$( VERSION) */" \
32- --amd.id $(PACKAGE ) \
33- --name $(GLOBAL ) \
34- --output.format umd \
35- --output.file $@
27+ @$(ROLLUP_CMD ) $@
3628 @echo -e " $( OK) $@ built"
3729
3830html :
39- @typedoc src \
40- --out ../html/dedent \
41- --mode file \
42- --excludeNotExported \
43- --excludePrivate \
44- --logger none \
45- --hideGenerator
31+ @$(TYPEDOC_CMD )
4632 @echo -e " $( OK) html built"
4733
4834clean :
Original file line number Diff line number Diff line change @@ -5,31 +5,28 @@ DEPS := cached-iterable:CachedIterable
55include ../common.mk
66
77lint :
8- @eslint --config $(ROOT ) /eslint_js.json --max-warnings 0 src/
9- @eslint --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
8+ @$( ESLINT ) --config $(ROOT ) /eslint_js.json --max-warnings 0 src/
9+ @$( ESLINT ) --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
1010 @echo -e " $( OK) lint"
1111
1212.PHONY : compile
1313compile : esm/.compiled
1414
1515esm/.compiled : $(SOURCES )
16- @tsc
16+ @$( TSC )
1717 @touch $@
1818 @echo -e " $( OK) esm/ compiled"
1919
2020.PHONY : test
21+ test : MOCHA_EXTRA_ARGS=--require ./test/index
2122test : esm/.compiled
22- @nyc --reporter=text --reporter=html mocha \
23- --recursive --ui tdd \
24- --require esm \
25- --require ./test/index \
26- test/** /* _test.js
23+ @$(MOCHA_CMD )
2724
2825.PHONY : build
2926build : index.js
3027
3128index.js : esm/.compiled
32- @rollup $(CURDIR ) /esm/index.js \
29+ @$( ROLLUP ) $(CURDIR ) /esm/index.js \
3330 --banner " /* $( PACKAGE) @$( VERSION) */" \
3431 --amd.id $(PACKAGE ) \
3532 --name $(GLOBAL ) \
@@ -39,17 +36,12 @@ index.js: esm/.compiled
3936 @echo -e " $( OK) $@ built"
4037
4138html :
42- @typedoc src \
43- --out ../html/dom \
44- --mode file \
45- --excludeNotExported \
46- --excludePrivate \
47- --logger none \
48- --hideGenerator
39+ @$(TYPEDOC_CMD )
4940 @echo -e " $( OK) html built"
5041
5142clean :
5243 @rm -f esm/* .js esm/* .d.ts esm/.compiled
5344 @rm -f index.js
45+ @rm -rf $(DOC_DESTINATION )
5446 @rm -rf .nyc_output coverage
5547 @echo -e " $( OK) clean"
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ version = $(1)@$(shell node -e "\
77 console.log(require('../$(1 ) /package.json') .version)")
88
99lint :
10- @eslint --config $(ROOT ) /eslint_js.json --max-warnings 0 src/
10+ @$( ESLINT ) --config $(ROOT ) /eslint_js.json --max-warnings 0 src/
1111 @echo -e " $( OK) lint"
1212
1313test : ;
@@ -17,7 +17,7 @@ build: FluentSyntax.jsm fluent-react.js
1717
1818FluentSyntax.jsm : $(SOURCES )
1919 $(MAKE ) -sC ../fluent-syntax compile
20- @rollup $(CURDIR ) /src/fluent-syntax.js \
20+ @$( ROLLUP ) $(CURDIR ) /src/fluent-syntax.js \
2121 --config ./xpcom_config.js \
2222 --no-treeshake \
2323 --no-freeze \
@@ -27,7 +27,7 @@ FluentSyntax.jsm: $(SOURCES)
2727
2828fluent-react.js : $(SOURCES )
2929 $(MAKE ) -sC ../fluent-react compile
30- @rollup $(CURDIR ) /src/fluent-react.js \
30+ @$( ROLLUP ) $(CURDIR ) /src/fluent-react.js \
3131 --config ./vendor_config.js \
3232 --output.intro " /* $( call version,fluent-react) */" \
3333 --output.file ./dist/$@
Original file line number Diff line number Diff line change @@ -4,49 +4,36 @@ GLOBAL := FluentLangNeg
44include ../common.mk
55
66lint :
7- @eslint --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
8- @eslint --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
7+ @$( ESLINT ) --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
8+ @$( ESLINT ) --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
99 @echo -e " $( OK) lint"
1010
1111.PHONY : compile
1212compile : esm/.compiled
1313
1414esm/.compiled : $(SOURCES )
15- @tsc
15+ @$( TSC )
1616 @touch $@
1717 @echo -e " $( OK) esm/ compiled"
1818
1919.PHONY : test
2020test : esm/.compiled
21- @nyc --reporter=text --reporter=html mocha \
22- --recursive --ui tdd \
23- --require esm \
24- test/** /* _test.js
21+ @$(MOCHA_CMD )
2522
2623.PHONY : build
2724build : index.js
2825
2926index.js : $(SOURCES )
30- @rollup $(CURDIR ) /esm/index.js \
31- --banner " /* $( PACKAGE) @$( VERSION) */" \
32- --amd.id $(PACKAGE ) \
33- --name $(GLOBAL ) \
34- --output.format umd \
35- --output.file $@
27+ @$(ROLLUP_CMD ) $@
3628 @echo -e " $( OK) $@ built"
3729
3830html :
39- @typedoc src \
40- --out ../html/langneg \
41- --mode file \
42- --excludeNotExported \
43- --excludePrivate \
44- --logger none \
45- --hideGenerator
31+ @$(TYPEDOC_CMD )
4632 @echo -e " $( OK) html built"
4733
4834clean :
4935 @rm -f esm/* .js esm/* .d.ts esm/.compiled
5036 @rm -f index.js
37+ @rm -rf $(DOC_DESTINATION )
5138 @rm -rf .nyc_output coverage
5239 @echo -e " $( OK) clean"
Original file line number Diff line number Diff line change 11PACKAGE := @fluent/react
22GLOBAL := FluentReact
3+ JEST ?= node_modules/.bin/jest
34
45include ../common.mk
56
67lint :
7- @eslint --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
8- @eslint --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
8+ @$( ESLINT ) --config $(ROOT ) /eslint_ts.json --max-warnings 0 src/* .ts
9+ @$( ESLINT ) --config $(ROOT ) /eslint_test.json --max-warnings 0 test/
910 @echo -e " $( OK) lint"
1011
1112.PHONY : compile
1213compile : esm/.compiled
1314
1415esm/.compiled : $(SOURCES )
15- @tsc
16+ @$( TSC )
1617 @touch $@
1718 @echo -e " $( OK) esm/ compiled"
1819
1920.PHONY : test
2021test : esm/.compiled
21- @jest --collect-coverage
22+ @$( JEST ) --collect-coverage
2223
2324.PHONY : build
2425build : index.js
2526
2627index.js : esm/.compiled
27- @rollup $(CURDIR ) /esm/index.js \
28+ @$( ROLLUP ) $(CURDIR ) /esm/index.js \
2829 --banner " /* $( PACKAGE) @$( VERSION) */" \
2930 --amd.id $(PACKAGE ) \
3031 --name $(GLOBAL ) \
@@ -34,17 +35,12 @@ index.js: esm/.compiled
3435 @echo -e " $( OK) $@ built"
3536
3637html :
37- @typedoc src \
38- --out ../html/react \
39- --mode file \
40- --excludeNotExported \
41- --excludePrivate \
42- --logger none \
43- --hideGenerator
38+ @$(TYPEDOC_CMD )
4439 @echo -e " $( OK) html built"
4540
4641clean :
4742 @rm -f esm/* .js esm/* .d.ts esm/.compiled
4843 @rm -f index.js
44+ @rm -rf $(DOC_DESTINATION )
4945 @rm -rf .nyc_output coverage
5046 @echo -e " $( OK) clean"
You can’t perform that action at this time.
0 commit comments