Skip to content

Sugestão: Mais opções de personalização ao criar projetos Laravel #442

@lauro17

Description

@lauro17

Olá pessoal! 👋

Antes de mais nada, quero explicar que não sou especialista em Laravel nem em scripts avançados, mas sou profissional na área de sistemas e, estudando um pouco sobre Laravel, criei um script PowerShell para facilitar a criação de projetos com algumas opções de personalização. Pensei que isso poderia ajudar a melhorar a parte da ferramenta que lida com Laravel.


Funcionalidades do Script

O script atual permite:

  • Escolher o idioma de mensagens (pt | en | es | zh | ja)
  • Personalizar nome do projeto
  • Escolher starter kit (none | breeze | jetstream)
  • Selecionar stack do Breeze (blade | livewire | livewire-functional | react | vue | api)
  • Configurar banco de dados (sqlite | mysql | mariadb | pgsql | sqlsrv)
  • Rodar migrations automaticamente (yes | no)
  • Verificar PHP, Composer, extensões PHP e conexão SSL
  • Evitar sobrescrever pastas existentes

⚠️ Observações importantes

  • O script foi feito para Laravel 12, mas pode não funcionar corretamente em outras versões, porque as perguntas e comandos do Laravel podem mudar.
  • Caso o Laravel altere a forma de criar projetos ou o comportamento de prompts, o script pode quebrar.
  • Testei apenas localmente, e o foco é ajudar a melhorar a personalização de criação de projetos no FlyEnv.

Segue o script versão 1.0.2 como exemplo (em PowerShell):

`param ()

====================

Escolha do idioma

====================

$Lang = Read-Host "Escolha o idioma (pt|en|es|zh|ja) [padrão: pt]"
if ([string]::IsNullOrWhiteSpace($Lang)) { $Lang = "pt" }

====================

Pergunta inicial de personalização

====================

$customize = Read-Host "Deseja personalizar o projeto? (s/n)"
if ($customize -eq "s") {
$ProjectName = Read-Host "Nome do projeto"
if ([string]::IsNullOrWhiteSpace($ProjectName)) { $ProjectName = "meu-projeto" }

$StarterKit  = Read-Host "Starter kit (none|breeze|jetstream)"
if ([string]::IsNullOrWhiteSpace($StarterKit)) { $StarterKit = "breeze" }

if ($StarterKit -eq "breeze") {
    $BreezeStack = Read-Host "Breeze stack (blade|livewire|livewire-functional|react|vue|api)"
    if ([string]::IsNullOrWhiteSpace($BreezeStack)) { $BreezeStack = "blade" }
}

$Database     = Read-Host "Banco de dados (sqlite|mysql|mariadb|pgsql|sqlsrv)"
if ([string]::IsNullOrWhiteSpace($Database)) { $Database = "mysql" }

$RunMigrations = Read-Host "Rodar migrations? (yes|no)"
if ([string]::IsNullOrWhiteSpace($RunMigrations)) { $RunMigrations = "no" }

} else {
# Valores padrão
$ProjectName = "meu-projeto"
$StarterKit = "breeze"
$BreezeStack = "blade"
$Database = "mysql"
$RunMigrations = "no"
}

====================

Mensagens multilíngues

====================

$messages = @{
pt = @{
phpNotFound = "❌ PHP não encontrado no PATH."
composerNotFound = "❌ Composer não encontrado no PATH."
extMissing = "❌ A extensão '{0}' não está habilitada no PHP. Ative no php.ini."
folderExists = "⚠️ Pasta '{0}' já existe."
sslError = "⚠️ Problema SSL detectado! Pode ser arquivo PEM ausente ou antivírus interferindo."
sslOk = "✅ Conexão SSL OK!"
creatingProject = "🚀 Criando projeto Laravel '{0}'..."
generatingKey = "🔑 Gerando chave..."
installingBreeze = "🛠️ Instalando Laravel Breeze..."
breezeStack = "🛠️ Configurando Breeze ({0})..."
npmInstalling = "📦 Instalando dependências npm..."
npmNotFound = "⚠️ npm não encontrado, pule 'npm install'."
npmError = "❌ Erro no npm: {0}"
apiInfo = "ℹ️ Stack 'api' detectada, apenas endpoints, sem interface."
runningMigrate = "🛠️ Rodando migrations..."
skippingMigrate = "🛠️ Pulando migrations."
avList = "🛡️ Antivírus ativos:"
finished = "✅ Projeto Laravel '{0}' criado com sucesso!"
}
en = @{
phpNotFound = "❌ PHP not found in PATH."
composerNotFound = "❌ Composer not found in PATH."
extMissing = "❌ The extension '{0}' is not enabled in PHP. Enable it in php.ini."
folderExists = "⚠️ Folder '{0}' already exists."
sslError = "⚠️ SSL problem detected! PEM file missing or antivirus may be interfering."
sslOk = "✅ SSL connection OK!"
creatingProject = "🚀 Creating Laravel project '{0}'..."
generatingKey = "🔑 Generating key..."
installingBreeze = "🛠️ Installing Laravel Breeze..."
breezeStack = "🛠️ Setting up Breeze ({0})..."
npmInstalling = "📦 Installing npm dependencies..."
npmNotFound = "⚠️ npm not found, skipping 'npm install'."
npmError = "❌ npm error: {0}"
apiInfo = "ℹ️ 'api' stack detected, only endpoints, no interface."
runningMigrate = "🛠️ Running migrations..."
skippingMigrate = "🛠️ Skipping migrations."
avList = "🛡️ Active antivirus:"
finished = "✅ Laravel project '{0}' created successfully!"
}
}

====================

Função para exibir mensagens

====================

function Msg($key, [Parameter(ValueFromRemainingArguments=$true)]$args) {
$text = $messages[$Lang][$key]
if ($args -and $args.Count -gt 0) {
$strArgs = $args | ForEach-Object { $_.ToString() }
return [string]::Format($text, $strArgs)
}
return $text
}

====================

Funções auxiliares

====================

function Test-Command { param([string]$Command) return $null -ne (Get-Command $Command -ErrorAction SilentlyContinue) }

function Test-SSLAndAV {
$url = "https://repo.packagist.org/packages.json"
Write-Host "🔍 Testando conexão SSL com $url..."
try {
Invoke-WebRequest -Uri $url -UseBasicParsing -ErrorAction Stop | Out-Null
Write-Host (Msg "sslOk") -ForegroundColor Green
} catch {
Write-Host (Msg "sslError") -ForegroundColor Yellow
Write-Host "Detalhes: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host "`n$(Msg "avList")"
$avList = Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct | Select-Object displayName,productState
if ($avList) {
foreach ($av in $avList) { Write-Host "• $($av.displayName) (Estado: $($av.productState))" }
} else { Write-Host "Nenhum antivírus detectado via WMI." -ForegroundColor Yellow }
}

