Skip to content

Commit

Permalink
Merge branch 'main' of github.com:liuweiGL/vite-plugin-mkcert
Browse files Browse the repository at this point in the history
  • Loading branch information
liuweiGL committed Nov 20, 2023
2 parents 6848070 + 5ea7391 commit 43e2831
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [1.16.0](https://github.com/liuweiGL/vite-plugin-mkcert/compare/v1.15.0...v1.16.0) (2023-06-28)


### Features

* Support more platforms and architectures ([0cb9571](https://github.com/liuweiGL/vite-plugin-mkcert/commit/0cb9571734db5daafe281a8da81f9c427ff51935)), closes [#68](https://github.com/liuweiGL/vite-plugin-mkcert/issues/68)

# [1.15.0](https://github.com/liuweiGL/vite-plugin-mkcert/compare/v1.14.1...v1.15.0) (2023-05-04)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-mkcert",
"version": "1.15.0",
"version": "1.16.0",
"description": "Provide certificates for vite's https dev service",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const plugin = (options: MkcertPluginOptions = {}): PluginOption => {
allHosts.push(server.host)
}

const uniqueHosts = Array.from(new Set(allHosts)).filter(item => !!item)
const uniqueHosts = Array.from(new Set(allHosts)).filter(Boolean)

const certificate = await mkcert.install(uniqueHosts)
const httpsConfig = {
Expand Down
24 changes: 12 additions & 12 deletions plugin/mkcert/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ class Mkcert {
this.config = new Config({ savePath: this.savePath })
}

private async getMkcertBinnary() {
let binnary
private async getMkcertBinary() {
let binary

if (this.localMkcert) {
if (await exists(this.localMkcert)) {
binnary = this.localMkcert
binary = this.localMkcert
} else {
this.logger.error(
pc.red(
Expand All @@ -143,9 +143,9 @@ class Mkcert {
)
}
} else if (await exists(this.savedMkcert)) {
binnary = this.savedMkcert
binary = this.savedMkcert
}
return binnary ? escape(binnary) : undefined
return binary ? escape(binary) : undefined
}

private async checkCAExists() {
Expand All @@ -158,8 +158,8 @@ class Mkcert {
return
}

const mkcertBinnary = await this.getMkcertBinnary()
const commandStatement = `${mkcertBinnary} -CAROOT`
const mkcertBinary = await this.getMkcertBinary()
const commandStatement = `${mkcertBinary} -CAROOT`

debug(`Exec ${commandStatement}`)

Expand Down Expand Up @@ -193,9 +193,9 @@ class Mkcert {

private async createCertificate(hosts: string[]) {
const names = hosts.join(' ')
const mkcertBinnary = await this.getMkcertBinnary()
const mkcertBinary = await this.getMkcertBinary()

if (!mkcertBinnary) {
if (!mkcertBinary) {
debug(
`Mkcert does not exist, unable to generate certificate for ${names}`
)
Expand All @@ -204,7 +204,7 @@ class Mkcert {
await ensureDirExist(this.savePath)
await this.retainExistedCA()

const cmd = `${mkcertBinnary} -install -key-file ${escape(
const cmd = `${mkcertBinary} -install -key-file ${escape(
this.keyFilePath
)} -cert-file ${escape(this.certFilePath)} ${names}`

Expand Down Expand Up @@ -240,9 +240,9 @@ class Mkcert {
await ensureDirExist(this.savePath)
await this.config.init()

const mkcertBinnary = await this.getMkcertBinnary()
const mkcertBinary = await this.getMkcertBinary()

if (!mkcertBinnary) {
if (!mkcertBinary) {
await this.initMkcert()
} else if (this.autoUpgrade) {
await this.upgradeMkcert()
Expand Down

0 comments on commit 43e2831

Please sign in to comment.