From 96e2adeddc40ce1529fc7435179c74adef47dc62 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 21 Feb 2024 21:46:27 +0100 Subject: [PATCH] fix(with-automd): hide last update by default --- docs/2.generators/with-automd.md | 11 ++++++----- src/generators/with-automd.ts | 7 +++---- test/fixture/OUTPUT.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/2.generators/with-automd.md b/docs/2.generators/with-automd.md index 050db20..ab78a11 100644 --- a/docs/2.generators/with-automd.md +++ b/docs/2.generators/with-automd.md @@ -2,21 +2,22 @@ The `with-automd` generator generates a benner that notifies docs are updated with automd + the last update time. - + ## Example ### Input - + ### Output - + --- - _🤖 auto updated with [automd](https://automd.unjs.io) (last updated: now)_ + + _🤖 auto updated with [automd](https://automd.unjs.io)_ @@ -24,5 +25,5 @@ The `with-automd` generator generates a benner that notifies docs are updated wi ## Arguments -- `lastUpdate`: Can override last updated time. Use `no-lastUpdate` to disable. +- `lastUpdate`: Show last updated date. (use string for static value) - `no-separator`: Disable addition of separator `---` diff --git a/src/generators/with-automd.ts b/src/generators/with-automd.ts index e65f719..c2ef794 100644 --- a/src/generators/with-automd.ts +++ b/src/generators/with-automd.ts @@ -3,10 +3,9 @@ import { defineGenerator } from "../generator"; export const withAutomd = defineGenerator({ name: "with-automd", generate({ args }) { - const lastUpdate = - args.lastUpdate === false - ? "" - : ` (last updated: ${args.lastUpdate || new Date().toDateString()})`; + const lastUpdate = args.lastUpdate + ? ` (last updated: ${typeof args.lastUpdate === "string" ? args.lastUpdate : new Date().toDateString()})` + : ""; const emoji = args.emoji === false ? "" : "🤖 "; diff --git a/test/fixture/OUTPUT.md b/test/fixture/OUTPUT.md index d6420a1..d9c458a 100644 --- a/test/fixture/OUTPUT.md +++ b/test/fixture/OUTPUT.md @@ -105,7 +105,7 @@ import { foo, bar } from "https://esm.sh/pkg"; --- -_🤖 auto updated with [automd](https://automd.unjs.io) (last updated: Tue Feb 20 2024)_ +_🤖 auto updated with [automd](https://automd.unjs.io)_