Skip to content

Commit 2a6b4de

Browse files
committed
docs: use shorthands in examples
1 parent 0d0dfa1 commit 2a6b4de

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

docs/.config/automd.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ export default <Config>{
88
const { generator, ...generatorArgs } = args;
99

1010
const argsString = Object.entries(generatorArgs)
11-
.map(([k, v]) => `${k}=${v}`)
11+
.map(([k, v]) => {
12+
if (v === true) {
13+
return k;
14+
}
15+
if (v === false) {
16+
k.startsWith("no-") ? k.slice(3) : `no-${k}`;
17+
}
18+
return `${k}=${v}`;
19+
})
1220
.join(" ");
1321

1422
const input = `<!-- automd:${generator} ${argsString} -->\n<!-- /automd -->`;

docs/2.generators/badges.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ The `badges` generator generates badges for the latest npm version, npm download
88

99
### Input
1010

11-
<!-- automd:badges color=yellow license=true name=defu codecov=true bundlephobia=true packagephobia=true -->
11+
<!-- automd:badges color=yellow license name=defu codecov bundlephobia packagephobia -->
1212
<!-- /automd -->
1313

1414
### Output
1515

16-
<!-- automd:badges color=yellow license=true name=defu codecov=true bundlephobia=true packagephobia=true -->
16+
<!-- automd:badges color=yellow license name=defu codecov bundlephobia packagephobia -->
1717

1818
[![npm version](https://flat.badgen.net/npm/v/defu?color=yellow)](https://npmjs.com/package/defu)
1919
[![npm downloads](https://flat.badgen.net/npm/dm/defu?color=yellow)](https://npmjs.com/package/defu)

docs/2.generators/fetch.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ The `fetch` generator fetches a URL (using [unjs/ofetch](https://ofetch.unjs.io)
3535

3636
Why waste time solving problems when someone else has already done it for you? Stack Overflow is your best friend, your mentor, and your savior. Just make sure to upvote the answers that save your bacon.
3737

38-
3938
<!-- /automd -->
4039

4140
<!-- /automd -->

docs/2.generators/jsimport.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ The `jsimport` generator generates JavaScript usage example to be imported.
88

99
### Input
1010

11-
<!-- automd:jsimport cjs=true cdn=true name=pkg imports=foo,bar -->
11+
<!-- automd:jsimport cjs cdn name=pkg imports=foo,bar -->
1212
<!-- /automd -->
1313

1414
### Output
1515

16-
<!-- automd:jsimport cjs=true cdn=true name=pkg imports=foo,bar -->
16+
<!-- automd:jsimport cjs cdn name=pkg imports=foo,bar -->
1717

1818
**ESM** (Node.js, Bun)
1919

docs/2.generators/pm-install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ The `pm-install` or `pm-i` generator generates installation commands for several
88

99
### Input
1010

11-
<!-- automd:pm-install version=false name=package-name dev=true -->
11+
<!-- automd:pm-install version=false name=package-name dev -->
1212
<!-- /automd -->
1313

1414
### Output
1515

16-
<!-- automd:pm-install version=false name=package-name dev=true -->
16+
<!-- automd:pm-install version=false name=package-name dev -->
1717

1818
```sh
1919
# ✨ Auto-detect

docs/2.generators/pm-x.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ The `pm-x` generator generates commands for running/executing a package through
88

99
### Input
1010

11-
<!-- automd:pm-x version=latest name=package-name args="[files] <flags>"=true -->
11+
<!-- automd:pm-x version=latest name=package-name args="[files] <flags>" -->
1212
<!-- /automd -->
1313

1414
### Output
1515

16-
<!-- automd:pm-x version=latest name=package-name args="[files] <flags>"=true -->
16+
<!-- automd:pm-x version=latest name=package-name args="[files] <flags>" -->
1717

1818
```sh
1919
# npm

0 commit comments

Comments
 (0)