Skip to content

Instantly share code, notes, and snippets.

@dotysan
Created June 6, 2025 20:56
Show Gist options
  • Save dotysan/209ae1c683399049a2394bff439658bc to your computer and use it in GitHub Desktop.
Save dotysan/209ae1c683399049a2394bff439658bc to your computer and use it in GitHub Desktop.
Bootstraps Node.js inside a local Python virtual environment.
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