|
| 1 | +#!/bin/bash |
| 2 | +# ----------------------------------------------------- |
| 3 | +# Project Setup Script (Default: Node.js/React projects) |
| 4 | +# ----------------------------------------------------- |
| 5 | +# This script is meant to help you quickly set up |
| 6 | +# JavaScript/TypeScript projects (Node.js, React, etc.) |
| 7 | +# |
| 8 | +# ⚠️ NOTE: |
| 9 | +# - For other languages/frameworks (Python, Go, Rust, etc.) |
| 10 | +# you should adapt or replace this script. |
| 11 | +# - Example: `pip install -r requirements.txt` for Python, |
| 12 | +# or `go mod tidy` for Go. |
| 13 | +# |
| 14 | +# Customize this script to fit your project needs! |
| 15 | +# ----------------------------------------------------- |
| 16 | + |
| 17 | +# Exit on first error |
| 18 | +set -e |
| 19 | + |
| 20 | +# Print each command before executing (for debugging) |
| 21 | +set -x |
| 22 | + |
| 23 | +# 1. Install Node.js dependencies |
| 24 | +if [ -f package.json ]; then |
| 25 | + echo "Installing npm dependencies..." |
| 26 | + npm install |
| 27 | +fi |
| 28 | + |
| 29 | +# 2. Create a default .env file if it doesn't exist |
| 30 | +if [ ! -f .env ]; then |
| 31 | + echo "Creating .env file..." |
| 32 | + touch .env |
| 33 | + echo "# Add your environment variables here" > .env |
| 34 | +fi |
| 35 | + |
| 36 | +# 3. Run initial build (if the project defines one) |
| 37 | +if [ -f package.json ]; then |
| 38 | + if npm run | grep -q build; then |
| 39 | + echo "Running initial build..." |
| 40 | + npm run build |
| 41 | + fi |
| 42 | +fi |
| 43 | + |
| 44 | +echo "Setup complete! You're ready to start coding." |
0 commit comments