====================

Verificações básicas

====================

if (-not (Test-Command "php")) { Write-Host (Msg "phpNotFound") -ForegroundColor Red; exit 1 }
if (-not (Test-Command "composer")) { Write-Host (Msg "composerNotFound") -ForegroundColor Red; exit 1 }
$phpPath = (Get-Command php).Source

$extensions = @("mbstring","openssl","pdo","pdo_mysql","pdo_sqlite","sqlite3")
foreach ($ext in $extensions) {
if ((& $phpPath -r "echo extension_loaded('$ext') ? '1' : '0';").Trim() -ne '1') {
Write-Host (Msg "extMissing" $ext) -ForegroundColor Red
exit 1
}
}

Test-SSLAndAV

====================

Evitar sobrescrever pasta existente

====================

if (Test-Path $ProjectName) { Write-Host (Msg "folderExists" $ProjectName) -ForegroundColor Yellow; exit 1 }

====================

Criar projeto Laravel

====================

Write-Host (Msg "creatingProject" $ProjectName)
composer create-project laravel/laravel $ProjectName "12.*" --prefer-dist --no-interaction
if (-not (Test-Path $ProjectName)) { Write-Host "❌ Falha ao criar projeto, verifique SSL/Composer."; exit 1 }

Set-Location $ProjectName

Gerar chave

Write-Host (Msg "generatingKey")
& $phpPath artisan key:generate --ansi

Configurar .env

$envFile = ".env"
if (Test-Path $envFile) {
(Get-Content $envFile) | ForEach-Object {
switch ($Database) {
"mysql" { $_ -replace '^DB_CONNECTION=.','DB_CONNECTION=mysql' -replace '^DB_HOST=.*','DB_HOST=127.0.0.1'
-replace '^DB_PORT=.
','DB_PORT=3306' -replace '^DB_DATABASE=.*','DB_DATABASE=laravel'
-replace '^DB_USERNAME=.','DB_USERNAME=root' `
-replace '^DB_PASSWORD=.
','DB_PASSWORD=senha' }
"sqlite" { $_ -replace '^DB_CONNECTION=.*','DB_CONNECTION=sqlite' }
default { $_ }
}
} | Set-Content $envFile

if ($Database -eq "sqlite" -and -not (Test-Path "database/database.sqlite")) { New-Item -ItemType File "database/database.sqlite" | Out-Null }

} else {
Write-Host "⚠️ .env não encontrado, pulando configuração do DB." -ForegroundColor Yellow
}

====================

Instalar Breeze

====================

if ($StarterKit -eq "breeze") {
Write-Host (Msg "installingBreeze")
composer require laravel/breeze --dev

Write-Host (Msg "breezeStack" $BreezeStack)
try { & $phpPath artisan breeze:install $BreezeStack --no-interaction } 
catch { Write-Host "⚠️ Ignorando erro no Breeze: $_" -ForegroundColor Yellow }

if ($BreezeStack -ne "api") {
    Write-Host (Msg "npmInstalling")
    if (Test-Command "npm") {
        try { npm ci; npm run build } catch { Write-Host (Msg "npmError" $_) -ForegroundColor Red }
    } else { Write-Host (Msg "npmNotFound") -ForegroundColor Yellow }
} else { Write-Host (Msg "apiInfo") }

}

====================

Rodar migrations

====================

if ($RunMigrations -eq "yes") {
Write-Host (Msg "runningMigrate")
& $phpPath artisan migrate:fresh --seed --ansi
} else { Write-Host (Msg "skippingMigrate") }

====================

Final

====================

Write-Host (Msg "finished" $ProjectName) -ForegroundColor Green
`

Segue o script versão 1.0.1 como exemplo (em PowerShell):
`param (
[string]$Lang = "pt", # pt | en | es | zh | ja
[string]$ProjectName = "meu-projeto",
[string]$StarterKit = "breeze", # none | breeze | jetstream
[string]$BreezeStack = "blade", # blade | livewire | livewire-functional | react | vue | api
[string]$Database = "mysql", # sqlite | mysql | mariadb | pgsql | sqlsrv
[string]$RunMigrations = "no" # yes | no
)

Mensagens multilíngues

$messages = @{
pt = @{
phpNotFound = "❌ PHP não encontrado no PATH."
composerNotFound = "❌ Composer não encontrado no PATH."
extMissing = "❌ A extensão '{0}' não está habilitada no PHP. Ative no php.ini."
folderExists = "⚠️ Pasta '{0}' já existe."
sslError = "⚠️ Problema SSL detectado! Pode ser arquivo PEM ausente ou antivírus interferindo."
sslOk = "✅ Conexão SSL OK!"
creatingProject = "🚀 Criando projeto Laravel '{0}'..."
generatingKey = "🔑 Gerando chave..."
installingBreeze = "🛠️ Instalando Laravel Breeze..."
breezeStack = "🛠️ Configurando Breeze ({0})..."
npmInstalling = "📦 Instalando dependências npm..."
npmNotFound = "⚠️ npm não encontrado, pule 'npm install'."
npmError = "❌ Erro no npm: {0}"
apiInfo = "ℹ️ Stack 'api' detectada, apenas endpoints, sem interface."
runningMigrate = "🛠️ Rodando migrations..."
skippingMigrate = "🛠️ Pulando migrations."
avList = "🛡️ Antivírus ativos:"
finished = "✅ Projeto Laravel '{0}' criado com sucesso!"
}
en = @{
phpNotFound = "❌ PHP not found in PATH."
composerNotFound = "❌ Composer not found in PATH."
extMissing = "❌ The extension '{0}' is not enabled in PHP. Enable it in php.ini."
folderExists = "⚠️ Folder '{0}' already exists."
sslError = "⚠️ SSL problem detected! PEM file missing or antivirus may be interfering."
sslOk = "✅ SSL connection OK!"
creatingProject = "🚀 Creating Laravel project '{0}'..."
generatingKey = "🔑 Generating key..."
installingBreeze = "🛠️ Installing Laravel Breeze..."
breezeStack = "🛠️ Setting up Breeze ({0})..."
npmInstalling = "📦 Installing npm dependencies..."
npmNotFound = "⚠️ npm not found, skipping 'npm install'."
npmError = "❌ npm error: {0}"
apiInfo = "ℹ️ 'api' stack detected, only endpoints, no interface."
runningMigrate = "🛠️ Running migrations..."
skippingMigrate = "🛠️ Skipping migrations."
avList = "🛡️ Active antivirus:"
finished = "✅ Laravel project '{0}' created successfully!"
}
es = @{
phpNotFound = "❌ PHP no encontrado en el PATH."
composerNotFound = "❌ Composer no encontrado en el PATH."
extMissing = "❌ La extensión '{0}' no está habilitada en PHP. Actívala en php.ini."
folderExists = "⚠️ La carpeta '{0}' ya existe."
sslError = "⚠️ Problema SSL detectado! Archivo PEM ausente o antivirus interfiriendo."
sslOk = "✅ Conexión SSL OK!"
creatingProject = "🚀 Creando proyecto Laravel '{0}'..."
generatingKey = "🔑 Generando clave..."
installingBreeze = "🛠️ Instalando Laravel Breeze..."
breezeStack = "🛠️ Configurando Breeze ({0})..."
npmInstalling = "📦 Instalando dependencias npm..."
npmNotFound = "⚠️ npm no encontrado, omitiendo 'npm install'."
npmError = "❌ Error en npm: {0}"
apiInfo = "ℹ️ Stack 'api' detectada, solo endpoints, sin interfaz."
runningMigrate = "🛠️ Ejecutando migraciones..."
skippingMigrate = "🛠️ Omitiendo migraciones."
avList = "🛡️ Antivirus activos:"
finished = "✅ Proyecto Laravel '{0}' creado con éxito!"
}
zh = @{
phpNotFound = "❌ 在 PATH 中未找到 PHP。"
composerNotFound = "❌ 在 PATH 中未找到 Composer。"
extMissing = "❌ PHP 未启用扩展 '{0}'。请在 php.ini 中启用。"
folderExists = "⚠️ 文件夹 '{0}' 已存在。"
sslError = "⚠️ 检测到 SSL 问题!可能缺少 PEM 文件或杀毒软件干扰。"
sslOk = "✅ SSL 连接正常!"
creatingProject = "🚀 正在创建 Laravel 项目 '{0}'..."
generatingKey = "🔑 正在生成密钥..."
installingBreeze = "🛠️ 正在安装 Laravel Breeze..."
breezeStack = "🛠️ 配置 Breeze ({0})..."
npmInstalling = "📦 正在安装 npm 依赖..."
npmNotFound = "⚠️ 未找到 npm,跳过 'npm install'。"
npmError = "❌ npm 错误: {0}"
apiInfo = "ℹ️ 检测到 'api' 栈,仅包含端点,无界面。"
runningMigrate = "🛠️ 正在运行 migrations..."
skippingMigrate = "🛠️ 跳过 migrations。"
avList = "🛡️ 活跃的杀毒软件:"
finished = "✅ Laravel 项目 '{0}' 创建成功!"
}
ja = @{
phpNotFound = "❌ PATH に PHP が見つかりません。"
composerNotFound = "❌ PATH に Composer が見つかりません。"
extMissing = "❌ PHP 拡張 '{0}' が有効になっていません。php.ini で有効化してください。"
folderExists = "⚠️ フォルダー '{0}' は既に存在します。"
sslError = "⚠️ SSL に問題があります!PEM ファイルが存在しないか、アンチウイルスが干渉している可能性があります。"
sslOk = "✅ SSL 接続が正常です!"
creatingProject = "🚀 Laravel プロジェクト '{0}' を作成中..."
generatingKey = "🔑 キーを生成中..."
installingBreeze = "🛠️ Laravel Breeze をインストール中..."
breezeStack = "🛠️ Breeze を設定中 ({0})..."
npmInstalling = "📦 npm 依存関係をインストール中..."
npmNotFound = "⚠️ npm が見つかりません。'npm install' をスキップします。"
npmError = "❌ npm エラー: {0}"
apiInfo = "ℹ️ 'api' スタックを検出、エンドポイントのみ、UI なし。"
runningMigrate = "🛠️ migrations を実行中..."
skippingMigrate = "🛠️ migrations をスキップ..."
avList = "🛡️ アクティブなアンチウイルス:"
finished = "✅ Laravel プロジェクト '{0}' が正常に作成されました!"
}
}

Função para exibir mensagens corretamente com placeholders

function Msg($key, [Parameter(ValueFromRemainingArguments=$true)]$args) {
$text = $messages[$Lang][$key]
if ($args -and $args.Count -gt 0) {
$strArgs = $args | ForEach-Object { $_.ToString() }
return [string]::Format($text, $strArgs)
}
return $text
}

Testa se comando existe

function Test-Command { param([string]$Command) return $null -ne (Get-Command $Command -ErrorAction SilentlyContinue) }

====================

Verificações básicas

====================

if (-not (Test-Command "php")) { Write-Host (Msg "phpNotFound") -ForegroundColor Red; exit 1 }
if (-not (Test-Command "composer")) { Write-Host (Msg "composerNotFound") -ForegroundColor Red; exit 1 }
$phpPath = (Get-Command php).Source

Verificar extensões PHP

$extensions = @("mbstring","openssl","pdo","pdo_mysql","pdo_sqlite","sqlite3")
foreach ($ext in $extensions) {
if ((& $phpPath -r "echo extension_loaded('$ext') ? '1' : '0';").Trim() -ne '1') {
Write-Host (Msg "extMissing" $ext) -ForegroundColor Red
exit 1
}
}

Testar SSL e antivírus

function Test-SSLAndAV {
$url = "https://repo.packagist.org/packages.json"
Write-Host "🔍 Testando conexão SSL com $url..."

try {
    Invoke-WebRequest -Uri $url -UseBasicParsing -ErrorAction Stop | Out-Null
    Write-Host (Msg "sslOk") -ForegroundColor Green
} catch {
    Write-Host (Msg "sslError") -ForegroundColor Yellow
    Write-Host "Detalhes: $($_.Exception.Message)" -ForegroundColor Red
}

Write-Host "`n$(Msg "avList")"
$avList = Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct | Select-Object displayName,productState
if ($avList) {
    foreach ($av in $avList) {
        Write-Host "• $($av.displayName) (Estado: $($av.productState))"
    }
} else {
    Write-Host "Nenhum antivírus detectado via WMI." -ForegroundColor Yellow
}

}
Test-SSLAndAV

Evitar sobrescrever pasta existente

if (Test-Path $ProjectName) {
Write-Host (Msg "folderExists" "$ProjectName") -ForegroundColor Yellow
exit 1
}

Criar projeto Laravel

Write-Host (Msg "creatingProject" "$ProjectName")
composer create-project laravel/laravel $ProjectName "12.*" --prefer-dist --no-interaction
Set-Location $ProjectName

Gerar chave

Write-Host (Msg "generatingKey")
& $phpPath artisan key:generate --ansi

Configurar .env

$envFile = ".env"
(Get-Content $envFile) | ForEach-Object {
switch ($Database) {
"mysql" { $_ -replace '^DB_CONNECTION=.','DB_CONNECTION=mysql' -replace '^DB_HOST=.*','DB_HOST=127.0.0.1'
-replace '^DB_PORT=.
','DB_PORT=3306' -replace '^DB_DATABASE=.*','DB_DATABASE=laravel'
-replace '^DB_USERNAME=.','DB_USERNAME=root' `
-replace '^DB_PASSWORD=.
','DB_PASSWORD=senha' }
"sqlite" { $_ -replace '^DB_CONNECTION=.*','DB_CONNECTION=sqlite' }
default { $_ }
}
} | Set-Content $envFile

if ($Database -eq "sqlite" -and -not (Test-Path "database/database.sqlite")) {
New-Item -ItemType File "database/database.sqlite" | Out-Null
}

Instalar Breeze

if ($StarterKit -eq "breeze") {
Write-Host (Msg "installingBreeze")
composer require laravel/breeze --dev

Write-Host (Msg "breezeStack" $BreezeStack)
try { & $phpPath artisan breeze:install $BreezeStack --no-interaction } 
catch { Write-Host "⚠️ Ignorando erro no Breeze: $_" -ForegroundColor Yellow }

if ($BreezeStack -ne "api") {
    Write-Host (Msg "npmInstalling")
    if (Test-Command "npm") {
        try { npm ci; npm run build } catch { Write-Host (Msg "npmError" $_) -ForegroundColor Red }
    } else { Write-Host (Msg "npmNotFound") -ForegroundColor Yellow }
} else { Write-Host (Msg "apiInfo") }

}

Rodar migrations

if ($RunMigrations -eq "yes") {
Write-Host (Msg "runningMigrate")
& $phpPath artisan migrate:fresh --seed --ansi
} else { Write-Host (Msg "skippingMigrate") }

Final

Write-Host (Msg "finished" "$ProjectName") -ForegroundColor Green
`

Segue o script versão 1.0.0 como exemplo (em PowerShell):
`param (
[string]$ProjectName = "meu-projeto",
[string]$StarterKit = "breeze", # none | breeze | jetstream
[string]$BreezeStack = "blade", # blade | livewire | livewire-functional | react | vue | api
[string]$Database = "mysql", # sqlite | mysql | mariadb | pgsql | sqlsrv
[string]$RunMigrations = "no" # yes | no
)

Função para verificar comando

function Test-Command { param([string]$Command) return $null -ne (Get-Command $Command -ErrorAction SilentlyContinue) }

Verificar PHP

if (-Not (Test-Command "php")) { Write-Host "❌ PHP não encontrado no PATH." -ForegroundColor Red; exit 1 }
$phpPath = (Get-Command php).Source

Verificar Composer

if (-Not (Test-Command "composer")) { Write-Host "❌ Composer não encontrado no PATH." -ForegroundColor Red; exit 1 }

Verificar extensões PHP necessárias

$extensions = @("mbstring","openssl","pdo","pdo_mysql","pdo_sqlite","sqlite3")
foreach ($ext in $extensions) {
$loaded = (& $phpPath -r "echo extension_loaded('$ext') ? '1' : '0';").Trim()
if ($loaded -ne '1') {
Write-Host "❌ A extensão '$ext' não está habilitada no PHP. Ative no php.ini." -ForegroundColor Red
exit 1
}
}

Evitar sobrescrever pasta existente

if (Test-Path $ProjectName) { Write-Host "⚠️ Pasta '$ProjectName' já existe." -ForegroundColor Yellow; exit 1 }

Criar projeto Laravel

Write-Host "🚀 Criando projeto Laravel..."
composer create-project laravel/laravel $ProjectName "12.*" --prefer-dist --no-interaction
Set-Location $ProjectName

Gerar chave

Write-Host "🔑 Gerando chave..."
& $phpPath artisan key:generate --ansi

Ajustar .env para DB

$envFile = ".env"
(Get-Content $envFile) | ForEach-Object {
switch ($Database) {
"mysql" {
$_ -replace '^DB_CONNECTION=.','DB_CONNECTION=mysql' -replace '^DB_HOST=.*','DB_HOST=127.0.0.1'
-replace '^DB_PORT=.
','DB_PORT=3306' -replace '^DB_DATABASE=.*','DB_DATABASE=laravel'
-replace '^DB_USERNAME=.','DB_USERNAME=root' `
-replace '^DB_PASSWORD=.
','DB_PASSWORD=senha'
}
"sqlite" { $_ -replace '^DB_CONNECTION=.*','DB_CONNECTION=sqlite' }
default { $_ }
}
} | Set-Content $envFile

Criar SQLite se necessário

if ($Database -eq "sqlite" -and -not (Test-Path "database/database.sqlite")) {
New-Item -ItemType File "database/database.sqlite" | Out-Null
}

Instalar Breeze se solicitado

if ($StarterKit -eq "breeze") {
Write-Host "🛠️ Instalando Laravel Breeze..."
composer require laravel/breeze --dev

Write-Host "🛠️ Configurando Breeze ($BreezeStack)..."
try { & $phpPath artisan breeze:install $BreezeStack --force } catch { Write-Host "⚠️ Ignorando erro no Breeze: $_" -ForegroundColor Yellow }

# Instalar npm apenas se houver interface
if ($BreezeStack -ne "api") {
    Write-Host "📦 Instalando dependências npm..."
    if (Test-Command "npm") {
        try { npm install; npm run build } catch { Write-Host "❌ Erro no npm: $_" -ForegroundColor Red }
    } else { Write-Host "⚠️ npm não encontrado, pule 'npm install'." -ForegroundColor Yellow }
} else {
    Write-Host "ℹ️ Stack 'api' detectada, apenas endpoints, sem interface."
}

}

Rodar migrations se escolhido

if ($RunMigrations -eq "yes") {
Write-Host "🛠️ Rodando migrations..."
& $phpPath artisan migrate:fresh --seed --ansi
} else { Write-Host "🛠️ Pulando migrations." }

Write-Host "✅ Projeto Laravel '$ProjectName' criado com sucesso!" -ForegroundColor Green
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions