mirror of https://github.com/sveltejs/svelte
commit
56afb9c70a
@ -0,0 +1,28 @@
|
|||||||
|
name: Docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- site/content/**
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Deploy docs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: my-app-install token
|
||||||
|
id: github-app
|
||||||
|
uses: getsentry/action-github-app-token@v1
|
||||||
|
with:
|
||||||
|
app_id: ${{ secrets.GH_APP_ID }}
|
||||||
|
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
||||||
|
|
||||||
|
- name: run deploy docs workflow
|
||||||
|
uses: 'sveltejs/action-deploy-docs/dispatch@main'
|
||||||
|
with:
|
||||||
|
repo: 'svelte'
|
||||||
|
branch: 'master'
|
||||||
|
docs_path: 'site/content'
|
||||||
|
token: ${{ steps.github-app.outputs.token }}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
|||||||
NODE_ENV=
|
NODE_ENV=
|
||||||
|
|
||||||
PORT=
|
PORT=3000
|
||||||
BASEURL=
|
BASEURL=http://localhost:3000
|
||||||
GITHUB_CLIENT_ID=
|
GITHUB_CLIENT_ID=
|
||||||
GITHUB_CLIENT_SECRET=
|
GITHUB_CLIENT_SECRET=
|
||||||
MAPBOX_ACCESS_TOKEN=
|
VITE_MAPBOX_ACCESS_TOKEN=
|
||||||
|
|
||||||
PGHOST=hostname
|
PGHOST=localhost
|
||||||
PGPORT=port
|
PGPORT=5432
|
||||||
PGUSER=username
|
PGUSER=username
|
||||||
PGPASSWORD=password
|
PGPASSWORD=password
|
||||||
PGDATABASE=database_name
|
PGDATABASE=database_name
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
sudo: false
|
|
||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- "stable"
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- BUILD_TIMEOUT=10000
|
|
||||||
install:
|
|
||||||
- npm install
|
|
||||||
- npm install cypress
|
|
||||||
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
version: "{build}"
|
|
||||||
|
|
||||||
shallow_clone: true
|
|
||||||
|
|
||||||
init:
|
|
||||||
- git config --global core.autocrlf false
|
|
||||||
|
|
||||||
build: off
|
|
||||||
|
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
# node.js
|
|
||||||
- nodejs_version: stable
|
|
||||||
|
|
||||||
install:
|
|
||||||
- ps: Install-Product node $env:nodejs_version
|
|
||||||
- npm install
|
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
---
|
||||||
|
title: What's new in Svelte: August 2021
|
||||||
|
description: Shadow DOM, export and await - oh my!
|
||||||
|
author: Daniel Sandoval
|
||||||
|
authorURL: https://desandoval.net
|
||||||
|
---
|
||||||
|
|
||||||
|
From The Changelog ([JS Party Ep. 182](https://changelog.com/jsparty/182)) to Svelte Radio (Episodes [29](https://share.transistor.fm/s/adc23e84) and [30](https://share.transistor.fm/s/6316622d)), it seems that folks couldn't help but talk about Svelte, this month! Also, shadow DOM support and new export and await functionality are new in Svelte.
|
||||||
|
|
||||||
|
## New in Svelte
|
||||||
|
|
||||||
|
July was the most active month for the Svelte core repo since late 2019 as we really worked to reduce the number of outstanding PRs and saw the release of Svelte 3.39.0, 3.40.0, and 3.41.0. Tons of bug fixes were added as well as the following new features:
|
||||||
|
|
||||||
|
- The `|trusted` event modifier allows you to check if an event is trusted before it's called ([#6137](https://github.com/sveltejs/svelte/issues/6137))
|
||||||
|
- The new `svelte/ssr` package to support work on improving SvelteKit SSR ([#6416](https://github.com/sveltejs/svelte/pull/6416))
|
||||||
|
- A new `errorMode` compiler option to support improved preprocessing of TypeScript files ([#6194](https://github.com/sveltejs/svelte/pull/6194))
|
||||||
|
- You can now specify a `ShadowRoot` as the `target` when creating a component - making it possible to render Svelte components inside the shadow DOM ([#5869](https://github.com/sveltejs/svelte/issues/5869))
|
||||||
|
- The `export { ... } from` ([#2214](https://github.com/sveltejs/svelte/issues/2214)), `export let { ... } =` ([#5612](https://github.com/sveltejs/svelte/issues/5612)) and `{#await ... then/catch}` ([#6270](https://github.com/sveltejs/svelte/issues/6270)) syntaxes are all now supported in Svelte components
|
||||||
|
|
||||||
|
For a full list of features and bug fixes, check out the [Svelte changelog](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md).
|
||||||
|
|
||||||
|
## SvelteKit Updates
|
||||||
|
- `prerender.force` is now `prerender.onError` which lets you fine-tune which errors fail the build and which do not ([#2007](https://github.com/sveltejs/kit/pull/2007))
|
||||||
|
- esbuild's configuration is now exposed for use with SvelteKit adapters ([#1914](https://github.com/sveltejs/kit/pull/1914))
|
||||||
|
- Error messages are friendlier now for common config errors ([#1910](https://github.com/sveltejs/kit/pull/1910)) and compiler errors ([#1827](https://github.com/sveltejs/kit/pull/1827))
|
||||||
|
- Cookies will only be passed through if the target host is the same as the SvelteKit application or a more specific subdomain of it ([#1847](https://github.com/sveltejs/kit/pull/1847))
|
||||||
|
- index.js exports will now be changed to directory exports when packaging - making for nicer imports ([#1905](https://github.com/sveltejs/kit/pull/1905))
|
||||||
|
- Vite.js's `mode` is now exposed from `$app/env` ([#1789](https://github.com/sveltejs/kit/pull/1789))
|
||||||
|
- Better types across the board ([#1778](https://github.com/sveltejs/kit/pull/1778), [#1791](https://github.com/sveltejs/kit/pull/1791), [#1646](https://github.com/sveltejs/kit/pull/1646))
|
||||||
|
|
||||||
|
To see all updates to SvelteKit, check out the [SvelteKit changelog](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md).
|
||||||
|
|
||||||
|
## Features & bug fixes from around svelte/*
|
||||||
|
- Language Tools now better support the "Workplace Trust" functionality (used in VS Code)
|
||||||
|
- In svelte2tsx, ambient type declarations are now renamed to avoid conflicting declarations in the future. Users are now expected to provide the ambient type definitions themselves - fixing JS output
|
||||||
|
- Sapper released v0.29.2 which fixes regex routes, status codes when requesting a directory, and exports when a user has not provided a `base` tag ([changelog](https://github.com/sveltejs/sapper/blob/master/CHANGELOG.md))
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Community Showcase
|
||||||
|
|
||||||
|
**Apps & Sites**
|
||||||
|
- [Parsnip](https://www.parsnip.ai/) is a mobile-first, progressive-web-app that helps you to learn to cook at home. Check out the [conversation on Reddit](https://www.reddit.com/r/sveltejs/comments/oearb9/learning_to_cook_at_home_with_parsnip_built/) for all the geeky details.
|
||||||
|
- [Central Bank Digital Currency (CBDC) tracker](https://www.atlanticcouncil.org/cbdctracker/) is a site that keeps track of how countries around the world are adopting digital currencies.
|
||||||
|
- [Svelte Commerce](https://github.com/itswadesh/svelte-commerce) is an advanced frontend platform for eCommerce based on Sveltekit.
|
||||||
|
- [neovimcraft](https://neovimcraft.com/) is a SvelteKit site dedicated to neovim plugins
|
||||||
|
|
||||||
|
**Looking for a Svelte project to work on? Interested in helping make Svelte's presence on the web better?** Check out [the list of open issues](https://github.com/svelte-society/sveltesociety-2021/issues) if you'd like to contribute to the Svelte Society rewrite in SvelteKit.
|
||||||
|
|
||||||
|
**Educational Content**
|
||||||
|
- [How I Built a Cross-Platform Desktop Application with Svelte, Redis, and Rust](https://css-tricks.com/how-i-built-a-cross-platform-desktop-application-with-svelte-redis-and-rust/) is a blog post by Luke Edwards, Svelte maintainer and Developer Advocate from Cloudflare.
|
||||||
|
- [How to Create a Blog with SvelteKit and Strapi](https://strapi.io/blog/how-to-create-a-blog-with-svelte-kit-strapi) is a step-by-step tutorial by Aarnav Pai from Strapi
|
||||||
|
- [Sveltekit Markdown Blog](https://www.youtube.com/watch?v=sKKgT0SEioI&list=PLm_Qt4aKpfKgonq1zwaCS6kOD-nbOKx7V) is a YouTube tutorial series by WebJeda.
|
||||||
|
- [Using Custom Elements in Svelte](https://css-tricks.com/using-custom-elements-in-svelte/) is a deep dive into custom elements by Geoff Rich.
|
||||||
|
- [learn / graphql / svelte](https://hasura.io/learn/graphql/svelte-apollo/introduction/) is a free 2-hour GraphQL course course from Hasura.
|
||||||
|
- [How to add Magic Link to a SvelteKit application](https://magic.link/posts/magic-svelte) is a guide to the popular password-less login pattern.
|
||||||
|
|
||||||
|
**Libraries, Tools & Components**
|
||||||
|
- [Svelte-Capacitor](https://github.com/drannex42/svelte-capacitor/) just released v2.0.0 - making it even easier to build hybrid mobile apps for iOS and Android using Svelte and Capacitor with near native performance.
|
||||||
|
- [svelte-remixicon](https://github.com/ABarnob/svelte-remixicon) is an icon library for Svelte based on Remix Icon, consisting of more than 2000 icons.
|
||||||
|
- [SveltePress](https://github.com/GeopJr/SveltePress) is a documentation tool built on top of SvelteKit.
|
||||||
|
- [Svelte Starter Kit](https://github.com/one-aalam/svelte-starter-kit/tree/auth-supabase) is a boilerplate to quckly get up and running with Svelte, with Auth and User Profiles powered by Supabase.
|
||||||
|
- [Kahi UI](https://github.com/novacbn/kahi-ui) is a Svelte-first UI kit with Dark Mode built-in.
|
||||||
|
- [typesafe-i18n](https://github.com/ivanhofer/typesafe-i18n) is an opinionated, fully type-safe, lightweight localization library for TypeScript and JavaScript projects with no external dependencies.
|
||||||
|
|
||||||
|
Check out the community site [sveltesociety.dev](https://sveltesociety.dev/templates/) for more templates, adders and adapters from across the Svelte ecosystem.
|
||||||
|
|
||||||
|
|
||||||
|
## See you next month!
|
||||||
|
|
||||||
|
Want more updates? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs)!
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
---
|
||||||
|
title: What's new in Svelte: September 2021
|
||||||
|
description: StackOverflow's most loved web framework
|
||||||
|
author: Daniel Sandoval
|
||||||
|
authorURL: https://desandoval.net
|
||||||
|
---
|
||||||
|
|
||||||
|
This month, Svelte was [voted StackOverflow's most loved web framework](https://insights.stackoverflow.com/survey/2021#section-most-loved-dreaded-and-wanted-web-frameworks), Tan Li Hau [talked to Svelte Radio](https://share.transistor.fm/s/84c7521b) about his [Svelte-filled YouTube channel](https://www.youtube.com/channel/UCbmC3HP3FaAFdcZkui8YoMQ), and SvelteKit made even more progress towards its 1.0 release!
|
||||||
|
|
||||||
|
## New in Svelte
|
||||||
|
|
||||||
|
- `use:actions` can now be used on `<svelte:body>` (**3.42.0**)
|
||||||
|
- `HTMLElement`, `SVGElement` (**3.42.2**) and `BigInt` (**3.42.3**) are now known globals
|
||||||
|
- There is less code in Svelte's output thanks to the following improvements in **3.42.2**:
|
||||||
|
- Whitespace is now collapsed in class and style attributes
|
||||||
|
- Hydrated components have been updated to only rely upon helpers for creating the types of elements present in the component
|
||||||
|
- Scaling is now accounted for in `flip` animations (**3.42.2**)
|
||||||
|
- All `<option>`s in a `<select>` are now deselected when the bound value doesn't match any of them (**3.42.2**)
|
||||||
|
|
||||||
|
For a full list of features and bug fixes, check out the [Svelte changelog](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md).
|
||||||
|
|
||||||
|
## SvelteKit Updates
|
||||||
|
|
||||||
|
Svelte maintainers are [looking for help getting SvelteKit to 1.0](https://github.com/sveltejs/kit/issues/2100). We've knocked out over 100 issues that were on the 1.0 milestone. There's only a couple dozen left and we'd love a hand making that list a bit shorter!
|
||||||
|
|
||||||
|
If you'd like to help, please consider working on any of the [1.0 milestone issues](https://github.com/sveltejs/kit/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0).
|
||||||
|
|
||||||
|
The focus this past month was on continuing to iron out any kinks, with well over 100 PRs merged. A few new features went in as well...
|
||||||
|
|
||||||
|
- SvelteKit will now detect if a prerendered app is trying to access a query parameter and return an error instead of failing silently ([#2104](https://github.com/sveltejs/kit/pull/2104))
|
||||||
|
- `adapter-node` now lets you [add the Kit middleware to your own server](https://kit.svelte.dev/faq#integrations) for use with other middleware. You can also [add middleware in dev mode](https://kit.svelte.dev/faq#how-do-i-use-x-with-sveltekit-how-do-i-use-middleware) with more improvements to come in this area
|
||||||
|
- The new [`sequence` helper lets you chain together multiple `handle` calls](https://kit.svelte.dev/docs#modules-sveltejs-kit-hooks)
|
||||||
|
- A new [`handleError` hook](https://kit.svelte.dev/docs#hooks-handleerror) gives you the option to send data to an error tracking service, or to customise the formatting before printing the error to the console.
|
||||||
|
- `adapter-node` can now listen on socket path ([#2048](https://github.com/sveltejs/kit/pull/2048))
|
||||||
|
|
||||||
|
To see all updates to SvelteKit, check out the [SvelteKit changelog](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md).
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Community Showcase
|
||||||
|
|
||||||
|
**Apps & Sites**
|
||||||
|
- [macos-web](https://github.com/PuruVJ/macos-web) by @puruvjdev has been rebuilt with Svelte from the ground up. Check out all the details in this [Twitter thread](https://twitter.com/puruvjdev/status/1426267327687847939)
|
||||||
|
- [Brave Search](https://search.brave.com/) is using Svelte
|
||||||
|
- [exatorrent](https://github.com/varbhat/exatorrent) is a self-hostable, easy-to-use, lightweight and feature-rich torrent client written in Go and Svelte
|
||||||
|
- [json2TsTypes](https://github.com/jatinhemnani01/json2TsTypes) is a simple tool which will convert your JSON to Typescript Types/Interfaces
|
||||||
|
- [Histogram.dev](https://histogram.dev/) generates histograms for each feature in a CSV
|
||||||
|
- [cybernetic.dev](https://cybernetic.dev/) is a collection of data-centric UI experiments made while learning Svelte
|
||||||
|
- [LunaNotes](https://chrome.google.com/webstore/detail/lunanotes-youtube-video-n/oehoffnnkgcdacmbkhmlbjedinpampak?hl=en) is a Chrome extension to help with taking YouTube video notes
|
||||||
|
- [theia.games](https://theia.games/#dev)'s built-in 3D environment editor lets you create a VR world with a menu built in Svelte
|
||||||
|
- [Ferrum](https://github.com/probablykasper/ferrum) is a music library and player available for Mac, Windows or Linux
|
||||||
|
- [Fluid Earth](https://github.com/byrd-polar/fluid-earth) is an interactive WebGL application for visualizing Earth's atmosphere and oceans
|
||||||
|
|
||||||
|
**Looking for a Svelte project to work on? Interested in helping make Svelte's presence on the web better?** Check out [the list of open issues](https://github.com/svelte-society/sveltesociety-2021/issues) if you'd like to contribute to the Svelte Society rewrite in SvelteKit.
|
||||||
|
|
||||||
|
**Educational Content**
|
||||||
|
- [Tauri with Standard Svelte or SvelteKit](https://medium.com/@cazanator/tauri-with-standard-svelte-or-sveltekit-ad7f103c37e7) walks through how to setup Svelte with Tauri, a new light-weight framework for developing cross-platform hybrid desktop applications
|
||||||
|
- [Svelte - Web App Development Reimagined [An Intro to Svelte]](https://www.youtube.com/watch?v=4CGzFwHoD0A&list=PLEx5khR4g7PKSASVAXXiAhkyx02_OeruP) is a great intro talk from the goto; conference
|
||||||
|
- [LevelUpTuts - Even More 5 Things I Like More In Svelte Than React](https://www.youtube.com/watch?v=ISmnG2sIOeM) highlights Svelte's approach to refs (don't need them), meta tags and more
|
||||||
|
- [State Management in Svelte Applications](https://auth0.com/blog/state-management-in-svelte-applications/) is a tutorial on how to use the Svelte state management store to manage state in Svelte applications
|
||||||
|
- [Migrating from Sapper to SvelteKit](https://shipbit.de/blog/migrating-from-sapper-to-svelte-kit/) is a review and retrospective of ShipBit's migration from Sapper
|
||||||
|
|
||||||
|
**Libraries, Tools & Components**
|
||||||
|
- [svelte-stripe-js](https://github.com/joshnuss/svelte-stripe-js) is everything you need to add Stripe to your Svelte project. 100% SvelteKit compatible
|
||||||
|
- [svelte-steps](https://github.com/shaozi/svelte-steps) is a customizable step component written in Svelte
|
||||||
|
- [simple-optics-module](https://gitlab.com/Samzelot/simple-optics-module) is an online open source optics tool for experimenting and teaching geometrical optics
|
||||||
|
- [inlang](https://github.com/samuelstroschein/inlang) is an internationalization (i18n) tool for SvelteKit apps
|
||||||
|
- [Sveno](https://github.com/pocinnovation/sveno) is a component transpiler that transforms React components to Svelte components
|
||||||
|
- [svelte-useactions](https://github.com/paolotiu/svelte-useactions) is a fully typed library for passing actions to components
|
||||||
|
- [Svelte-Element-Query](https://github.com/leveluptuts/Svelte-Element-Query) is a 322b library/action for element queries
|
||||||
|
- [svelte-meta-tags](https://github.com/oekazuma/svelte-meta-tags) is a plug-in that makes managing SEO easier in Svelte projects
|
||||||
|
- [svelte-domtree](https://github.com/alex-knyaz/svelte-domtree) lets you visualize the DOM - similar to DOM tree in Chrome DevTools
|
||||||
|
- [Diffx](https://github.com/jbjorge/diffx/tree/master/svelte), a cross-framework state management library, just added Svelte support
|
||||||
|
- [svelte-ionic-starter](https://github.com/Zettexe/svelte-ionic-starter) a project template for Svelte + Ionic + CapacitorJS apps with live reload and iOS/Android build targets
|
||||||
|
- [demo-sveltekit-sanity](https://github.com/stephane-vanraes/demo-sveltekit-sanity/) is a starter kit for SvelteKit and Sanity, an open source React CMS
|
||||||
|
|
||||||
|
Check out the community site [sveltesociety.dev](https://sveltesociety.dev/templates/) for more templates, adders and adapters from across the Svelte ecosystem.
|
||||||
|
|
||||||
|
|
||||||
|
## See you next month!
|
||||||
|
|
||||||
|
Want more updates? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs)!
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
---
|
||||||
|
title: What's new in Svelte: October 2021
|
||||||
|
description: A whole year of "What's new in Svelte"
|
||||||
|
author: Daniel Sandoval
|
||||||
|
authorURL: https://desandoval.net
|
||||||
|
---
|
||||||
|
|
||||||
|
Hey y'all 👋 It's been 1 year since "What's new in Svelte" started being cross-posted to the Svelte blog. I wanted to take this moment at the top to thank all of you for reading and for all the contributors every month. From the maintainers to everyone who posts their work in the Discord and Reddit, it's amazing to witness all the effort that goes into making the Svelte community great.
|
||||||
|
|
||||||
|
Keep up the good work, everyone! Now, let's dive into this month's news...
|
||||||
|
|
||||||
|
## New around Svelte
|
||||||
|
|
||||||
|
- New additions to Svelte's export map now expose no-op versions of lifecycle functions for SSR (Svelte **3.43.0**)
|
||||||
|
- Custom components with a `src` attribute no longer break `svelte-native` builds (Svelte **3.42.4**)
|
||||||
|
- Svelte plugin users without [the TypeScript plugin](https://www.npmjs.com/package/typescript-svelte-plugin) enabled will now be prompted to enable it. It enhances TypeScript and JavaScript files with additional intellisense to interact with Svelte files. [Please leave feedback](https://github.com/sveltejs/language-tools/issues/580) if you are using it (Svelte extensions **105.4.0**)
|
||||||
|
- Event modifiers have been added to intellisense as autocomplete and hover info (Svelte extensions **105.4.0**)
|
||||||
|
- TypeScript users no longer have to strictly separate type imports and value imports when using Svelte version 3.39 or higher and `svelte-preprocess` version 4.9.5 or higher. This means you can now write `import { MyInterface, myValue } from './somewhere'` instead of `import type { MyInterface } from './somewhere'; import { myValue } from './somewhere'`. Huge thanks to community member [@SomaticIT](https://github.com/SomaticIT) who mainly implemented this!
|
||||||
|
|
||||||
|
For a full list of features and bug fixes, check out the [Svelte changelog](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md).
|
||||||
|
|
||||||
|
## SvelteKit Updates
|
||||||
|
|
||||||
|
Nearly 100 PRs committed again this past month, but there's still lots to do and Svelte maintainers are [looking for help getting SvelteKit to 1.0](https://github.com/sveltejs/kit/issues/2100). Antony said it well in a [recent comment](https://github.com/sveltejs/kit/issues/2100#issuecomment-895446285) on the issue:
|
||||||
|
|
||||||
|
> If you think you are too n00b to contribute (you're not), then add tests, or write tests for the feature you want to add, before you add it! Start small, and learn the codebase that way.
|
||||||
|
|
||||||
|
If you'd like to help, please consider working on any of the [1.0 milestone issues labeled with "help wanted"](https://github.com/sveltejs/kit/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0+label%3A%22help+wanted%22).
|
||||||
|
|
||||||
|
Notable SvelteKit improvements this month include...
|
||||||
|
|
||||||
|
- Service workers are now allowed to access files using the `$lib` alias ([#2326](https://github.com/sveltejs/kit/pull/2326))
|
||||||
|
- Svelte libraries should now work out-of-the-box without any Vite configuration ([#2343](https://github.com/sveltejs/kit/pull/2343))
|
||||||
|
- Improvements to package exports field ([#2345](https://github.com/sveltejs/kit/pull/2345) and [#2327](https://github.com/sveltejs/kit/pull/2327))
|
||||||
|
- [breaking] The `prerender.pages` config option has been renamed to `prerender.entries` ([#2380](https://github.com/sveltejs/kit/pull/2380))
|
||||||
|
- A new generic argument has beend added to allow typing Body from hooks ([#2413](https://github.com/sveltejs/kit/pull/2413))
|
||||||
|
- The `svelte` field will be added to package.json when running the package command ([#2431](https://github.com/sveltejs/kit/pull/2431))
|
||||||
|
- [breaking] The `context` parameter of the load function was renamed to `stuff` ([#2439](https://github.com/sveltejs/kit/pull/2439))
|
||||||
|
- Added an `entryPoint` option for building a custom server with `adapter-node` ([#2414](https://github.com/sveltejs/kit/pull/2414))
|
||||||
|
- `vite-plugin-svelte` improved support for [useVitePreprocess](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#usevitepreprocess), which uses Vite to automatically preprocess TypeScript, PostCSS, Scss, etc in Svelte components ([#173](https://github.com/sveltejs/vite-plugin-svelte/pull/173))
|
||||||
|
|
||||||
|
To see all updates to SvelteKit, check out the [SvelteKit changelog](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md).
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Community Showcase
|
||||||
|
|
||||||
|
**Apps & Sites**
|
||||||
|
- [radiofrance](https://www.radiofrance.fr/) just migrated their website to SvelteKit
|
||||||
|
- [FLAYKS](https://flayks.com/) is the portfolio site for Félix Péault made with SvelteKit, Sanity, and Anime.js
|
||||||
|
- [hirehive](https://www.hirehive.com/) is a candidate and job tracking site
|
||||||
|
- [Microsocial](https://microsocial.xyz/) is an experimental Peer-to-Peer Social Platform
|
||||||
|
- [Dylan Ipsum](https://www.dylanlyrics.app/) is a random text generator to replace lorem ipsum with Bob Dylan lyrics
|
||||||
|
- [Chip8 Svelte](https://github.com/mikeyhogarth/chip8-svelte) is a CHIP-8 emulator frontend, built on top of CHIP8 Typescript
|
||||||
|
|
||||||
|
**Looking for a Svelte project to work on? Interested in helping make Svelte's presence on the web better?** Check out [the list of open issues](https://github.com/svelte-society/sveltesociety-2021/issues) if you'd like to contribute to the Svelte Society rewrite in SvelteKit.
|
||||||
|
|
||||||
|
**Podcasts Featuring Svelte**
|
||||||
|
- [Syntax Podast: From React to SvelteKit](https://podcasts.apple.com/us/podcast/from-react-to-sveltekit/id1253186678?i=1000536276106) Scott talks with Wes about moving Level Up Tutorials from React to SvelteKit — why he did it, how, benefits, things to watch out for, and more!
|
||||||
|
- [Web Rush Podcast: Svelte Tools and Svelte Society](https://www.webrush.io/episodes/episode-150-svelte-tools-and-svelte-society) Kevin Åberg Kultalahti talks about what Svelte Society is, what he's excited about with Svelte, how important documentation is to any product, and much _much_ more
|
||||||
|
- [Svelte: The Compiled Future of Front End](https://www.arahansen.com/the-compiled-future-of-front-end/) details the history of component-based frontends and how a compiler changes everything
|
||||||
|
- [Svelte Radio: Contributing to Svelte with Martin 'Grygrflzr' Krisnanto Putra](https://share.transistor.fm/s/10aa305c) Grygrflzr shares his journey to becoming a maintainer and his views on React, Vite and a host of other things
|
||||||
|
- [Svelte Radio: Routify 3 with Jake and Willow](https://share.transistor.fm/s/10aa305c) the Svelte Radio crew sits down with the maintainers of Routify and discusses the just-released Routify 3
|
||||||
|
- [JS Party: 1Password](https://twitter.com/geoffrich_/status/1441816829853253640?s=20) mentioned on the latest episode of The Changelog's JS Party that they use Svelte to power their in-page suggestions
|
||||||
|
|
||||||
|
**Educational Content**
|
||||||
|
- [How I built a blog with Svelte and SvelteKit](https://fantinel.dev/blog-development-sveltekit/) is an introduction to Svelte, SvelteKit and Progressive Enhancement with code examples
|
||||||
|
- [I built a decentralized chat dapp](https://www.youtube.com/watch?v=J5x3OMXjgMc) is a tutorial on how to use popular web3 technologies like GUN to build a decentralized web app (dapp)
|
||||||
|
- [Writing a Svelte Store with TypeScript](https://javascript.plainenglish.io/writing-a-svelte-store-with-typescript-22fa1c901a4) is a deep dive into writing Svelte stores with TypeScript
|
||||||
|
- [How Svelte scopes component styles](https://geoffrich.net/posts/svelte-scoped-styles/) explains scoping using classes and more complex CSS specifiers
|
||||||
|
- [SvelteKit Hooks](https://www.youtube.com/watch?v=RarufLoEL08) shows how to use hooks.js in Sveltekit.. When you're done, check out [Part 2](https://www.youtube.com/watch?v=RmIBG3G0-VY)
|
||||||
|
- [An early look at SvelteKit](https://www.infoworld.com/article/3630395/an-early-look-at-sveltekit.html) is a post from Infoworld walking through the features and onboarding of SvelteKit
|
||||||
|
|
||||||
|
**Libraries, Tools & Components**
|
||||||
|
- [sveltekit-netlify-cms](https://github.com/buhrmi/sveltekit-netlify-cms) is a SvelteKit skeleton app configured for use with Netlify CMS
|
||||||
|
- [SvelteFireTS](https://github.com/jacobbowdoin/sveltefirets) is a SvelteKit + Typescript + Firebase library inspired by Fireship.io
|
||||||
|
- [stores-x](https://github.com/Anyass3/stores-x) lets you use Svelte stores just like vueX
|
||||||
|
- [sveltekit-snippets](https://github.com/stordahl/sveltekit-snippets) is a VSCode extension that provides snippets for common patterns in SvelteKit & Vanilla Svelte
|
||||||
|
- [svelte-xactor](https://github.com/wobsoriano/svelte-xactor) is a middleware that allows you to easily convert your xactor machines into a global store that implements the store contract
|
||||||
|
- [vite-plugin-pages-svelte](https://github.com/aldy505/vite-plugin-pages-svelte) is a vite plugin for automatic filesystem-based routing
|
||||||
|
- [sveltio](https://www.npmjs.com/package/sveltio) is a Svelte wrapper for valtio - a proxy-state library
|
||||||
|
- [svelte-transition-classes](https://github.com/rmarscher/svelte-transition-classes) is a custom Svelte transition for adding and swapping CSS classes
|
||||||
|
- [Svelte-Boring-Avatars](https://github.com/paolotiu/svelte-boring-avatars) is Svelte port of the popular [Boring Avatars](https://github.com/boringdesigners/boring-avatars) React project
|
||||||
|
- [Svelte DataTables](https://github.com/homescriptone/svelte-datatables) brings DataTable, a popular JavaScript library allowing you to easily display your data in a user-friendly table, into your Svelte project.
|
||||||
|
- [focus-svelte](https://github.com/chanced/focus-svelte) is a focus trap for Svelte with zero dependencies
|
||||||
|
- [filedrop-svelte](https://github.com/chanced/filedrop-svelte) is a file dropzone action & component for Svelte
|
||||||
|
|
||||||
|
|
||||||
|
Check out the community site [sveltesociety.dev](https://sveltesociety.dev/templates/) for more templates, adders and adapters from across the Svelte ecosystem.
|
||||||
|
|
||||||
|
|
||||||
|
## Before you go, answer the call for speakers!
|
||||||
|
|
||||||
|
Svelte Summit Fall 2021 (happening 20 November 2021) is looking for speakers. Submit your talk propsoal before 30 October... all are welcome to present and attend.
|
||||||
|
|
||||||
|
### More info on the [sessionize site](https://sessionize.com/svelte-summit-fall-2021/)
|
||||||
|
|
||||||
|
Can't wait for the summit? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs)!
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
question: Is there a tool to automatically format my .svelte files?
|
||||||
|
---
|
||||||
|
|
||||||
|
You can use prettier with the [prettier-plugin-svelte](https://www.npmjs.com/package/prettier-plugin-svelte) plugin.
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
version: "3.0"
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:13.4
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=${PGDATABASE}
|
||||||
|
- POSTGRES_USER=${PGUSER}
|
||||||
|
- POSTGRES_PASSWORD=${PGPASSWORD}
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "4000:8080"
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,122 +0,0 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import babel from '@rollup/plugin-babel';
|
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
|
||||||
import json from '@rollup/plugin-json';
|
|
||||||
import replace from '@rollup/plugin-replace';
|
|
||||||
import resolve from '@rollup/plugin-node-resolve';
|
|
||||||
import svelte from 'rollup-plugin-svelte';
|
|
||||||
import { terser } from 'rollup-plugin-terser';
|
|
||||||
import config from 'sapper/config/rollup.js';
|
|
||||||
import pkg from './package.json';
|
|
||||||
|
|
||||||
const mode = process.env.NODE_ENV;
|
|
||||||
const dev = mode === 'development';
|
|
||||||
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
|
|
||||||
|
|
||||||
if (!dev && !process.env.MAPBOX_ACCESS_TOKEN) {
|
|
||||||
throw new Error('MAPBOX_ACCESS_TOKEN is missing. Please add the token in the .env file before generating the production build.');
|
|
||||||
}
|
|
||||||
|
|
||||||
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);
|
|
||||||
const dedupe = importee => importee === 'svelte' || importee.startsWith('svelte/');
|
|
||||||
|
|
||||||
export default {
|
|
||||||
client: {
|
|
||||||
input: config.client.input(),
|
|
||||||
output: config.client.output(),
|
|
||||||
plugins: [
|
|
||||||
replace({
|
|
||||||
'process.browser': true,
|
|
||||||
'process.env.NODE_ENV': JSON.stringify(mode),
|
|
||||||
'process.env.MAPBOX_ACCESS_TOKEN': JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN)
|
|
||||||
}),
|
|
||||||
svelte({
|
|
||||||
compilerOptions: {
|
|
||||||
dev,
|
|
||||||
hydratable: true
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
resolve({
|
|
||||||
browser: true,
|
|
||||||
dedupe
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
json(),
|
|
||||||
|
|
||||||
legacy && babel({
|
|
||||||
extensions: ['.js', '.mjs', '.html', '.svelte'],
|
|
||||||
babelHelpers: 'runtime',
|
|
||||||
exclude: ['node_modules/@babel/**'],
|
|
||||||
presets: [
|
|
||||||
['@babel/preset-env', {
|
|
||||||
targets: '> 0.25%, not dead'
|
|
||||||
}]
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
'@babel/plugin-syntax-dynamic-import',
|
|
||||||
['@babel/plugin-transform-runtime', {
|
|
||||||
useESModules: true
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
|
|
||||||
!dev && terser({
|
|
||||||
module: true
|
|
||||||
})
|
|
||||||
],
|
|
||||||
|
|
||||||
preserveEntrySignatures: false,
|
|
||||||
onwarn
|
|
||||||
},
|
|
||||||
|
|
||||||
server: {
|
|
||||||
input: config.server.input(),
|
|
||||||
output: config.server.output(),
|
|
||||||
plugins: [
|
|
||||||
replace({
|
|
||||||
'process.browser': false,
|
|
||||||
'process.env.NODE_ENV': JSON.stringify(mode)
|
|
||||||
}),
|
|
||||||
svelte({
|
|
||||||
compilerOptions: {
|
|
||||||
dev,
|
|
||||||
generate: 'ssr',
|
|
||||||
hydratable: true
|
|
||||||
},
|
|
||||||
emitCss: false
|
|
||||||
}),
|
|
||||||
resolve({
|
|
||||||
dedupe
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
json()
|
|
||||||
],
|
|
||||||
external: [
|
|
||||||
'yootils',
|
|
||||||
'codemirror',
|
|
||||||
...Object.keys(pkg.dependencies || {}).concat(
|
|
||||||
require('module').builtinModules || Object.keys(process.binding('natives'))
|
|
||||||
)
|
|
||||||
],
|
|
||||||
|
|
||||||
preserveEntrySignatures: 'strict',
|
|
||||||
onwarn
|
|
||||||
},
|
|
||||||
|
|
||||||
serviceworker: {
|
|
||||||
input: config.serviceworker.input(),
|
|
||||||
output: config.serviceworker.output(),
|
|
||||||
plugins: [
|
|
||||||
resolve(),
|
|
||||||
replace({
|
|
||||||
'process.browser': true,
|
|
||||||
'process.env.NODE_ENV': JSON.stringify(mode)
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
!dev && terser()
|
|
||||||
],
|
|
||||||
|
|
||||||
preserveEntrySignatures: false,
|
|
||||||
onwarn
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
const sh = require('shelljs');
|
import sh from 'shelljs';
|
||||||
|
|
||||||
sh.rm('-rf', 'static/workers');
|
sh.rm('-rf', 'static/workers');
|
||||||
sh.cp('-r', 'node_modules/@sveltejs/svelte-repl/workers', 'static');
|
sh.cp('-r', 'node_modules/@sveltejs/svelte-repl/workers', 'static');
|
||||||
|
|||||||
@ -0,0 +1,63 @@
|
|||||||
|
import 'dotenv/config';
|
||||||
|
import fs from 'fs';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
import Jimp from 'jimp';
|
||||||
|
import { dirname } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
|
||||||
|
const force = process.env.FORCE_UPDATE === 'true';
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
process.chdir(__dirname);
|
||||||
|
|
||||||
|
const outputFile = `../src/routes/_donors.js`;
|
||||||
|
if (!force && fs.existsSync(outputFile)) {
|
||||||
|
console.info(`[update/donors] ${outputFile} exists. Skipping`);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SIZE = 64;
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const res = await fetch('https://opencollective.com/svelte/members/all.json');
|
||||||
|
const donors = await res.json();
|
||||||
|
|
||||||
|
const unique = new Map();
|
||||||
|
donors.forEach(d => unique.set(d.profile, d));
|
||||||
|
|
||||||
|
let backers = [...unique.values()]
|
||||||
|
.filter(({ role }) => role === 'BACKER')
|
||||||
|
.sort((a, b) => b.totalAmountDonated - a.totalAmountDonated);
|
||||||
|
|
||||||
|
const included = [];
|
||||||
|
for (let i = 0; i < backers.length; i += 1) {
|
||||||
|
const backer = backers[i];
|
||||||
|
console.log(`${i} / ${backers.length}: ${backer.name}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const image_data = await fetch(backer.image);
|
||||||
|
const buffer = await image_data.arrayBuffer();
|
||||||
|
const image = await Jimp.read(buffer);
|
||||||
|
image.resize(SIZE, SIZE);
|
||||||
|
included.push({ backer, image });
|
||||||
|
} catch( err) {
|
||||||
|
console.log(`Skipping ${backer.name}: no image data`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const sprite = new Jimp(SIZE * included.length, SIZE);
|
||||||
|
for (let i = 0; i < included.length; i += 1) {
|
||||||
|
sprite.composite(included[i].image, i * SIZE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
await sprite.quality(80).write(`../static/donors.jpg`);
|
||||||
|
// TODO: Optimizing the static/donors.jpg image should probably get automated as well
|
||||||
|
console.log('remember to additionally optimize the resulting /static/donors.jpg image file via e.g. https://squoosh.app ');
|
||||||
|
|
||||||
|
const str = `[\n\t${included.map(a => `${JSON.stringify(a.backer.name)}`).join(',\n\t')}\n]`;
|
||||||
|
|
||||||
|
fs.writeFileSync(outputFile, `export default ${str};`);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
@ -1,8 +1,9 @@
|
|||||||
const sh = require('shelljs');
|
import sh from 'shelljs';
|
||||||
|
|
||||||
sh.env['FORCE_UPDATE'] = process.argv.includes('--force=true');
|
sh.env['FORCE_UPDATE'] = process.argv.includes('--force=true');
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
sh.exec('node ./scripts/get_contributors.js'),
|
sh.exec('node ./scripts/get_contributors.js'),
|
||||||
|
sh.exec('node ./scripts/get_donors.js'),
|
||||||
sh.exec('node ./scripts/update_template.js')
|
sh.exec('node ./scripts/update_template.js')
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang='en' class="theme-default typo-default">
|
||||||
|
<head>
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||||
|
<meta name='theme-color' content='#ff3e00'>
|
||||||
|
|
||||||
|
<base href='/'>
|
||||||
|
|
||||||
|
<link rel='stylesheet' href='global.css'>
|
||||||
|
<link rel='stylesheet' href='prism.css'>
|
||||||
|
<link rel='manifest' href='manifest.json'>
|
||||||
|
<link rel='icon' type='image/png' href='favicon.png'>
|
||||||
|
|
||||||
|
<meta name='twitter:card' content='summary_large_image'>
|
||||||
|
<meta name='twitter:site' content='@sveltejs'>
|
||||||
|
<meta name='twitter:creator' content='@sveltejs'>
|
||||||
|
<meta name='twitter:image' content='https://svelte.dev/images/twitter-card.png'>
|
||||||
|
<meta name='og:image' content='https://svelte.dev/images/twitter-card.png'>
|
||||||
|
|
||||||
|
%svelte.head%
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id='svelte'>%svelte.body%</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import '@sveltejs/site-kit/base.css';
|
|
||||||
import * as sapper from '@sapper/app';
|
|
||||||
|
|
||||||
sapper.start({
|
|
||||||
target: document.querySelector('#sapper')
|
|
||||||
});
|
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// need to do this first before importing database, etc.
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
import * as cookie from 'cookie';
|
||||||
|
import { get_user, sanitize_user } from './utils/auth';
|
||||||
|
import { query } from './utils/db';
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Handle} */
|
||||||
|
export async function handle({ request, resolve }) {
|
||||||
|
if (process.env['PGHOST']) {
|
||||||
|
// this is a convenient time to clear out expired sessions
|
||||||
|
query('delete from sessions where expiry < now()');
|
||||||
|
|
||||||
|
request.locals.cookies = cookie.parse(request.headers.cookie || '');
|
||||||
|
request.locals.user = await get_user(request.locals.cookies.sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await resolve(request);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').GetSession} */
|
||||||
|
export function getSession(request) {
|
||||||
|
return request.locals.user
|
||||||
|
? {
|
||||||
|
user: sanitize_user(request.locals.user)
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<script>
|
||||||
|
import donors from '../_donors.js';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.donor {
|
||||||
|
width: 2.4em;
|
||||||
|
height: 2.4em;
|
||||||
|
border-radius: 50%;
|
||||||
|
text-indent: -9999px;
|
||||||
|
display: inline-block;
|
||||||
|
background: no-repeat url(/donors.jpg);
|
||||||
|
background-size: auto 102%;
|
||||||
|
margin: 0 0.5em 0.5em 0;
|
||||||
|
border: 2px solid var(--second);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
{#each donors as donor, i}
|
||||||
|
<a
|
||||||
|
class="donor"
|
||||||
|
style="background-position: {(100 * i) / (donors.length - 1)}% 0"
|
||||||
|
alt="{donor}"
|
||||||
|
href="https://opencollective.com/svelte">
|
||||||
|
{donor}
|
||||||
|
</a>
|
||||||
|
{/each}
|
||||||
@ -1,26 +1,25 @@
|
|||||||
import send from '@polka/send';
|
import { query as db_query } from '../../utils/db';
|
||||||
import { query } from '../../utils/db';
|
|
||||||
|
|
||||||
export async function get(req, res) {
|
export async function get({ query, locals }) {
|
||||||
if (req.user) {
|
if (locals.user) {
|
||||||
const page_size = 100;
|
const page_size = 100;
|
||||||
const offset = req.query.offset ? parseInt(req.query.offset) : 0;
|
const offset = query.get('offset') ? parseInt(query.get('offset')) : 0;
|
||||||
const rows = await query(`
|
const rows = await db_query(`
|
||||||
select g.uid, g.name, coalesce(g.updated_at, g.created_at) as updated_at
|
select g.uid, g.name, coalesce(g.updated_at, g.created_at) as updated_at
|
||||||
from gists g
|
from gists g
|
||||||
where g.user_id = $1
|
where g.user_id = $1
|
||||||
order by id desc
|
order by id desc
|
||||||
limit ${page_size + 1}
|
limit ${page_size + 1}
|
||||||
offset $2
|
offset $2
|
||||||
`, [req.user.id, offset]);
|
`, [locals.user.id, offset]);
|
||||||
|
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
row.uid = row.uid.replace(/-/g, '');
|
row.uid = row.uid.replace(/-/g, '');
|
||||||
});
|
});
|
||||||
|
|
||||||
const more = rows.length > page_size;
|
const more = rows.length > page_size;
|
||||||
send(res, 200, { apps: rows.slice(0, page_size), offset: more ? offset + page_size : null });
|
return { body: { apps: rows.slice(0, page_size), offset: more ? offset + page_size : null }};
|
||||||
} else {
|
} else {
|
||||||
send(res, 401);
|
return { status: 401 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
export const oauth = 'https://github.com/login/oauth';
|
export const oauth = 'https://github.com/login/oauth';
|
||||||
export const baseurl = process.env.BASEURL;
|
export const baseurl = process.env['BASEURL'];
|
||||||
export const secure = baseurl && baseurl.startsWith('https:');
|
export const secure = baseurl && baseurl.startsWith('https:');
|
||||||
|
|
||||||
export const client_id = process.env.GITHUB_CLIENT_ID;
|
export const client_id = process.env['GITHUB_CLIENT_ID'];
|
||||||
export const client_secret = process.env.GITHUB_CLIENT_SECRET;
|
export const client_secret = process.env['GITHUB_CLIENT_SECRET'];
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
import send from '@polka/send';
|
|
||||||
import * as cookie from 'cookie';
|
import * as cookie from 'cookie';
|
||||||
import { secure } from './_config.js';
|
import { secure } from './_config.js';
|
||||||
import { delete_session } from '../../utils/auth.js';
|
import { delete_session } from '../../utils/auth.js';
|
||||||
|
|
||||||
export async function get(req, res) {
|
export async function get(request) {
|
||||||
await delete_session(req.cookies.sid);
|
await delete_session(request.locals.cookies.sid);
|
||||||
|
|
||||||
send(res, 200, '', {
|
return {
|
||||||
|
headers: {
|
||||||
'Set-Cookie': cookie.serialize('sid', '', {
|
'Set-Cookie': cookie.serialize('sid', '', {
|
||||||
maxAge: -1,
|
maxAge: -1,
|
||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure
|
secure
|
||||||
})
|
})
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@ -1,4 +1,6 @@
|
|||||||
export function get(req, res) {
|
export function get() {
|
||||||
res.writeHead(302, { Location: 'https://discord.gg/yy75DKs' });
|
return {
|
||||||
res.end();
|
status: 302,
|
||||||
|
headers: { Location: 'https://discord.gg/yy75DKs' },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@ -1,12 +1,13 @@
|
|||||||
import send from '@polka/send';
|
|
||||||
import get_sections from './_sections.js';
|
import get_sections from './_sections.js';
|
||||||
|
|
||||||
let json;
|
let json;
|
||||||
|
|
||||||
export function get(req, res) {
|
export function get() {
|
||||||
if (!json || process.env.NODE_ENV !== 'production') {
|
if (!json || process.env.NODE_ENV !== 'production') {
|
||||||
json = get_sections();
|
json = get_sections();
|
||||||
}
|
}
|
||||||
|
|
||||||
send(res, 200, json);
|
return {
|
||||||
|
body: json
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,22 @@
|
|||||||
import send from '@polka/send';
|
|
||||||
import { get_examples } from './_examples.js';
|
import { get_examples } from './_examples.js';
|
||||||
|
|
||||||
let cached;
|
let cached;
|
||||||
|
|
||||||
export function get(req, res) {
|
export function get() {
|
||||||
try {
|
|
||||||
if (!cached || process.env.NODE_ENV !== 'production') {
|
if (!cached || process.env.NODE_ENV !== 'production') {
|
||||||
cached = get_examples().filter(section => section.title);
|
cached = get_examples().filter(section => section.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
send(res, 200, cached);
|
try {
|
||||||
} catch (e) {
|
return {
|
||||||
send(res, e.status || 500, {
|
body: cached
|
||||||
|
};
|
||||||
|
} catch(err) {
|
||||||
|
return {
|
||||||
|
status: e.status || 500,
|
||||||
|
body: {
|
||||||
message: e.message
|
message: e.message
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue