Skip to content

Commit ba888c8

Browse files
committed
Update documentation and add support for specifying search directory
1 parent 40f16d9 commit ba888c8

File tree

17 files changed

+269
-131
lines changed

17 files changed

+269
-131
lines changed

tools/make/lib/ls/pkgs/addons.mk

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,29 @@
1919
# VARIABLES #
2020

2121
# Define the path of the executable:
22-
LIST_PACKAGE_ADDONS ?= $(TOOLS_PKGS_DIR)/pkgs/addons/bin/cli
22+
LIST_PKGS_ADDONS ?= $(TOOLS_PKGS_DIR)/pkgs/addons/bin/cli
2323

2424
# Define the command flags:
25-
LIST_PACKAGE_ADDONS_FLAGS ?= --ignore=**/_tools/scaffold/**
25+
LIST_PKGS_ADDONS_FLAGS ?= --ignore=**/_tools/scaffold/**
2626

27+
# Define the directory from which to search for packages:
28+
LIST_PKGS_ADDONS_DIR ?= $(SRC_DIR)
2729

28-
# TARGETS #
2930

30-
# List all add-ons.
31-
#
32-
# This target prints a list of all add-ons.
31+
# RULES #
3332

34-
list-pkgs-addons: $(LIST_PACKAGE_ADDONS) $(NODE_MODULES)
35-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_ADDONS) $(LIST_PACKAGE_ADDONS_FLAGS) $(SRC_DIR)
33+
#/
34+
# Prints a list of all packages containing Node.js native add-ons.
35+
#
36+
# @param {string} [LIST_PKGS_ADDONS_DIR] - absolute path of the directory from which to search (default: source directory)
37+
#
38+
# @example
39+
# make list-pkgs-addons
40+
#
41+
# @example
42+
# make list-pkgs-addons LIST_PKGS_ADDONS_DIR=$PWD/lib/node_modules/\@stdlib/blas
43+
#/
44+
list-pkgs-addons: $(LIST_PKGS_ADDONS) $(NODE_MODULES)
45+
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PKGS_ADDONS) $(LIST_PKGS_ADDONS_FLAGS) $(LIST_PKGS_ADDONS_DIR)
3646

3747
.PHONY: list-pkgs-addons

tools/make/lib/ls/pkgs/browser_compatible.mk

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,29 @@
1919
# VARIABLES #
2020

2121
# Define the path of the executable:
22-
LIST_BROWSER_COMPATIBLE_PACKAGE_NAMES ?= $(TOOLS_PKGS_DIR)/pkgs/browser-compatible/bin/cli
22+
LIST_PKGS_BROWSER_COMPATIBLE ?= $(TOOLS_PKGS_DIR)/pkgs/browser-compatible/bin/cli
2323

2424
# Define the command flags:
25-
LIST_BROWSER_COMPATIBLE_PACKAGE_NAMES_FLAGS ?=
25+
LIST_PKGS_BROWSER_COMPATIBLE_FLAGS ?=
2626

27+
# Define the directory from which to search for packages:
28+
LIST_PKGS_BROWSER_COMPATIBLE_DIR ?= $(SRC_DIR)
2729

28-
# TARGETS #
2930

30-
# List browser compatible packages.
31-
#
32-
# This target prints a list of all packages which are compatible with browser environments.
31+
# RULES #
3332

34-
list-pkgs-browser-compatible: $(LIST_BROWSER_COMPATIBLE_PACKAGE_NAMES) $(NODE_MODULES)
35-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_BROWSER_COMPATIBLE_PACKAGE_NAMES) $(LIST_BROWSER_COMPATIBLE_PACKAGE_NAMES_FLAGS) $(SRC_DIR)
33+
#/
34+
# Prints a list of all packages which are compatible with browser environments.
35+
#
36+
# @param {string} [LIST_PKGS_BROWSER_COMPATIBLE_DIR] - absolute path of the directory from which to search (default: source directory)
37+
#
38+
# @example
39+
# make list-pkgs-browser-compatible
40+
#
41+
# @example
42+
# make list-pkgs-browser-compatible LIST_PKGS_BROWSER_COMPATIBLE_DIR=$PWD/lib/node_modules/\@stdlib/utils
43+
#/
44+
list-pkgs-browser-compatible: $(LIST_PKGS_BROWSER_COMPATIBLE) $(NODE_MODULES)
45+
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PKGS_BROWSER_COMPATIBLE) $(LIST_PKGS_BROWSER_COMPATIBLE_FLAGS) $(LIST_PKGS_BROWSER_COMPATIBLE_DIR)
3646

3747
.PHONY: list-pkgs-browser-compatible

tools/make/lib/ls/pkgs/clis.mk

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,29 @@
1919
# VARIABLES #
2020

2121
# Define the path of the executable:
22-
LIST_PACKAGE_CLIS ?= $(TOOLS_PKGS_DIR)/pkgs/clis/bin/cli
22+
LIST_PKGS_CLIS ?= $(TOOLS_PKGS_DIR)/pkgs/clis/bin/cli
2323

2424
# Define the command flags:
25-
LIST_PACKAGE_CLIS_FLAGS ?=
25+
LIST_PKGS_CLIS_FLAGS ?=
2626

27+
# Define the directory from which to search for packages:
28+
LIST_PKGS_CLIS_DIR ?= $(SRC_DIR)
2729

28-
# TARGETS #
2930

30-
# List all package command-line interfaces.
31-
#
32-
# This target prints a list of all package command-line interfaces.
31+
# RULES #
3332

34-
list-pkgs-clis: $(LIST_PACKAGE_CLIS) $(NODE_MODULES)
35-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_CLIS) $(LIST_PACKAGE_CLIS_FLAGS) $(SRC_DIR)
33+
#/
34+
# Prints a list of all packages containing command-line interfaces.
35+
#
36+
# @param {string} [LIST_PKGS_CLIS_DIR] - absolute path of the directory from which to search (default: source directory)
37+
#
38+
# @example
39+
# make list-pkgs-clis
40+
#
41+
# @example
42+
# make list-pkgs-clis LIST_PKGS_CLIS_DIR=$PWD/lib/node_modules/\@stdlib/utils
43+
#/
44+
list-pkgs-clis: $(LIST_PKGS_CLIS) $(NODE_MODULES)
45+
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PKGS_CLIS) $(LIST_PKGS_CLIS_FLAGS) $(LIST_PKGS_CLIS_DIR)
3646

3747
.PHONY: list-pkgs-clis

tools/make/lib/ls/pkgs/cmds.mk

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,29 @@
1919
# VARIABLES #
2020

2121
# Define the path of the executable:
22-
LIST_PACKAGE_CMDS ?= $(TOOLS_PKGS_DIR)/pkgs/cmds/bin/cli
22+
LIST_PKGS_CMDS ?= $(TOOLS_PKGS_DIR)/pkgs/cmds/bin/cli
2323

2424
# Define the command flags:
25-
LIST_PACKAGE_CMDS_FLAGS ?=
25+
LIST_PKGS_CMDS_FLAGS ?=
2626

27+
# Define the directory from which to search for packages:
28+
LIST_PKGS_CMDS_DIR ?= $(SRC_DIR)
2729

28-
# TARGETS #
2930

30-
# List all package command-line interface commands.
31-
#
32-
# This target prints a list of all package command-line interface commands.
31+
# RULES #
3332

34-
list-pkgs-cmds: $(LIST_PACKAGE_CMDS) $(NODE_MODULES)
35-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_CMDS) $(LIST_PACKAGE_CMDS_FLAGS) $(SRC_DIR)
33+
#/
34+
# Prints a list of all package command-line interface commands.
35+
#
36+
# @param {string} [LIST_PKGS_CMDS_DIR] - absolute path of the directory from which to search (default: source directory)
37+
#
38+
# @example
39+
# make list-pkgs-cmds
40+
#
41+
# @example
42+
# make list-pkgs-cmds LIST_PKGS_CMDS_DIR=$PWD/lib/node_modules/\@stdlib/utils
43+
#/
44+
list-pkgs-cmds: $(LIST_PKGS_CMDS) $(NODE_MODULES)
45+
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PKGS_CMDS) $(LIST_PKGS_CMDS_FLAGS) $(LIST_PKGS_CMDS_DIR)
3646

3747
.PHONY: list-pkgs-cmds

tools/make/lib/ls/pkgs/includes.mk

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,29 @@
1919
# VARIABLES #
2020

2121
# Define the path of the executable:
22-
LIST_PACKAGE_INCLUDES ?= $(TOOLS_PKGS_DIR)/pkgs/includes/bin/cli
22+
LIST_PKGS_INCLUDES ?= $(TOOLS_PKGS_DIR)/pkgs/includes/bin/cli
2323

2424
# Define the command flags:
25-
LIST_PACKAGE_INCLUDES_FLAGS ?=
25+
LIST_PKGS_INCLUDES_FLAGS ?=
26+
27+
# Define the directory from which to search for packages:
28+
LIST_PKGS_INCLUDES_DIR ?= $(SRC_DIR)
2629

2730

2831
# RULES #
2932

3033
#/
31-
# Lists package `include` directories.
34+
# Prints a list of package `include` directories.
35+
#
36+
# @param {string} [LIST_PKGS_INCLUDES_DIR] - absolute path of the directory from which to search (default: source directory)
3237
#
3338
# @example
3439
# make list-pkgs-includes
40+
#
41+
# @example
42+
# make list-pkgs-includes LIST_PKGS_INCLUDES_DIR=$PWD/lib/node_modules/\@stdlib/blas
3543
#/
36-
list-pkgs-includes: $(LIST_PACKAGE_INCLUDES) $(NODE_MODULES)
37-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_INCLUDES) $(LIST_PACKAGE_INCLUDES_FLAGS) $(SRC_DIR)
44+
list-pkgs-includes: $(LIST_PKGS_INCLUDES) $(NODE_MODULES)
45+
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PKGS_INCLUDES) $(LIST_PKGS_INCLUDES_FLAGS) $(LIST_PKGS_INCLUDES_DIR)
3846

3947
.PHONY: list-pkgs-includes

tools/make/lib/ls/pkgs/installed.mk

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,72 +25,80 @@ LIST_INSTALLED_PACKAGES ?= $(TOOLS_PKGS_DIR)/pkgs/installed/bin/cli
2525
LIST_INSTALLED_PACKAGES_FLAGS ?=
2626

2727

28-
# TARGETS #
28+
# RULES #
2929

30-
# List installed package dependencies.
30+
#/
31+
# Prints a list of all installed package dependencies.
3132
#
32-
# This target prints a list of all installed package dependencies.
33-
33+
# @example
34+
# make list-pkgs-installed
35+
#/
3436
list-pkgs-installed: $(NODE_MODULES) $(LIST_INSTALLED_PACKAGES)
3537
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_INSTALLED_PACKAGES) $(LIST_INSTALLED_PACKAGES_FLAGS) $(ROOT_DIR)
3638

3739
.PHONY: list-pkgs-installed
3840

39-
40-
# List installed package dependencies.
41+
#/
42+
# Prints the logical dependency tree for all installed package dependencies.
4143
#
42-
# This target prints the logical dependency tree for all installed package dependencies.
43-
44+
# @example
45+
# make list-pkgs-installed-logical-tree
46+
#/
4447
list-pkgs-installed-logical-tree: $(NODE_MODULES)
4548
$(QUIET) $(NPM) ls
4649

4750
.PHONY: list-pkgs-installed-logical-tree
4851

49-
50-
# List installed production package dependencies.
52+
#/
53+
# Prints the logical dependency tree for installed package dependencies list in the `dependencies` tree of the root `package.json`.
5154
#
52-
# This target prints the logical dependency tree for installed package dependencies list in the `dependencies` tree of the root `package.json`.
53-
55+
# @example
56+
# make list-pkgs-installed-logical-tree-prod
57+
#/
5458
list-pkgs-installed-logical-tree-prod: $(NODE_MODULES)
5559
$(QUIET) $(NPM) ls --prod
5660

5761
.PHONY: list-pkgs-installed-logical-tree-prod
5862

59-
60-
# List installed development package dependencies.
63+
#/
64+
# Prints the logical dependency tree for installed package dependencies list in the `devDependencies` tree of the root `package.json`.
6165
#
62-
# This target prints the logical dependency tree for installed package dependencies list in the `devDependencies` tree of the root `package.json`.
63-
66+
# @example
67+
# make list-pkgs-installed-logical-tree-dev
68+
#/
6469
list-pkgs-installed-logical-tree-dev: $(NODE_MODULES)
6570
$(QUIET) $(NPM) ls --dev
6671

6772
.PHONY: list-pkgs-installed-logical-tree-dev
6873

69-
70-
# List installed package dependencies.
74+
#/
75+
# Prints the logical dependency tree for all installed package dependencies as JSON.
7176
#
72-
# This target prints the logical dependency tree for all installed package dependencies as JSON.
73-
77+
# @example
78+
# make list-pkgs-installed-logical-tree-json
79+
#/
7480
list-pkgs-installed-logical-tree-json: $(NODE_MODULES)
7581
$(QUIET) $(NPM) ls --json
7682

7783
.PHONY: list-pkgs-installed-logical-tree-json
7884

79-
80-
# List installed production package dependencies.
85+
#/
86+
# Prints the logical dependency tree as JSON for installed package dependencies list in the `dependencies` tree of the root `package.json`.
8187
#
82-
# This target prints the logical dependency tree as JSON for installed package dependencies list in the `dependencies` tree of the root `package.json`.
83-
88+
# @example
89+
# make list-pkgs-installed-logical-tree-prod-json
90+
#/
8491
list-pkgs-installed-logical-tree-prod-json: $(NODE_MODULES)
8592
$(QUIET) $(NPM) ls --prod --json
8693

8794
.PHONY: list-pkgs-installed-logical-tree-prod-json
8895

89-
90-
# List installed development package dependencies.
96+
#/
97+
# Prints the logical dependency tree as JSON for installed package dependencies list in the `devDependencies` tree of the root `package.json`.
9198
#
92-
# This target prints the logical dependency tree as JSON for installed package dependencies list in the `devDependencies` tree of the root `package.json`.
93-
99+
# @example
100+
# make list-pkgs-installed-logical-tree-dev-json
101+
#/
94102
list-pkgs-installed-logical-tree-dev-json: $(NODE_MODULES)
95103
$(QUIET) $(NPM) ls --dev --json
96104

tools/make/lib/ls/pkgs/lib.mk

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,20 @@ FIND_LIB_PACKAGES_CMD ?= find $(find_kernel_prefix) $(SRC_DIR) $(FIND_LIB_PACKAG
3737
LIB_PACKAGES ?= $(shell $(FIND_LIB_PACKAGES_CMD))
3838

3939

40-
# TARGETS #
40+
# RULES #
4141

42-
# List all packages.
42+
#/
43+
# Prints a list of all packages.
4344
#
44-
# This target prints a list of all packages.
45-
45+
# @param {string} [PACKAGES_PATTERN='package.json'] - filename pattern for identifying packages
46+
# @param {string} [PACKAGES_FILTER='.*/.*'] - filepath pattern for finding packages
47+
#
48+
# @example
49+
# make list-lib-pkgs
50+
#
51+
# @example
52+
# make list-lib-pkgs PACKAGES_FILTER='.*/math/base/special/.*'
53+
#/
4654
list-lib-pkgs:
4755
$(QUIET) find $(find_kernel_prefix) $(SRC_DIR) $(FIND_LIB_PACKAGES_FLAGS) | xargs printf '%s\n'
4856

tools/make/lib/ls/pkgs/names.mk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@
1919
# VARIABLES #
2020

2121
# Define the path of the executable:
22-
LIST_PACKAGE_NAMES ?= $(TOOLS_PKGS_DIR)/pkgs/names/bin/cli
22+
LIST_PKGS_NAMES ?= $(TOOLS_PKGS_DIR)/pkgs/names/bin/cli
2323

2424
# Define the command flags:
25-
LIST_PACKAGE_NAMES_FLAGS ?=
25+
LIST_PKGS_NAMES_FLAGS ?=
2626

2727
# Define the directory from which to search for packages:
28-
LIST_PACKAGE_NAMES_DIR ?= $(SRC_DIR)
28+
LIST_PKGS_NAMES_DIR ?= $(SRC_DIR)
2929

3030

3131
# RULES #
3232

3333
#/
3434
# Prints a list of all package names.
3535
#
36-
# @param {string} [LIST_PACKAGE_NAMES_DIR] - absolute path of the directory from which to search for packages (default: source directory)
36+
# @param {string} [LIST_PKGS_NAMES_DIR] - absolute path of the directory from which to search (default: source directory)
3737
#
3838
# @example
3939
# make list-pkgs-names
4040
#
4141
# @example
42-
# make list-pkgs-names LIST_PACKAGE_NAMES_DIR=$PWD/lib/node_modules/\@stdlib/utils
42+
# make list-pkgs-names LIST_PKGS_NAMES_DIR=$PWD/lib/node_modules/\@stdlib/utils
4343
#/
44-
list-pkgs-names: $(LIST_PACKAGE_NAMES) $(NODE_MODULES)
45-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_NAMES) $(LIST_PACKAGE_NAMES_FLAGS) $(LIST_PACKAGE_NAMES_DIR)
44+
list-pkgs-names: $(LIST_PKGS_NAMES) $(NODE_MODULES)
45+
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PKGS_NAMES) $(LIST_PKGS_NAMES_FLAGS) $(LIST_PKGS_NAMES_DIR)
4646

