From 242d7acaa4a84081541ae83cec29213118239da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Fri, 7 Jul 2023 20:54:46 +0200 Subject: [PATCH] Merge pull request #91 from melange-re/playground/deploy playground: deploy --- .github/workflows/deploy.yml | 6 ++++++ .github/workflows/publish-version.yml | 6 ++++++ .gitignore | 2 ++ Makefile | 5 +++++ mkdocs.yml | 4 ++-- playground/README.md | 6 ------ playground/index.html | 2 +- playground/package.json | 2 +- playground/vite.config.ts | 6 +++++- 9 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 186e694aa..c655c1ecb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,6 +16,12 @@ jobs: with: python-version: 3.x - run: python3 -m pip install -r ./pip-requirements.txt + - uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: 4.14.x + dune-cache: true + - name: Build playground + run: make build-playground - name: Configure Git user run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" diff --git a/.github/workflows/publish-version.yml b/.github/workflows/publish-version.yml index c1c4e0c15..28655a44d 100644 --- a/.github/workflows/publish-version.yml +++ b/.github/workflows/publish-version.yml @@ -14,6 +14,12 @@ jobs: with: python-version: 3.x - run: python3 -m pip install -r ./pip-requirements.txt + - uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: 4.14.x + dune-cache: true + - name: Build playground + run: make build-playground - name: Configure Git user run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" diff --git a/.gitignore b/.gitignore index 90e47500d..992f3e0fc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ _build _opam .vscode .DS_Store + +docs/playground diff --git a/Makefile b/Makefile index 69d1cd696..361626591 100644 --- a/Makefile +++ b/Makefile @@ -39,3 +39,8 @@ format: ## Format the codebase with ocamlformat .PHONY: format-check format-check: ## Checks if format is correct $(DUNE) build @fmt + +.PHONY: build-playground +build-playground: install ## Builds the playground + $(DUNE) build @playground-assets + cd playground && yarn && yarn build diff --git a/mkdocs.yml b/mkdocs.yml index 6fa1ee861..c0b04fc56 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -30,8 +30,8 @@ nav: - Reference: - API: api.md - Try: - - Playground: try.md - - Talk: + - Playground: playground + - About: - Community: community.md extra_css: diff --git a/playground/README.md b/playground/README.md index 9240d78c5..b79d1311c 100644 --- a/playground/README.md +++ b/playground/README.md @@ -18,9 +18,3 @@ cd playground && yarn dev ``` To build, `yarn build`. - -## TODO - -* Documentation -* Tests -* Themeability diff --git a/playground/index.html b/playground/index.html index cf86f5c58..db0fa7e6e 100644 --- a/playground/index.html +++ b/playground/index.html @@ -5,7 +5,7 @@ - Vite + React + Melange Playground
diff --git a/playground/package.json b/playground/package.json index 088c7c4f9..61c4a3bcc 100644 --- a/playground/package.json +++ b/playground/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "vite build --emptyOutDir", "preview": "vite preview" }, "dependencies": { diff --git a/playground/vite.config.ts b/playground/vite.config.ts index 0a265f450..fff1a4e19 100644 --- a/playground/vite.config.ts +++ b/playground/vite.config.ts @@ -3,5 +3,9 @@ import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react()] + plugins: [react()], + build: { + outDir: "../docs/playground", + }, + base: "./", });