diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b4ad4181..743bc678 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: Deploy VitePress site to Pages on: # Runs on pushes targeting the `main` branch. push: - branches: [main] + branches: [demo] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -29,14 +29,21 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 # Not needed if lastUpdated is not enabled + - name: Setup Pages + uses: actions/configure-pages@v3 - name: Setup Node uses: actions/setup-node@v3 with: node-version: 18 cache: npm - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Install dependencies + - uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: 5.1.1 + - name: Install all deps + run: make install + - name: Bundle the app + run: make bundle + - name: Install dependencies for VitePress run: | cd docs npm ci @@ -44,6 +51,8 @@ jobs: run: | cd docs npm run docs:build + - name: Move demo site into docs dir + run: mv dist docs/.vitepress/dist/demo - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: diff --git a/Makefile b/Makefile index eb547e16..03d867ae 100644 --- a/Makefile +++ b/Makefile @@ -38,12 +38,13 @@ serve: ## Serve an application using a local HTTP server npx vite serve --open .PHONY: bundle -bundle: ## Bundle the JavaScript application +bundle: build ## Bundle the JavaScript application npx vite build .PHONY: clean clean: ## Clean build artifacts and other generated files $(DUNE) clean + rm -rf dist .PHONY: format format: ## Format the codebase with ocamlformat diff --git a/index.html b/index.html index b6a28b7e..b788ec21 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,8 @@ - + + Melange for React Developers diff --git a/src/better-sandwiches/index.html b/src/better-sandwiches/index.html index 42cb8131..760bb0ef 100644 --- a/src/better-sandwiches/index.html +++ b/src/better-sandwiches/index.html @@ -1,7 +1,8 @@ - + + Melange for React Devs diff --git a/src/celsius-converter-exception/index.html b/src/celsius-converter-exception/index.html index fb529ce8..476278f9 100644 --- a/src/celsius-converter-exception/index.html +++ b/src/celsius-converter-exception/index.html @@ -1,7 +1,8 @@ - + + Melange for React Devs diff --git a/src/celsius-converter-option/index.html b/src/celsius-converter-option/index.html index 2a1efc74..0b13b356 100644 --- a/src/celsius-converter-option/index.html +++ b/src/celsius-converter-option/index.html @@ -1,7 +1,8 @@ - + + Melange for React Devs diff --git a/src/counter/index.html b/src/counter/index.html index f2aa2ad2..aaee7b70 100644 --- a/src/counter/index.html +++ b/src/counter/index.html @@ -1,7 +1,8 @@ - + + Melange for React Devs diff --git a/src/numeric-types/index.html b/src/numeric-types/index.html index 3c0a0e2f..da606e31 100644 --- a/src/numeric-types/index.html +++ b/src/numeric-types/index.html @@ -1,7 +1,8 @@ - + + Melange for React Devs diff --git a/src/order-confirmation/index.html b/src/order-confirmation/index.html index 1acaea7e..3256a0b7 100644 --- a/src/order-confirmation/index.html +++ b/src/order-confirmation/index.html @@ -1,7 +1,8 @@ - + + Melange for React Devs diff --git a/src/styling-with-css/index.html b/src/styling-with-css/index.html index d6156b52..4d1cc37f 100644 --- a/src/styling-with-css/index.html +++ b/src/styling-with-css/index.html @@ -1,7 +1,8 @@ - + + Melange for React Devs diff --git a/vite.config.js b/vite.config.js index d1857b21..f2a84bfb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,6 +3,7 @@ import { defineConfig } from 'vite' import { nodeResolve } from '@rollup/plugin-node-resolve' export default defineConfig({ + base: '/demo/', // nodeResolve is needed to import melange runtime libraries in output // directory's `node_modules` directory. See // https://github.com/melange-re/melange-for-react-devs/pull/16#discussion_r1455989106 @@ -12,4 +13,18 @@ export default defineConfig({ ignored: ['**/_opam'] } }, + build: { + rollupOptions: { + input: { + main: resolve(__dirname, 'index.html'), + counter: resolve(__dirname, 'src/counter/index.html'), + 'numeric-types': resolve(__dirname, 'src/numeric-types/index.html'), + 'celsius-converter-exception': resolve(__dirname, 'src/celsius-converter-exception/index.html'), + 'celsius-converter-option': resolve(__dirname, 'src/celsius-converter-option/index.html'), + 'order-confirmation': resolve(__dirname, 'src/order-confirmation/index.html'), + 'styling-with-css': resolve(__dirname, 'src/styling-with-css/index.html'), + 'better-sandwiches': resolve(__dirname, 'src/better-sandwiches/index.html'), + }, + }, + }, });