From 815080f61161fc16ea924ac2ca16f3beed19c4c0 Mon Sep 17 00:00:00 2001 From: DJO <790521+Alenar@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:10:58 +0100 Subject: [PATCH 1/5] feat(explorer): add a unstable `feature flag` That can be toogled on by setting a `UNSTABLE` environment variable to `1` when building developer or production builds. --- mithril-explorer/README.md | 14 ++++++++++++++ mithril-explorer/next.config.js | 9 ++++++++- mithril-explorer/src/app/layout.js | 9 +++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mithril-explorer/README.md b/mithril-explorer/README.md index b7c4a0f6150..eff2a697abd 100644 --- a/mithril-explorer/README.md +++ b/mithril-explorer/README.md @@ -26,6 +26,20 @@ make dev Open [http://localhost:3000](http://localhost:3000/explorer) with your browser to see the result. +### Enabling unstable features + +Some features are still in development and are not enabled by default. To enable them, set the `UNSTABLE` environment variable to `1` when running the development server: + +```bash +UNSTABLE=1 make dev +``` + +Or when building the production version: + +```bash +UNSTABLE=1 make build +``` + ## Adding or updating an icon of the 'Mithril' font In the `./icons` folder add or modify a svg. diff --git a/mithril-explorer/next.config.js b/mithril-explorer/next.config.js index 64c55e20f6c..d7dc306862b 100644 --- a/mithril-explorer/next.config.js +++ b/mithril-explorer/next.config.js @@ -1,4 +1,6 @@ -/** @type {import('next').NextConfig} */ +const webpack = require("webpack"); + +/** @type {import("next").NextConfig} */ const nextConfig = { output: "export", basePath: "/explorer", @@ -8,6 +10,11 @@ const nextConfig = { }, webpack: (config) => { config.experiments = { layers: true, asyncWebAssembly: true }; + config.plugins.push( + new webpack.DefinePlugin({ + "process.env.UNSTABLE": process.env.UNSTABLE === "1", + }), + ); return config; }, }; diff --git a/mithril-explorer/src/app/layout.js b/mithril-explorer/src/app/layout.js index 0060d4c43fe..4cc52380694 100644 --- a/mithril-explorer/src/app/layout.js +++ b/mithril-explorer/src/app/layout.js @@ -1,6 +1,7 @@ import Image from "next/image"; import Link from "next/link"; import React, { Suspense } from "react"; +import { Badge } from "react-bootstrap"; import { Providers } from "@/store/provider"; // These styles apply to every route in the application @@ -31,6 +32,14 @@ export default function RootLayout({ children }) { Mithril Logo{" "} Mithril Explorer + {process.env.UNSTABLE && ( + <> + {" "} + + Unstable + + + )} {children} From 288bf298fe92d2fe96cecbecb838275d5586e11e Mon Sep 17 00:00:00 2001 From: DJO <790521+Alenar@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:37:22 +0100 Subject: [PATCH 2/5] feat(explorer): allow to change the explorer base path Using a `BASE_PATH` env var. Reminder: the base path is notably added to all intra-links generated by the router. --- mithril-explorer/next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril-explorer/next.config.js b/mithril-explorer/next.config.js index d7dc306862b..81a0a1980df 100644 --- a/mithril-explorer/next.config.js +++ b/mithril-explorer/next.config.js @@ -3,7 +3,7 @@ const webpack = require("webpack"); /** @type {import("next").NextConfig} */ const nextConfig = { output: "export", - basePath: "/explorer", + basePath: process.env.BASE_PATH ?? "/explorer", reactStrictMode: true, images: { unoptimized: true, From 1b031da10c58310e145e394c8289321ce60e8688 Mon Sep 17 00:00:00 2001 From: DJO <790521+Alenar@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:49:06 +0100 Subject: [PATCH 3/5] ci: build and publish unstable explorer on github pages In `/explorer/unstable` --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5be8cfb7df4..ff41e1a22fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -867,11 +867,11 @@ jobs: working-directory: mithril-explorer run: make test - - name: Build Explorer + - name: Build Explorer (stable) working-directory: mithril-explorer run: make build - - name: Publish Explorer build + - name: Publish Explorer build (stable) uses: actions/upload-artifact@v4 with: name: explorer-build @@ -879,6 +879,21 @@ jobs: path: | mithril-explorer/out/* + - name: Build Explorer (unstable) + working-directory: mithril-explorer + env: + BASE_PATH: "/explorer/unstable" + UNSTABLE: "1" + run: make build + + - name: Publish Explorer build (unstable) + uses: actions/upload-artifact@v4 + with: + name: explorer-build-unstable + if-no-files-found: error + path: | + mithril-explorer/out/* + build-open-api-ui: runs-on: ubuntu-22.04 steps: @@ -923,12 +938,18 @@ jobs: name: docusaurus-build path: ./github-pages/doc - - name: Download Explorer build + - name: Download Explorer build (stable) uses: actions/download-artifact@v4 with: name: explorer-build path: ./github-pages/explorer + - name: Download Explorer build (unstable) + uses: actions/download-artifact@v4 + with: + name: explorer-build-unstable + path: ./github-pages/explorer/unstable + - name: Download OpenAPI UI build uses: actions/download-artifact@v4 with: From 04e2e41ed8bae456c20e1b7a36be42c6ef48bca4 Mon Sep 17 00:00:00 2001 From: DJO <790521+Alenar@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:07:10 +0100 Subject: [PATCH 4/5] chore: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8671a353b0..5d1bbcee5d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ As a minor extension, we have adopted a slightly different versioning convention ## Mithril Distribution [XXXX] - UNRELEASED +- Build and publish both a `stable` version (for release networks) and an `unstable` version (for testing networks) of the explorer. + - Crates versions: | Crate | Version | From 52b71072ba4769f36dd4e39e94d36e88443a4c93 Mon Sep 17 00:00:00 2001 From: DJO <790521+Alenar@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:50:32 +0100 Subject: [PATCH 5/5] chore: upgrade explorer version from `0.7.22` to `0.7.23` --- mithril-explorer/package-lock.json | 4 ++-- mithril-explorer/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mithril-explorer/package-lock.json b/mithril-explorer/package-lock.json index fd22c1242ea..96036bbefdc 100644 --- a/mithril-explorer/package-lock.json +++ b/mithril-explorer/package-lock.json @@ -1,12 +1,12 @@ { "name": "mithril-explorer", - "version": "0.7.22", + "version": "0.7.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mithril-explorer", - "version": "0.7.22", + "version": "0.7.23", "dependencies": { "@mithril-dev/mithril-client-wasm": "file:../mithril-client-wasm/dist/web", "@popperjs/core": "^2.11.8", diff --git a/mithril-explorer/package.json b/mithril-explorer/package.json index 99b7cbb99dc..b82cfd213db 100644 --- a/mithril-explorer/package.json +++ b/mithril-explorer/package.json @@ -1,6 +1,6 @@ { "name": "mithril-explorer", - "version": "0.7.22", + "version": "0.7.23", "private": true, "scripts": { "dev": "next dev",