From 72d057c21fbfa7e794cf07ae6427d7498e87a2a1 Mon Sep 17 00:00:00 2001 From: opensas Date: Mon, 19 Apr 2021 18:50:01 -0300 Subject: [PATCH] deploy to vercel --- .vscode/settings.json | 5 ++++- README.md | 24 ++++++++++++++++++++++++ package.json | 13 +++++++------ svelte.config.cjs | 6 ++++-- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index dc4f37a..be89586 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,9 @@ { "cSpell.words": [ "opensas", - "sveltekit" + "preprocessors", + "sveltejs", + "sveltekit", + "vercel" ] } \ No newline at end of file diff --git a/README.md b/README.md index 50fa0a7..042daab 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,30 @@ Based on the [Landing Page](https://www.tailwindtoolbox.com/templates/landing-pa ![Landing Page](https://www.tailwindtoolbox.com/templates/landing-page.png) +The site is automatically deployed to [vercel](https://vercel.com) using the [SvelteKit vercel adapter](https://github.com/sveltejs/kit/tree/master/packages/adapter-vercel). Check the [documentation](https://kit.svelte.dev/docs#adapters) for other adapters. + +## Deploying to vercel + +Add `"@sveltejs/adapter-vercel"`: `"next"` to the devDependencies in your `package.json` and run `npm install`. + +```shell +pnpm install -D @sveltejs/adapter-vercel +``` + +Then modify your svelte.config.js: + +```javascript +const vercel = require('@sveltejs/adapter-vercel'); +... + +module.exports = { + kit: { + ... + adapter: vercel() + } +}; +``` + ## Running locally Clone the repo, install dependencies and start the development server: diff --git a/package.json b/package.json index 593aad9..5669f27 100644 --- a/package.json +++ b/package.json @@ -10,24 +10,25 @@ }, "devDependencies": { "@sveltejs/adapter-node": "next", + "@sveltejs/adapter-vercel": "next", "@sveltejs/kit": "next", "@typescript-eslint/eslint-plugin": "^4.19.0", "@typescript-eslint/parser": "^4.19.0", + "autoprefixer": "^10.2.5", + "cssnano": "^5.0.1", "eslint": "^7.22.0", "eslint-config-prettier": "^8.1.0", "eslint-plugin-svelte3": "^3.1.0", + "postcss": "^8.2.10", + "postcss-load-config": "^3.0.1", "prettier": "~2.2.1", "prettier-plugin-svelte": "^2.2.0", "svelte": "^3.29.0", "svelte-preprocess": "^4.7.1", + "tailwindcss": "^2.1.1", "tslib": "^2.0.0", "typescript": "^4.0.0", - "vite": "^2.1.0", - "autoprefixer": "^10.2.5", - "cssnano": "^5.0.1", - "postcss": "^8.2.10", - "postcss-load-config": "^3.0.1", - "tailwindcss": "^2.1.1" + "vite": "^2.1.0" }, "type": "module" } diff --git a/svelte.config.cjs b/svelte.config.cjs index 17085c1..42a9204 100644 --- a/svelte.config.cjs +++ b/svelte.config.cjs @@ -1,5 +1,6 @@ const sveltePreprocess = require('svelte-preprocess') -const node = require('@sveltejs/adapter-node') +// const node = require('@sveltejs/adapter-node') +const vercel = require('@sveltejs/adapter-vercel'); const pkg = require('./package.json') /** @type {import('@sveltejs/kit').Config} */ @@ -19,7 +20,8 @@ module.exports = { // By default, `npm run build` will create a standard Node app. // You can create optimized builds for different platforms by // specifying a different adapter - adapter: node(), + // adapter: node(), + adapter: vercel(), // hydrate the
element in src/app.html target: '#svelte',