From ec7c7b14d51c229b799eb99fa78dbcf56e013c85 Mon Sep 17 00:00:00 2001 From: Sergio Alejandro Vargas Date: Sat, 18 Jan 2025 21:50:58 -0500 Subject: [PATCH] Update Makefile Add a variable to choose package manager. --- Makefile | 19 +++++++++++++------ README.md | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 22262e6..817519d 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,31 @@ +# NPM ?= npm +# NPM ?= pnpm +NPM ?= yarn + # Written by humans -SRC = src/julia.grammar src/tokens.js +SRC = src/* # Bundled by rollup INDEX = dist/index.js dist/index.cjs $(INDEX): $(SRC) # Generate parser and bundle into usable JS files - npm run prepare + $(NPM) run prepare + +.PHONY: install test check clean -.PHONY: test check clean +install: + $(NPM) install test: $(INDEX) test/* - npm run test + $(NPM) run test check: # Ensure tooling is installed node --version - npm --version + $(NPM) --version clean: # Remove generated files rm -f $(INDEX) release: - npm publish + $(NPM) publish git tag v$(cat package.json | jq -r .version) diff --git a/README.md b/README.md index c3283a9..94e3894 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ To rebuild the parser after changing the grammar or the tokenizer: ``` yarn run prepare ``` -If the build crashes with a GC related error, run `export NODE_OPTIONS="--max-old-space-size=8192"` and try again. +If the build crashes with a GC related error, run `export NODE_OPTIONS='--max-old-space-size=8192'` and try again. To test the parser: