|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 671 B |
|
After Width: | Height: | Size: 531 B |
|
After Width: | Height: | Size: 14 MiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 7.0 MiB |
|
After Width: | Height: | Size: 8.2 MiB |
|
After Width: | Height: | Size: 436 KiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,57 @@ |
|||||
|
@echo off |
||||
|
setlocal |
||||
|
|
||||
|
set "SCRIPT_DIR=%~dp0" |
||||
|
set "DIST_DIR=%SCRIPT_DIR%dist" |
||||
|
|
||||
|
echo Building and packaging dist... |
||||
|
echo Project folder: %SCRIPT_DIR% |
||||
|
|
||||
|
cd /d "%SCRIPT_DIR%" |
||||
|
if errorlevel 1 ( |
||||
|
echo Error: could not enter project folder. |
||||
|
pause |
||||
|
exit /b 1 |
||||
|
) |
||||
|
|
||||
|
where npm >nul 2>nul |
||||
|
if errorlevel 1 ( |
||||
|
echo Error: npm was not found. Please install Node.js first. |
||||
|
pause |
||||
|
exit /b 1 |
||||
|
) |
||||
|
|
||||
|
echo. |
||||
|
echo Running npm run build:prod... |
||||
|
call npm run build:prod |
||||
|
if errorlevel 1 ( |
||||
|
echo Error: build:prod failed. Package was not created. |
||||
|
pause |
||||
|
exit /b 1 |
||||
|
) |
||||
|
|
||||
|
if not exist "%DIST_DIR%\" ( |
||||
|
echo Error: dist folder was not found after build. |
||||
|
pause |
||||
|
exit /b 1 |
||||
|
) |
||||
|
|
||||
|
where powershell >nul 2>nul |
||||
|
if errorlevel 1 ( |
||||
|
echo Error: PowerShell was not found. |
||||
|
pause |
||||
|
exit /b 1 |
||||
|
) |
||||
|
|
||||
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; $scriptDir=$env:SCRIPT_DIR; $distDir=Join-Path $scriptDir 'dist'; $packageName='popiart-website-new'; $outputZip=Join-Path $scriptDir ($packageName + '.zip'); $tmpRoot=Join-Path ([IO.Path]::GetTempPath()) ('popiart-package-' + [guid]::NewGuid().ToString('N')); try { $packageDir=Join-Path $tmpRoot $packageName; New-Item -ItemType Directory -Path $packageDir -Force | Out-Null; Get-ChildItem -LiteralPath $distDir -Force | Copy-Item -Destination $packageDir -Recurse -Force; Get-ChildItem -LiteralPath $packageDir -Recurse -Force -Filter '.DS_Store' | Remove-Item -Force; if (Test-Path -LiteralPath $outputZip) { Remove-Item -LiteralPath $outputZip -Force }; Compress-Archive -LiteralPath $packageDir -DestinationPath $outputZip -Force; Write-Host 'Done:' $outputZip; Get-Item -LiteralPath $outputZip | Format-List FullName,Length } finally { if (Test-Path -LiteralPath $tmpRoot) { Remove-Item -LiteralPath $tmpRoot -Recurse -Force } }" |
||||
|
|
||||
|
if errorlevel 1 ( |
||||
|
echo Error: package failed. |
||||
|
pause |
||||
|
exit /b 1 |
||||
|
) |
||||
|
|
||||
|
echo. |
||||
|
echo Package complete. |
||||
|
echo Closing this window in 3 seconds... |
||||
|
timeout /t 3 /nobreak >nul |
||||
@ -0,0 +1,95 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
set -u |
||||
|
|
||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" |
||||
|
DIST_DIR="$SCRIPT_DIR/dist" |
||||
|
PACKAGE_NAME="popiart-website-new" |
||||
|
OUTPUT_ZIP="$SCRIPT_DIR/$PACKAGE_NAME.zip" |
||||
|
TMP_DIR="$(mktemp -d)" |
||||
|
|
||||
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" |
||||
|
|
||||
|
if [ -s "$HOME/.nvm/nvm.sh" ]; then |
||||
|
. "$HOME/.nvm/nvm.sh" |
||||
|
fi |
||||
|
|
||||
|
cleanup() { |
||||
|
if [ -n "${TMP_DIR:-}" ] && [ -d "$TMP_DIR" ]; then |
||||
|
rm -rf "$TMP_DIR" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
pause_before_exit() { |
||||
|
echo |
||||
|
read -r -p "按回车键关闭窗口..." |
||||
|
} |
||||
|
|
||||
|
close_after_success() { |
||||
|
echo |
||||
|
echo "3 秒后自动关闭窗口..." |
||||
|
sleep 3 |
||||
|
} |
||||
|
|
||||
|
trap cleanup EXIT |
||||
|
|
||||
|
echo "开始打包 dist..." |
||||
|
echo "项目目录: $SCRIPT_DIR" |
||||
|
|
||||
|
cd "$SCRIPT_DIR" || { |
||||
|
echo "错误: 无法进入项目目录。" |
||||
|
pause_before_exit |
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
if ! command -v npm >/dev/null 2>&1; then |
||||
|
echo "错误: 没有找到 npm,请先确认 Node.js 已安装。" |
||||
|
pause_before_exit |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
echo |
||||
|
echo "正在执行 npm run build:prod..." |
||||
|
npm run build:prod |
||||
|
|
||||
|
if [ $? -ne 0 ]; then |
||||
|
echo "错误: build:prod 执行失败,已停止打包。" |
||||
|
pause_before_exit |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
if [ ! -d "$DIST_DIR" ]; then |
||||
|
echo "错误: build 完成后没有找到 dist 目录。" |
||||
|
pause_before_exit |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
echo |
||||
|
echo "正在打包新的 dist..." |
||||
|
|
||||
|
if ! command -v zip >/dev/null 2>&1; then |
||||
|
echo "错误: 当前系统没有找到 zip 命令。" |
||||
|
pause_before_exit |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
mkdir "$TMP_DIR/$PACKAGE_NAME" |
||||
|
cp -R "$DIST_DIR/." "$TMP_DIR/$PACKAGE_NAME/" |
||||
|
|
||||
|
( |
||||
|
cd "$TMP_DIR" || exit 1 |
||||
|
zip -qry -X "$OUTPUT_ZIP" "$PACKAGE_NAME" -x "*/.DS_Store" "__MACOSX/*" |
||||
|
) |
||||
|
|
||||
|
if [ $? -ne 0 ]; then |
||||
|
echo "错误: 打包失败。" |
||||
|
pause_before_exit |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
echo "打包完成:" |
||||
|
echo "$OUTPUT_ZIP" |
||||
|
echo |
||||
|
ls -lh "$OUTPUT_ZIP" |
||||
|
|
||||
|
close_after_success |
||||