Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.{json,yml,yaml}]
indent_size = 2

[*.{js,jsx,ts,tsx,astro,mjs}]
indent_size = 2
33 changes: 33 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.js text eol=lf
*.jsx text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
*.astro text eol=lf
*.mjs text eol=lf
*.json text eol=lf
*.md text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.html text eol=lf
*.css text eol=lf
*.scss text eol=lf
*.svg text eol=lf

# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.woff binary
*.woff2 binary
*.ttf binary
*.eot binary
76 changes: 76 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI/CD Pipeline

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: write
issues: write
pull-requests: write

jobs:
ci-cd:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Check for BOM in files
run: |
echo "Checking for BOM (Byte Order Mark) in text files..."

# Define file extensions to check
EXTENSIONS="json mjs js ts tsx jsx astro md yml yaml"

# Find and check files
BOM_FOUND=false

for ext in $EXTENSIONS; do
echo "Checking .$ext files..."

# Find files with the extension and check for BOM
find . -name "*.$ext" -not -path "./node_modules/*" -not -path "./.git/*" | while read -r file; do
if [ -f "$file" ]; then
# Check if file starts with BOM (EF BB BF)
if xxd -l 3 "$file" 2>/dev/null | grep -q "efbb bf"; then
echo "❌ BOM detected in: $file"
echo "BOM_FOUND=true" >> $GITHUB_ENV
exit 1
fi
fi
done
done

if [ "$BOM_FOUND" = "true" ]; then
echo "❌ BOM detected in one or more files. Please remove BOM and use UTF-8 without BOM encoding."
exit 1
else
echo "✅ No BOM detected in any files."
fi

- name: Run BOM check script
run: npm run bom:check

- name: Run tests
run: npm test

- name: Release (only on push to master)
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.USER_TOKEN }}
run: npx semantic-release
15 changes: 15 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# Check for BOM in staged files
echo "Checking for BOM in staged files..."
staged_files=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(js|ts|tsx|jsx|astro|json|md|mjs)$" || true)
if [ -n "$staged_files" ]; then
for file in $staged_files; do
if [ -f "$file" ] && head -c 3 "$file" | xxd -p | grep -q "efbbbf"; then
echo "ERROR: BOM detected in $file"
echo "Please remove BOM from the file before committing."
exit 1
fi
done
fi
echo "No BOM detected in staged files."
npm test
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
}
}
]
}
}
16 changes: 16 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
]
}
10 changes: 2 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"astro"
],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "astro"],
"eslint.format.enable": true,
"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode"
Expand All @@ -26,4 +20,4 @@
"editor.tabSize": 2,
"editor.insertSpaces": true,
"files.eol": "\n"
}
}
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,42 @@ Semua perintah dijalankan dari root proyek di terminal:

## ✅ Memulai

### Cara 1: Menggunakan Initializer (Direkomendasikan)

```sh
# Buat proyek baru dengan nama yang Anda inginkan
npm create @pamanaleph/astro@latest my-awesome-project

# Masuk ke direktori proyek
cd my-awesome-project

# Jalankan server pengembangan
npm run dev
```

### Cara 2: Menggunakan Astro Official CLI

```sh
# Buat proyek baru menggunakan template terbaru
npm create astro@latest my-project -- --template github:PamanAleph/astro-react-typescript-template

# Masuk ke direktori proyek
cd my-project

# Instal dependensi
npm install

# Jalankan server pengembangan
npm run dev
```

### Cara 3: Clone Manual

1. **Clone repositori ini:**

```sh
git clone <URL_REPOSITORI_ANDA>
cd astro-react-typescript
git clone https://github.com/PamanAleph/astro-react-typescript-template.git
cd astro-react-typescript-template
```

2. **Instal dependensi:**
Expand All @@ -111,7 +142,17 @@ Semua perintah dijalankan dari root proyek di terminal:
npm run dev
```

Aplikasi Anda sekarang akan berjalan di [http://localhost:4321](http://localhost:4321).
Aplikasi Anda sekarang akan berjalan di [http://localhost:4321](http://localhost:4321).

### Opsi Tambahan untuk Initializer

```sh
# Gunakan tag/branch/commit tertentu
npm create @pamanaleph/astro@latest my-project -- --ref v0.1.0

# Skip instalasi dependensi otomatis
npm create @pamanaleph/astro@latest my-project -- --no-install
```

## 📚 Pelajari Lebih Lanjut

Expand Down
Loading
Loading