Skip to content

Commit 374d3f4

Browse files
committed
Update module install recipes
1 parent 4aa29e1 commit 374d3f4

4 files changed

Lines changed: 40 additions & 18 deletions

File tree

tools/make/lib/node/Makefile

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
11

2-
# VARIABLES #
3-
4-
# Define the path to the root `package.json`:
5-
ROOT_PACKAGE_JSON ?= $(ROOT_DIR)/package.json
6-
7-
82
# DEPENDENCIES #
93

104
include $(TOOLS_MAKE_LIB_DIR)/node/addons.mk
5+
include $(TOOLS_MAKE_LIB_DIR)/node/modules.mk
116

127

138
# TARGETS #
149

15-
# Install node module dependencies.
16-
#
17-
# This target installs package dependencies by executing [`npm install`][1]. Packages will be installed in a local `node_modules` directory relative to the project's `package.json` file.
10+
# Run Node install sequence.
1811
#
19-
# [1]: https://docs.npmjs.com/cli/install
12+
# This target runs the Node install sequence, including installing node module dependencies and compiling native add-ons.
2013

21-
install-node: $(ROOT_PACKAGE_JSON)
22-
$(QUIET) $(NPM) install
14+
install-node: install-node-modules install-node-addons
2315

2416
.PHONY: install-node
2517

2618

27-
# Remove node module dependencies.
19+
# Perform Node clean-up.
2820
#
29-
# This target cleans the `node_modules` directory by removing it entirely.
21+
# This target runs cleanup tasks specific to Node.js, such as removing node module dependencies and removing native add-ons.
3022

31-
clean-node:
32-
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(NODE_MODULES)
23+
clean-node: clean-node-addons clean-node-modules
3324

3425
.PHONY: clean-node

tools/make/lib/node/addons.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif
2828
#
2929
# This target installs native add-ons. If unable to install a native add-on, the target prints an error message and proceeds to try installing the next add-on.
3030

31-
install-node-addons: clean-node-addons
31+
install-node-addons: $(NODE_MODULES) clean-node-addons
3232
$(QUIET) $(MAKE) -f $(this_file) list-pkgs-addons | while read -r pkg; do \
3333
if echo "$$pkg" | grep -v '^\/.*\|^[a-zA-Z]:.*' >/dev/null; then \
3434
continue; \

tools/make/lib/node/modules.mk

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
# VARIABLES #
3+
4+
# Define the path to the root `package.json`:
5+
ROOT_PACKAGE_JSON ?= $(ROOT_DIR)/package.json
6+
7+
8+
# TARGETS #
9+
10+
# Install node module dependencies.
11+
#
12+
# This target installs package dependencies by executing [`npm install`][1]. Packages will be installed in a local `node_modules` directory relative to the project's `package.json` file.
13+
#
14+
# [1]: https://docs.npmjs.com/cli/install
15+
16+
install-node-modules: $(ROOT_PACKAGE_JSON)
17+
$(QUIET) $(NPM) install
18+
19+
.PHONY: install-node-modules
20+
21+
22+
# Remove node module dependencies.
23+
#
24+
# This target cleans the `node_modules` directory by removing it entirely.
25+
26+
clean-node-modules:
27+
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(NODE_MODULES)
28+
29+
.PHONY: clean-node-modules

tools/make/usage.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ Usage: make <cmd>
4848
make check-licenses Check package dependency licenses.
4949
make install Run install sequence.
5050
make install-node Run Node install sequence.
51+
make install-node-modules Install Node dependencies.
5152
make install-node-addons Install Node add-ons.
5253
make install-deps Install vendor dependencies.
5354
make clean Run all cleanup tasks.
54-
make clean-node Remove Node dependencies.
55+
make clean-node Run Node cleanup tasks.
56+
make clean-node-modules Remove Node dependencies.
5557
make clean-node-addons Remove Node add-ons.
5658
make clean-deps Remove vendor dependencies.
5759
make inspect.VARIABLE Print the runtime value of a VARIABLE.

0 commit comments

Comments
 (0)