Last active 10 months ago
這段 PowerShell 腳本建立一個專案目錄,初始化基本的前端專案結構,包括 index.html、src 資料夾及子目錄,並透過 npm 安裝必要的依賴 (lit、vite、serve),最後列出目錄結構供檢查。
1 # 檢查是否提供了目錄名稱參數
2 if ($args.Length -eq 0) {
3 Write-Host "Usage: .\setup_project.ps1 <directory_name>"
4 exit 1
5 }
6
7 # 將參數設定為 PROJECT_DIR 變數
8 $PROJECT_DIR = $args[0]
9
10 # 嘗試建立目錄

timmy / 前端專案初始化腳本

1 likes
0 forks
1 files
Last active 10 months ago
這段 Bash 腳本建立一個專案目錄,初始化基本的前端專案結構(包括 index.html 和 src/components 資料夾),並透過 npm 安裝 lit、vite 和 serve,最後輸出目錄結構(排除 node_modules)。
1 #!/bin/bash
2
3 # Check if the user provided a directory name as an argument
4 if [ -z "$1" ]; then
5 echo "Usage: $0 <directory_name>"
6 exit 1
7 fi
8
9 # Set the user-provided parameter to the PROJECT_DIR variable
10 PROJECT_DIR="$1"
Newer Older