Svelte

अपनी Svelte ऐप डिप्लॉय करें

Plain Svelte (scaffolded with npm create vite -- --template svelte) is a normal static Vite build. SvelteKit is different by default — it expects a server — so it needs one extra step to output static files instead.

steps
  1. 01

    Plain Svelte: just build

    Run "npm run build". Like any Vite template, it writes static HTML, CSS, and JS to "dist" — nothing else to configure.

  2. 02

    SvelteKit: switch to the static adapter

    Install "@sveltejs/adapter-static", set it as the adapter in svelte.config.js, and run "npm run build". Output goes to "build" by default (configurable in the adapter options) instead of "dist".

  3. 03

    इसे डिप्लॉय करें

    अपने प्रोजेक्ट रूट से "npx harvis deploy dist" चलाएँ। इस पहले डिप्लॉय के लिए कोई कॉन्फ़िग और कोई लॉगिन नहीं चाहिए — आपको तुरंत एक लाइव URL मिलता है, साथ ही जब चाहें साइट को मुफ़्त अकाउंट से जोड़ने के लिए एक प्राइवेट क्लेम लिंक।

Svelte को एक कमांड से डिप्लॉय करें

अपना प्रोजेक्ट बनाएँ, फिर आउटपुट फ़ोल्डर harvis को सौंप दें। पहले डिप्लॉय के लिए किसी अकाउंट की ज़रूरत नहीं — आपको एक लाइव लिंक और बाद में इसे मैनेज करने के लिए एक प्राइवेट क्लेम लिंक मिलेगा।

terminal
npm run build
npx harvis deploy dist

टर्मिनल के बजाय फ़ाइलें खींचना पसंद है? प्रोजेक्ट बनाएँ, फिर आउटपुट फ़ोल्डर यहाँ ड्रॉप करें और इसे उसी तरह पब्लिश करें।

git hook

Deploy Svelte on every git push

The command above is one you will run again after every change. A git hook runs it for you: this one already points at dist, the folder Svelte builds into.

The folder holding the finished site. "." is the repo root, which is right for hand-written HTML; a static-site generator writes somewhere else.

pre-push fires on every branch and every remote, so a feature branch would publish over your live site. With this on, a push from anywhere else exits early and goes through untouched.

in your repo root
cat > .git/hooks/pre-push <<'EOF'
#!/bin/sh
set -e
npm run build
harvis deploy dist
EOF
chmod +x .git/hooks/pre-push

The options, the gotchas and how to share a hook with your team are on the git hook page.

Svelte डिप्लॉय से जुड़े सवाल

How do I know if my project is plain Svelte or SvelteKit?

Check package.json: SvelteKit projects depend on "@sveltejs/kit" and have a "src/routes" folder. Plain Svelte (the Vite template) doesn't — it's a single App.svelte with no server-side concept at all.

SvelteKit's adapter-static warns about "prerender" — what does that mean?

adapter-static needs every route pre-rendered at build time since there's no server to render them on request. Add "export const prerender = true" to your root +layout.js (or per-route) to opt every page in.

क्या Svelte ऐप को harvis पर डिप्लॉय करना सच में मुफ़्त है?

हाँ, कोई कार्ड नहीं चाहिए। मुफ़्त सीमाएँ 500 फ़ाइलें और 50 MB प्रति साइट हैं, जो एक स्टैटिक Svelte बिल्ड के लिए काफ़ी जगह देती हैं। पब्लिश की गई साइट्स एक्सपायर नहीं होतीं — जब तक आप उन्हें डिलीट नहीं करते, वे लाइव रहती हैं।

क्या मैं डिप्लॉय की गई Svelte साइट के साथ अपना खुद का डोमेन इस्तेमाल कर सकता हूँ?

हर साइट को एक मुफ़्त harvis.page एड्रेस मिलता है, और क्लेम करने के बाद आप डैशबोर्ड से अपनी पसंद का सबडोमेन चुन सकते हैं — रैंडम की बजाय my-app.harvis.page जैसा कुछ। आपके पास पहले से मौजूद किसी डोमेन (जैसे mystore.com) को साइट पर पॉइंट करना अभी सपोर्टेड नहीं है।

यह Svelte को Vercel या Netlify पर डिप्लॉय करने से कैसे अलग है?

Vercel और Netlify एक Git रेपो को कनेक्ट करने और आपका बिल्ड उनके सर्वर पर चलाने पर बने हैं, साथ में इसे कॉन्फ़िगर करने के लिए एक डैशबोर्ड। harvis यह सब छोड़ देता है: आप लोकली (या अपने CI में) बिल्ड करते हैं, आउटपुट फ़ोल्डर पर एक CLI कमांड चलाते हैं, और एक लिंक पाते हैं — कोई प्रोजेक्ट सेटअप नहीं, और साइट रखने तक कोई अकाउंट नहीं चाहिए।

other frameworks

कुछ और डिप्लॉय कर रहे हैं?

तरीका हर जगह एक जैसा है — पहले बनाएँ, फिर npx harvis deploy से आउटपुट डिप्लॉय करें।