Skip to content

Commit 73de421

Browse files
committed
📝 Improve README on npm
1 parent 81e450d commit 73de421

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,24 +136,6 @@ const a: unknown = "Hello";
136136
const _: string = maybe(a, is.String) ?? "default value";
137137
```
138138

139-
## Node.js (npm)
140-
141-
To use `unknownutil` in [Node.js][nodejs], install `unknownutil` like
142-
143-
```console
144-
npm i unknownutil
145-
```
146-
147-
Then import `is`, `assert`, `ensure`, and `maybe` like:
148-
149-
```typescript, ignore
150-
import { assert, ensure, is, maybe } from "unknownutil";
151-
152-
// ...
153-
```
154-
155-
[nodejs]: https://nodejs.org/
156-
157139
## Migration
158140

159141
See [GitHub Wiki](https://github.com/lambdalisue/deno-unknownutil/wiki) for

scripts/build_npm.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,15 @@ await build({
3535

3636
// post build steps
3737
Deno.copyFileSync("LICENSE", "npm/LICENSE");
38-
Deno.copyFileSync("README.md", "npm/README.md");
38+
39+
// build README for npm
40+
let readme = Deno.readTextFileSync("README.md");
41+
readme = readme.replaceAll(
42+
"https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts",
43+
name,
44+
);
45+
readme = readme.replaceAll(
46+
"## Usage",
47+
`## Install\n\nInstall via npm:\n\n\`\`\`sh\nnpm install --save ${name}\n\`\`\`\n\n## Usage`,
48+
);
49+
Deno.writeTextFileSync("npm/README.md", readme);

0 commit comments

Comments
 (0)