From 1205411f2228d3cdc3760319644183702f73b405 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 20 Sep 2023 17:59:51 +0200 Subject: [PATCH] Added version info to entrypoint --- material/__init__.py | 2 ++ src/__init__.py | 2 ++ tools/build/index.ts | 12 ++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/material/__init__.py b/material/__init__.py index d18993785..d89d649d0 100644 --- a/material/__init__.py +++ b/material/__init__.py @@ -17,3 +17,5 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. + +__version__ = "9.3.2" diff --git a/src/__init__.py b/src/__init__.py index d18993785..f875ee630 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -17,3 +17,5 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. + +__version__ = "$md-version$" diff --git a/tools/build/index.ts b/tools/build/index.ts index a8c3d2366..db744096c 100644 --- a/tools/build/index.ts +++ b/tools/build/index.ts @@ -149,7 +149,7 @@ const assets$ = concat( })), /* Copy images and configurations */ - ...["**/*.{png,svg,yml}"] + ...["**/*.{jpg,png,svg,yml}"] .map(pattern => copyAll(pattern, { from: "src", to: base @@ -160,7 +160,15 @@ const assets$ = concat( const sources$ = copyAll("**/*.py", { from: "src", to: base, - watch: process.argv.includes("--watch") + watch: process.argv.includes("--watch"), + transform: async (data, name) => { + if (path.basename(name) === "__init__.py") { + const metadata = require("../../package.json") + return data.replace("$md-version$", metadata.version) + } else { + return data + } + } }) /* ------------------------------------------------------------------------- */