Skip to content

Commit

Permalink
Update and improve Blob SvelteKit example (#847)
Browse files Browse the repository at this point in the history
### Description

- update to latest version of Svelte(Kit)
- use static environment variable feature for better local development
experience
- use adapter-vercel
- improve readme

### Demo URL

https://blob-sveltekit-lake.vercel.app/

### Type of Change

- [ ] New Example
- [x] Example updates (Bug fixes, new features, etc.)
- [ ] Other (changes to the codebase, but not to examples)

### New Example Checklist

- [ ] 🛫 `npm run new-example` was used to create the example
- [ ] 📚 The template wasn't used but I carefuly read the [Adding a new
example](https://github.com/vercel/examples#adding-a-new-example) steps
and implemented them in the example
- [ ] 📱 Is it responsive? Are mobile and tablets considered?
  • Loading branch information
dummdidumm authored Jan 3, 2024
1 parent f1d2b20 commit c9b9e3d
Show file tree
Hide file tree
Showing 9 changed files with 994 additions and 401 deletions.
1 change: 1 addition & 0 deletions storage/blob-sveltekit/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BLOB_READ_WRITE_TOKEN=
35 changes: 10 additions & 25 deletions storage/blob-sveltekit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,30 @@ You can choose from one of the following two methods to use this repository:

### One-Click Deploy

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fstorage%2Fblob-sveltekit&project-name=blob-sveltekit&repository-name=blob-sveltekit&demo-title=Vercel%20Blob%20Svelte%20Starter&demo-description=Simple%20SvelteKit%20template%20that%20uses%20Vercel%20Blob%20to%20track%20pageviews.&demo-url=https%3A%2F%2Fblob-sveltekit.vercel.app%2F&demo-image=https%3A%2F%2Fblob-sveltekit.vercel.app%2Fopengraph-image.png&stores=%5B%7B"type"%3A"blob"%7D%5D)

# create-svelte
### Clone and Deploy

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!
Execute the following command to download the example into the `my-project` folder:

```bash
# create a new project in the current directory
pnpm create svelte@latest

# create a new project in my-app
pnpm create svelte@latest my-app
npx degit@latest https://github.com/vercel/examples/storage/blob-sveltekit my-project
```

## Developing
Once you've created the project and installed dependencies with `pnpm install`, copy the `.env.example` file in this directory to `.env.local` (which will be ignored by Git). Then open `.env.local` and set the environment variables to match the ones in your Vercel Storage Dashboard.

Once you've created a project and installed dependencies with `pnpm install`, start a development server:
Alternatively, if you have setup a project already and you have installed the Vercel CLI, you can also pull the environment variables using the following command:

```bash
pnpm dev

# or start the server and open the app in a new browser tab
pnpm dev --open
vercel env pull .env.local
```

## Building

To create a production version of your app:
Next, run SvelteKit in development mode:

```bash
pnpm build
pnpm dev
```

You can preview the production build with `pnpm preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples) ([Documentation](https://vercel.com/docs/frameworks/sveltekit)).
15 changes: 8 additions & 7 deletions storage/blob-sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.5.0",
"@sveltejs/adapter-vercel": "^4.0.3",
"@sveltejs/kit": "^2.0.6",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"tailwindcss": "^3.3.2",
"turbo": "^1.9.3",
"typescript": "^5.0.0",
"vite": "^4.3.0"
"typescript": "^5.0.4",
"vite": "^5.0.10"
},
"dependencies": {
"@vercel/blob": "^0.8.1",
"@vercel/blob": "^0.16.1",
"dotenv-expand": "^10.0.0"
}
}
Loading

14 comments on commit c9b9e3d

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

alt-tag-generator – ./solutions/alt-tag-generator

alt-tag-generator-git-main-vercel-solutions-vtest314.vercel.app
alt-text-generator.vercel.app
alt-tag-generator-vercel-solutions-vtest314.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cron – ./solutions/cron

cron-template.vercel.app
cron.vercel.rocks
cron-git-main.vercel.rocks

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

domains-api – ./solutions/domains-api

domains-api.vercel.rocks
domains-api-git-main.vercel.rocks

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

edge-functions-i18n – ./edge-middleware/i18n

edge-functions-i18n.vercel.app
edge-functions-i18n.vercel.sh
edge-functions-i18n-git-main.vercel.sh

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

geolocation-script – ./edge-middleware/geolocation-script

geolocation-script.vercel.app
geolocation-script-vercel-solutions-vtest314.vercel.app
geolocation-script-git-main-vercel-solutions-vtest314.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

redirect-with-fallback – ./app-directory/redirect-with-fallback

redirect-with-fallback-vercel-solutions-vtest314.vercel.app
redirect-with-fallback-git-main-vercel-solutions-vtest314.vercel.app
redirect-with-fallback.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

postgres-starter – ./storage/postgres-starter

postgres-starter.vercel.app
postgres-starter.vercel.rocks
postgres-starter-git-main.vercel.rocks

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

postgres-kysely – ./storage/postgres-kysely

postgres-kysely.vercel.app
postgres-kysely-git-main.vercel.rocks
postgres-kysely.vercel.rocks

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kv-redis-starter – ./storage/kv-redis-starter

kv-redis-starter.vercel.app
kv-redis-starter-git-main.vercel.rocks
kv-starter.vercel.app
kv-redis-starter.vercel.rocks
nextjs-kv-starter.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

postgres-prisma – ./storage/postgres-prisma

postgres-prisma.vercel.app
postgres-prisma-git-main.vercel.rocks
postgres-prisma.vercel.rocks

@vercel
Copy link

@vercel vercel bot commented on c9b9e3d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

feature-flag-hypertune – ./edge-middleware/feature-flag-hypertune

feature-flag-hypertune-now-examples.vercel.app
feature-flag-hypertune.vercel.app
feature-flag-hypertune-git-main-now-examples.vercel.app

Please sign in to comment.