Skip to content

Commit e83eca9

Browse files
committed
Add recipes for listing TypeScript files
1 parent 073d11e commit e83eca9

File tree

6 files changed

+198
-2
lines changed

6 files changed

+198
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ SCRIPTS_FOLDER ?= scripts
140140
# Define the folder name convention for temporary files:
141141
TMP_FOLDER ?= tmp
142142

143-
# Define the folder name convention for type definition files:
144-
TYPES_FOLDER ?= $(DOCUMENTATION_FOLDER)/types
143+
# Define the folder name convention for TypeScript definition files:
144+
TYPESCRIPT_DEFINITIONS_FOLDER ?= $(DOCUMENTATION_FOLDER)/types
145145

146146
# Define filename extension conventions (keep in alphabetical order):
147147
AWK_FILENAME_EXT ?= awk

tools/make/lib/ls/Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ TESTS_PATTERN ?= test*.$(JAVASCRIPT_FILENAME_EXT)
6262
# Define a filepath pattern for test files:
6363
TESTS_FILTER ?= .*/.*
6464

65+
# Define a filename pattern for TypeScript definition test files:
66+
TYPESCRIPT_DEFINITIONS_TESTS_PATTERN ?= test*.$(TYPESCRIPT_FILENAME_EXT)
67+
68+
# Define a filepath pattern for TypeScript definition test files:
69+
TYPESCRIPT_DEFINITIONS_TESTS_FILTER ?= .*/.*
70+
6571

6672
# Define a filename pattern for test fixtures:
6773
TESTS_FIXTURES_PATTERN ?= *.*
@@ -218,6 +224,19 @@ SVG_EQUATIONS_PATTERN ?= equation*.$(SVG_FILENAME_EXT)
218224
SVG_EQUATIONS_FILTER ?= .*/.*
219225

220226

227+
# Define a filename pattern for TypeScript files:
228+
TYPESCRIPT_PATTERN ?= *.$(TYPESCRIPT_FILENAME_EXT)
229+
230+
# Define a filepath pattern for TypeScript files:
231+
TYPESCRIPT_FILTER ?= .*/.*
232+
233+
# Define a filename pattern for TypeScript definition files:
234+
TYPESCRIPT_DEFINITIONS_PATTERN ?= *.$(TYPESCRIPT_DEFINITION_FILENAME_EXT)
235+
236+
# Define a filepath pattern for TypeScript definition files:
237+
TYPESCRIPT_DEFINITIONS_FILTER ?= .*/.*
238+
239+
221240
# Define a filename pattern for WebAssembly files:
222241
WASM_PATTERN ?= *.$(WASM_FILENAME_EXT)
223242

@@ -380,6 +399,12 @@ FIND_TOOLS_TESTS_FIXTURES_EXCLUDE_FLAGS ?= \
380399
-not -path "*/snippets/*" \
381400
-not -path "*/make/lib/*"
382401

