Skip to content

Commit 96e2ade

Browse files
committed
fix(with-automd): hide last update by default
1 parent 4017016 commit 96e2ade

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

docs/2.generators/with-automd.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@
22

33
The `with-automd` generator generates a benner that notifies docs are updated with automd + the last update time.
44

5-
<!-- automd:example generator=with-automd lastUpdate="now" -->
5+
<!-- automd:example generator=with-automd -->
66

77
## Example
88

99
### Input
1010

11-
<!-- automd:with-automd lastUpdate="now" -->
11+
<!-- automd:with-automd -->
1212
<!-- /automd -->
1313

1414
### Output
1515

16-
<!-- automd:with-automd lastUpdate="now" -->
16+
<!-- automd:with-automd -->
1717

1818
---
19-
_🤖 auto updated with [automd](https://automd.unjs.io) (last updated: now)_
19+
20+
_🤖 auto updated with [automd](https://automd.unjs.io)_
2021

2122
<!-- /automd -->
2223

2324
<!-- /automd -->
2425

2526
## Arguments
2627

27-
- `lastUpdate`: Can override last updated time. Use `no-lastUpdate` to disable.
28+
- `lastUpdate`: Show last updated date. (use string for static value)
2829
- `no-separator`: Disable addition of separator `---`

src/generators/with-automd.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import { defineGenerator } from "../generator";
33
export const withAutomd = defineGenerator({
44
name: "with-automd",
55
generate({ args }) {
6-
const lastUpdate =
7-
args.lastUpdate === false
8-
? ""
9-
: ` (last updated: ${args.lastUpdate || new Date().toDateString()})`;
6+
const lastUpdate = args.lastUpdate
7+
? ` (last updated: ${typeof args.lastUpdate === "string" ? args.lastUpdate : new Date().toDateString()})`
8+
: "";
109

1110
const emoji = args.emoji === false ? "" : "🤖 ";
1211

test/fixture/OUTPUT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ import { foo, bar } from "https://esm.sh/pkg";
105105

106106
---
107107

108-
_🤖 auto updated with [automd](https://automd.unjs.io) (last updated: Tue Feb 20 2024)_
108+
_🤖 auto updated with [automd](https://automd.unjs.io)_
109109

110110
<!-- /automd -->
111111

0 commit comments

Comments
 (0)