Skip to content

Commit 0fc04bd

Browse files
committed
Add recipes to generate a browser REPL
1 parent 5f1e8fe commit 0fc04bd

File tree

3 files changed

+50
-17
lines changed

3 files changed

+50
-17
lines changed

tools/make/lib/repl/Makefile

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11

2-
# VARIABLES #
2+
# DEPENDENCIES #
33

4-
# Define the path of the executable:
5-
STDLIB ?= $(LOCAL_BIN_DIR)/cli
6-
7-
# Define the command to launch the REPL:
8-
REPL ?= repl
9-
10-
# Define any command-line options to use when invoking the executable:
11-
REPL_FLAGS ?=
12-
13-
# Define the path of the directory in which to run the REPL:
14-
REPL_DIR ?= $(ROOT_DIR)
4+
include $(TOOLS_MAKE_LIB_DIR)/repl/browser.mk
5+
include $(TOOLS_MAKE_LIB_DIR)/repl/node.mk
156

167

178
# TARGETS #
@@ -20,10 +11,6 @@ REPL_DIR ?= $(ROOT_DIR)
2011
#
2112
# This target starts a REPL environment.
2213

23-
repl: $(NODE_MODULES) $(STDLIB)
24-
$(QUIET) cd $(REPL_DIR); \
25-
NODE_ENV=$(NODE_ENV_REPL) \
26-
NODE_PATH=$(NODE_PATH_REPL) \
27-
$(NODE) $(STDLIB) $(REPL) -- $(REPL_FLAGS)
14+
repl: repl-node
2815

2916
.PHONY: repl

tools/make/lib/repl/browser.mk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# VARIABLES #
3+
4+
# Define the executable to start a browser REPL environment:
5+
REPL_BROWSER ?= $(SRC_DIR)/@stdlib/repl/scripts/browser_run
6+
7+
8+
# TARGETS #
9+
10+
# Start a browser REPL environment.
11+
#
12+
# This target starts a browser REPL environment.
13+
14+
repl-browser: $(NODE_MODULES) $(REPL_BROWSER)
15+
$(QUIET) NODE_ENV=$(NODE_ENV_REPL) $(NODE) $(REPL_BROWSER)
16+
17+
.PHONY: repl-browser

tools/make/lib/repl/node.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 of the executable:
5+
STDLIB ?= $(LOCAL_BIN_DIR)/cli
6+
7+
# Define the command to launch the REPL:
8+
REPL ?= repl
9+
10+
# Define any command-line options to use when invoking the executable:
11+
REPL_FLAGS ?=
12+
13+
# Define the path of the directory in which to run the REPL:
14+
REPL_DIR ?= $(ROOT_DIR)
15+
16+
17+
# TARGETS #
18+
19+
# Start a Node.js REPL environment.
20+
#
21+
# This target starts a Node.js REPL environment.
22+
23+
repl-node: $(NODE_MODULES) $(STDLIB)
24+
$(QUIET) cd $(REPL_DIR); \
25+
NODE_ENV=$(NODE_ENV_REPL) \
26+
NODE_PATH=$(NODE_PATH_REPL) \
27+
$(NODE) $(STDLIB) $(REPL) -- $(REPL_FLAGS)
28+
29+
.PHONY: repl-node

0 commit comments

Comments
 (0)