diff --git a/.gitignore b/.gitignore index 3b2eadffe..50485c009 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,9 @@ result-* /dist/esbuild/* !/dist/esbuild/index.html !/dist/esbuild/wrapper.js +!/dist/webpack/ +/dist/webpack/* +!/dist/webpack/.gitkeep output.js .DS_Store .idea/ diff --git a/Makefile b/Makefile index 765c30131..e7c7db1d6 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,35 @@ SHELL := bash .ONESHELL: -.PHONY: run-dev run-build check-format format query-testnet-tip clean check-explicit-exports +.PHONY: esbuild-bundle esbuild-serve webpack-bundle webpack-serve check-format format query-testnet-tip clean check-explicit-exports .SHELLFLAGS := -eu -o pipefail -c ps-sources := $(shell fd --no-ignore-parent -epurs) nix-sources := $(shell fd --no-ignore-parent -enix --exclude='spago*') js-sources := $(shell fd --no-ignore-parent -ejs) ps-entrypoint := Ctl.Examples.ByUrl # points to one of the example PureScript modules in examples/ -ps-bundle = spago bundle-module -m ${ps-entrypoint} --to output.js preview-node-ipc = $(shell docker volume inspect store_node-preview-ipc | jq -r '.[0].Mountpoint') preprod-node-ipc = $(shell docker volume inspect store_node-preprod-ipc | jq -r '.[0].Mountpoint') -run-dev: - @${ps-bundle} --minify && BROWSER_RUNTIME=1 webpack-dev-server --progress - -run-build: - @${ps-bundle} && BROWSER_RUNTIME=1 webpack --mode=production - esbuild-bundle: - @spago build && BROWSER_RUNTIME=1 node esbuild/bundle.js ${ps-entrypoint} + @spago build \ + && cp -rf fixtures dist/esbuild \ + && BROWSER_RUNTIME=1 node esbuild/bundle.js ${ps-entrypoint} esbuild-serve: @spago build \ - && cd dist/esbuild \ - && ln -sfn ../../fixtures fixtures \ - && cd ../.. \ + && cp -rf fixtures dist/esbuild \ && BROWSER_RUNTIME=1 node esbuild/serve.js ${ps-entrypoint} +webpack-bundle: + @spago build \ + && rm -rf dist/webpack/* \ + && cp -rf fixtures/* dist/webpack \ + && BROWSER_RUNTIME=1 webpack --mode=production --env entry=./output/${ps-entrypoint}/index.js + +webpack-serve: + @spago build \ + && BROWSER_RUNTIME=1 webpack-dev-server --progress --env entry=./output/${ps-entrypoint}/index.js + .ONESHELL: check-explicit-exports: @if grep -rn '(\.\.)' ${ps-sources}; then diff --git a/dist/esbuild/index.html b/dist/esbuild/index.html index 7c9b27620..e3c16ed39 100644 --- a/dist/esbuild/index.html +++ b/dist/esbuild/index.html @@ -5,7 +5,9 @@
- + Examples source code is located in examples/ directory.