402+
# TypeScript definition exclude flags:
403+
FIND_TYPESCRIPT_DEFINITIONS_EXCLUDE_FLAGS ?= $(FIND_COMMON_EXCLUDE_FLAGS)
404+
405+
# TypeScript definition tests exclude flags:
406+
FIND_TYPESCRIPT_DEFINITIONS_TESTS_EXCLUDE_FLAGS ?= $(FIND_COMMON_EXCLUDE_FLAGS)
407+
383408
# On Mac OSX, in order to use `|` and other regular expression operators, we need to use enhanced regular expression syntax (-E); see https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man7/re_format.7.html#//apple_ref/doc/man/7/re_format.
384409
ifeq ($(OS), Darwin)
385410
find_kernel_prefix := -E
@@ -411,4 +436,5 @@ include $(TOOLS_MAKE_LIB_DIR)/ls/tests_directories.mk
411436
include $(TOOLS_MAKE_LIB_DIR)/ls/tests_fixtures.mk
412437
include $(TOOLS_MAKE_LIB_DIR)/ls/tools_tests_directories.mk
413438
include $(TOOLS_MAKE_LIB_DIR)/ls/tools_tests_fixtures.mk
439+
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/Makefile
414440
include $(TOOLS_MAKE_LIB_DIR)/ls/wasm/Makefile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2019 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# DEPENDENCIES #
20+
21+
# Note: keep in alphabetical order
22+
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/definitions.mk
23+
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/definitions_tests.mk
24+
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/files.mk
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2019 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# VARIABLES #
20+
21+
# Define the command flags:
22+
FIND_TYPESCRIPT_DEFINITIONS_FLAGS ?= \
23+
-type f \
24+
-name "$(TYPESCRIPT_DEFINITIONS_PATTERN)" \
25+
-path "$(ROOT_DIR)/**/$(TYPESCRIPT_DEFINITIONS_FOLDER)/**" \
26+
-regex "$(TYPESCRIPT_DEFINITIONS_FILTER)" \
27+
$(FIND_TYPESCRIPT_DEFINITIONS_EXCLUDE_FLAGS)
28+
29+
30+
ifneq ($(OS), Darwin)
31+
FIND_TYPESCRIPT_DEFINITIONS_FLAGS := -regextype posix-extended $(FIND_TYPESCRIPT_DEFINITIONS_FLAGS)
32+
endif
33+
34+
# Define a command to list example files:
35+
FIND_TYPESCRIPT_DEFINITIONS_CMD ?= find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_DEFINITIONS_FLAGS)
36+
37+
# Define the list of example files:
38+
TYPESCRIPT_DEFINITIONS ?= $(shell $(FIND_TYPESCRIPT_DEFINITIONS_CMD))
39+
40+
41+
# TARGETS #
42+
43+
# List TypeScript definition files.
44+
#
45+
# This target prints a newline-delimited list of TypeScript definition files.
46+
47+
list-typescript-definitions:
48+
$(QUIET) find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_DEFINITIONS_FLAGS) $(find_print_list)
49+
50+
.PHONY: list-typescript-definitions
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2019 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# VARIABLES #
20+
21+
# Define the command flags:
22+
FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS ?= \
23+
-type f \
24+
-name "$(TYPESCRIPT_DEFINITIONS_TESTS_PATTERN)" \
25+
-regex "$(TYPESCRIPT_DEFINITIONS_TESTS_FILTER)" \
26+
$(FIND_TYPESCRIPT_DEFINITIONS_TESTS_EXCLUDE_FLAGS)
27+
28+
ifneq ($(OS), Darwin)
29+
FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS := -regextype posix-extended $(FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS)
30+
endif
31+
32+
# Define a command to list test files:
33+
FIND_TYPESCRIPT_DEFINITIONS_TESTS_CMD ?= find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS)
34+
35+
# Define the list of test files:
36+
TYPESCRIPT_DEFINITIONS_TESTS ?= $(shell $(FIND_TYPESCRIPT_DEFINITIONS_TESTS_CMD))
37+
38+
39+
# TARGETS #
40+
41+
# List TypeScript definition test files.
42+
#
43+
# This target prints a newline-delimited list of TypeScript definition test files.
44+
45+
list-typescript-definitions-tests:
46+
$(QUIET) find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS) $(find_print_list)
47+
48+
.PHONY: list-typescript-definitions-tests
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2019 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# VARIABLES #
20+
21+
# Define the command flags:
22+
FIND_TYPESCRIPT_FLAGS ?= \
23+
-type f \
24+
-name "$(TYPESCRIPT_PATTERN)" \
25+
-regex "$(TYPESCRIPT_FILTER)" \
26+
$(FIND_FILES_EXCLUDE_FLAGS)
27+
28+
ifneq ($(OS), Darwin)
29+
FIND_TYPESCRIPT_FLAGS := -regextype posix-extended $(FIND_TYPESCRIPT_FLAGS)
30+
endif
31+
32+
# Define a command for listing TypeScript files:
33+
FIND_TYPESCRIPT_CMD ?= find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_FLAGS)
34+
35+
# Define the list of files:
36+
TYPESCRIPT_FILES ?= $(shell $(FIND_TYPESCRIPT_CMD))
37+
38+
39+
# TARGETS #
40+
41+
# List all TypeScript files.
42+
#
43+
# This target prints a list of all TypeScript files.
44+
45+
list-typescript-files:
46+
$(QUIET) find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_FLAGS) $(find_print_list)
47+
48+
.PHONY: list-typescript-files

0 commit comments

Comments
 (0)