Skip to content

Commit

Permalink
vercel related documentation added (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkersigirci authored Jul 5, 2024
1 parent c6e2477 commit 4b2e698
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 34 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_URL=http://localhost:5173
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: build
env:
BASE_PATH: '/${{ github.event.repository.name }}'
PUBLIC_URL: "https://ilkersigirci.github.io"
run: |
bun run build
Expand Down
50 changes: 22 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,20 @@
# Blog-Markdown

## Using with npm
## Install && Run the App

```bash

# Install dependencies
npm i

# Start the dev server
npm run dev

# Build your app
npm run build

# Preview your app
npm run preview
```


## Using with Bun

```bash
# Install bun
# Install bun - NOTE: bun is installed globally to the system
curl -fsSL https://bun.sh/install | bash

# Using bunx instead of using npx or pnpm dlx
bun create svelte@latest your_app

#Move to your app directory
cd your_app/
# Using bun pacakge manager
# Using bun package manager
bun i

#start the dev server
bun dev
bun run dev

```

## Build
### Build

```bash
#build your app
Expand All @@ -46,3 +23,20 @@ bun run build
#preview your app
bun run preview
```

## Vercel Project Settings

- Open vercel dashboard of your project
- For project command overrides
- Settings -> General -> Build & Development Settings
- Build command: bun run build
- Output directory: build
- Install command: bun i
- Development command: bun run dev
- For environment variables
- Go to Settings -> Environment Variables
- PUBLIC_URL = https://blog.ilkerflix.com
- For custom Ignored Build Step
- Go to Settings -> Git -> Ignored Build Step -> Project Settings
- Custom -> if [ "$VERCEL_GIT_COMMIT_REF" == "gh-pages" ]; then exit 0; else exit 1; fi
- (Alternative) Run my bash script -> bash scripts/vercel_ignored_build_step.sh
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite dev",
"dev": "vite dev --port 5173",
"build": "vite build && pagefind",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
Expand Down
11 changes: 11 additions & 0 deletions scripts/vercel_ignored_build_step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF"

if [[ "$VERCEL_GIT_COMMIT_REF" == "gh-pages" ]]; then
echo "🛑 - Build cancelled"
exit 0;
else
echo "✅ - Build can proceed"
exit 1;
fi
8 changes: 4 additions & 4 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dev } from '$app/environment'
import { base } from '$app/paths'
import { PUBLIC_URL } from '$env/static/public'

export const title = 'Ilkerflix Blog'
export const description = 'Ilkerflix Blog'
export const url = (dev ? 'http://localhost:5173' : 'https://blog.ilkerflix.com') + base
export const title = 'Ilkerflix'
export const description = 'Ilkerflix'
export const url = PUBLIC_URL + base
1 change: 0 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const config = {
adapter: adapter({ fallback: '404.html', pages: 'build', assets: 'build' }),
paths: {
base: process.argv.includes('dev') ? "" : process.env.BASE_PATH
// base: process.env.NODE_ENV === "dev" ? "" : "/my-blog",
}
}
}
Expand Down

0 comments on commit 4b2e698

Please sign in to comment.