diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ac6f0ad --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +project_name = astexplorer-refmt + +DUNE = opam exec -- dune +opam_file = $(project_name).opam + +.PHONY: help +help: + @echo ""; + @echo "List of available make commands"; + @echo ""; + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'; + @echo ""; + +.PHONY: build-dev +dev: + $(DUNE) build -w @all + +.PHONY: clean +clean: ## Clean artifacts + $(DUNE) clean + +.PHONY: exec +exec: ## Run the project + $(DUNE) exec $(demo) + +.PHONY: format +format: + DUNE_CONFIG__GLOBAL_LOCK=disabled $(DUNE) build @fmt --auto-promote + +.PHONY: format-check +format-check: + $(DUNE) build @fmt + +.PHONY: create-switch +create-switch: ## Create opam switch + opam switch create . 5.1.1 --deps-only --with-dev-setup -y + +.PHONY: install +install: + $(DUNE) build @install + opam install . --deps-only --with-test + +.PHONY: init +init: create-switch install \ No newline at end of file diff --git a/src/example/example.js b/src/example/example.js new file mode 100644 index 0000000..cd26ffa --- /dev/null +++ b/src/example/example.js @@ -0,0 +1,4 @@ +let code = "let x = 1"; + +let ast = window.parseReason(code); +window.document.querySelector("#app").innerHTML = ast; diff --git a/src/index.html b/src/example/index.html similarity index 69% rename from src/index.html rename to src/example/index.html index eb214fb..d0da71f 100644 --- a/src/index.html +++ b/src/example/index.html @@ -7,10 +7,14 @@
- + +