Skip to content

Commit eb66feb

Browse files
authored
Support Laravel Herd for windows (#293)
1 parent fcd76b5 commit eb66feb

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/index.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
212212
server.config.logger.info(` ${colors.green('➜')} ${colors.bold('APP_URL')}: ${colors.cyan(appUrl.replace(/:(\d+)/, (_, port) => `:${colors.bold(port)}`))}`)
213213

214214
if (typeof resolvedConfig.server.https === 'object' && typeof resolvedConfig.server.https.key === 'string') {
215-
if (resolvedConfig.server.https.key.startsWith(herdConfigPath())) {
215+
if (resolvedConfig.server.https.key.startsWith(herdMacConfigPath()) || resolvedConfig.server.https.key.startsWith(herdWindowsConfigPath())) {
216216
server.config.logger.info(` ${colors.green('➜')} Using Herd certificate to secure Vite.`)
217217
}
218218

@@ -548,7 +548,7 @@ function resolveDevelopmentEnvironmentServerConfig(host: string|boolean|null): {
548548
return
549549
}
550550

551-
if (configPath === herdConfigPath()) {
551+
if (configPath === herdMacConfigPath() || configPath === herdWindowsConfigPath()) {
552552
throw Error(`Unable to find certificate files for your host [${resolvedHost}] in the [${configPath}/Certificates] directory. Ensure you have secured the site via the Herd UI.`)
553553
} else if (typeof host === 'string') {
554554
throw Error(`Unable to find certificate files for your host [${resolvedHost}] in the [${configPath}/Certificates] directory. Ensure you have secured the site by running \`valet secure ${host}\`.`)
@@ -571,8 +571,12 @@ function resolveDevelopmentEnvironmentServerConfig(host: string|boolean|null): {
571571
* Resolve the path to the Herd or Valet configuration directory.
572572
*/
573573
function determineDevelopmentEnvironmentConfigPath(): string|undefined {
574-
if (fs.existsSync(herdConfigPath())) {
575-
return herdConfigPath()
574+
if (fs.existsSync(herdMacConfigPath())) {
575+
return herdMacConfigPath()
576+
}
577+
578+
if (fs.existsSync(herdWindowsConfigPath())) {
579+
return herdWindowsConfigPath()
576580
}
577581

578582
if (fs.existsSync(valetConfigPath())) {
@@ -603,12 +607,19 @@ function dirname(): string {
603607
}
604608

605609
/**
606-
* Herd's configuration directory.
610+
* Herd's Mac configuration directory.
607611
*/
608-
function herdConfigPath(): string {
612+
function herdMacConfigPath(): string {
609613
return path.resolve(os.homedir(), 'Library', 'Application Support', 'Herd', 'config', 'valet')
610614
}
611615

616+
/**
617+
* Herd's Windows configuration directory.
618+
*/
619+
function herdWindowsConfigPath(): string {
620+
return path.resolve(os.homedir(), ".config", "herd", "config", "valet")
621+
}
622+
612623
/**
613624
* Valet's configuration directory.
614625
*/

0 commit comments

Comments
 (0)