Created
June 6, 2025 20:56
-
-
Save dotysan/209ae1c683399049a2394bff439658bc to your computer and use it in GitHub Desktop.
Bootstraps Node.js inside a local Python virtual environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL:= /usr/bin/env bash | |
PYVER:= 3.13 | |
venv:= .venv | |
vb:= $(venv)/bin | |
nm:= $(venv)/lib/node_modules | |
HERE:=$(notdir $(CURDIR)) | |
# Bootstraps Node.js inside a local Python virtual environment. | |
$(vb)/npm: $(vb)/nodeenv | |
@uv run nodeenv --python-virtualenv --node=lts && \ | |
uv run npm install --global npm && \ | |
touch -r $(vb)/activate.csh $(vb)/activate | |
$(vb)/nodeenv: $(vb)/python | |
@uv pip install nodeenv | |
$(vb)/python: | |
@uv venv --managed-python --python=$(PYVER) | |
.PHONY: clean | |
clean: | |
@if [[ -z "$(venv)" || ! -d "$(venv)" || $(venv) =~ / ]]; then \ | |
echo "ERROR: venv $(venv) is not a valid directory or contains slashes. Aborting."; \ | |
exit 1; \ | |
fi >&2 | |
rm --force --recursive $(venv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment