Skip to content

Commit 70db475

Browse files
committed
Display plugin version in CLI
1 parent 0d4429a commit 70db475

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
158158
fs.writeFileSync(hotFile, viteDevServerUrl)
159159

160160
setTimeout(() => {
161-
server.config.logger.info(colors.red(`\n ${colors.bold('Laravel')} ${laravelVersion()} `))
161+
server.config.logger.info(`\n ${colors.red(`${colors.bold('LARAVEL')} ${laravelVersion()}`)} ${colors.dim('plugin')} ${colors.bold(`v${pluginVersion()}`)}`)
162+
server.config.logger.info('')
162163
server.config.logger.info(` ${colors.green('➜')} ${colors.bold('APP_URL')}: ${colors.cyan(appUrl.replace(/:(\d+)/, (_, port) => `:${colors.bold(port)}`))}`)
163164
}, 100)
164165
}
@@ -215,6 +216,17 @@ function laravelVersion(): string {
215216
}
216217
}
217218

219+
/**
220+
* The version of the Laravel Vite plugin being run.
221+
*/
222+
function pluginVersion(): string {
223+
try {
224+
return JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')).toString())?.version
225+
} catch {
226+
return ''
227+
}
228+
}
229+
218230
/**
219231
* Convert the users configuration into a standard structure with defaults.
220232
*/

0 commit comments

Comments
 (0)