Skip to content

Commit 9ac5a03

Browse files
committed
feat: only auto install caddy when UHRP_AUTO_INSTALL_CADDY is truely
1 parent 64d302d commit 9ac5a03

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ A plugin for https reverse proxy, support `vite` and `webpack`.
77
## Install
88

99
```bash
10-
npm i unplugin-https-reverse-proxy
10+
# not auto install caddy when postinstall
11+
npm i unplugin-https-reverse-proxy --save-dev
12+
13+
# auto install
14+
UHRP_AUTO_INSTALL_CADDY=true npm i unplugin-https-reverse-proxy --save-dev
1115
```
1216

1317
```ts

scripts/postinstall.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import { existsSync, unlinkSync } from 'node:fs'
2+
import process from 'node:process'
23
import { consola } from '../src/utils'
34
import { download } from '../src/caddy'
45
import { caddyPath } from '../src/caddy/constants'
56

67
async function run() {
78
try {
8-
existsSync(caddyPath) && unlinkSync(caddyPath)
9-
await download()
9+
if (process.env.UHRP_AUTO_INSTALL_CADDY) {
10+
existsSync(caddyPath) && unlinkSync(caddyPath)
11+
await download()
12+
}
1013
}
1114
catch (e: any) {
1215
consola.error(e.code)

0 commit comments

Comments
 (0)