4747
.PHONY: list-pkgs-names

tools/make/lib/ls/pkgs/namespace_readmes.mk

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,29 @@
1919
# VARIABLES #
2020

2121
# Define the path of the executable:
22-
LIST_PACKAGE_NAMESPACE_READMES ?= $(TOOLS_PKGS_DIR)/pkgs/namespace-readmes/bin/cli
22+
LIST_PKGS_NAMESPACE_READMES ?= $(TOOLS_PKGS_DIR)/pkgs/namespace-readmes/bin/cli
2323

2424
# Define the command flags:
25-
LIST_PACKAGE_NAMESPACE_READMES_FLAGS ?=
25+
LIST_PKGS_NAMESPACE_READMES_FLAGS ?=
2626

2727
# Define the directory from which to search for namespace READMEs:
28-
LIST_PACKAGE_NAMESPACE_READMES_DIR ?= $(SRC_DIR)
28+
LIST_PKGS_NAMESPACE_READMES_DIR ?= $(SRC_DIR)
2929

3030

3131
# RULES #
3232

3333
#/
3434
# Prints a list of all namespace package READMEs.
3535
#
36+
# @param {string} [LIST_PKGS_NAMESPACE_READMES_DIR] - absolute path of the directory from which to search (default: source directory)
37+
#
3638
# @example
3739
# make list-pkgs-namespace-readmes
3840
#
3941
# @example
40-
# make list-pkgs-namespace-readmes LIST_PACKAGE_NAMESPACE_READMES_DIR=$PWD/lib/node_modules/\@stdlib/utils
42+
# make list-pkgs-namespace-readmes LIST_PKGS_NAMESPACE_READMES_DIR=$PWD/lib/node_modules/\@stdlib/utils
4143
#/
42-
list-pkgs-namespace-readmes: $(LIST_PACKAGE_NAMESPACE_READMES) $(NODE_MODULES)
43-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_NAMESPACE_READMES) $(LIST_PACKAGE_NAMESPACE_READMES_FLAGS) $(LIST_PACKAGE_NAMESPACE_READMES_DIR)
44+
list-pkgs-namespace-readmes: $(LIST_PKGS_NAMESPACE_READMES) $(NODE_MODULES)
45+
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PKGS_NAMESPACE_READMES) $(LIST_PKGS_NAMESPACE_READMES_FLAGS) $(LIST_PKGS_NAMESPACE_READMES_DIR)
4446

4547
.PHONY: list-pkgs-namespace-readmes

0 commit comments

Comments
 (0)