-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-custom-backups-blog
- Loading branch information
Showing
10 changed files
with
1,927 additions
and
1,948 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { Analytics, type AnalyticsPlugin } from 'analytics'; | ||
import Plausible from 'plausible-tracker'; | ||
import { get } from 'svelte/store'; | ||
import { page } from '$app/stores'; | ||
|
||
import { ENV } from '$lib/system'; | ||
import { browser } from '$app/environment'; | ||
|
||
type Payload = { | ||
payload: { | ||
event: string; | ||
properties: { | ||
path: string; | ||
referrer: string; | ||
width: number; | ||
}; | ||
}; | ||
}; | ||
|
||
const plausible = (domain: string): AnalyticsPlugin => { | ||
if (!browser) return { name: 'analytics-plugin-plausible' }; | ||
|
||
const instance = Plausible({ | ||
domain | ||
}); | ||
|
||
return { | ||
name: 'analytics-plugin-plausible', | ||
page: ({ payload }: Payload) => { | ||
instance.trackPageview({ | ||
url: payload.properties.path, | ||
referrer: payload.properties.referrer, | ||
deviceWidth: payload.properties.width | ||
}); | ||
}, | ||
track: ({ payload }: Payload) => { | ||
instance.trackEvent( | ||
payload.event, | ||
{ | ||
props: payload.properties | ||
}, | ||
{ | ||
url: payload.properties.path, | ||
deviceWidth: payload.properties.width | ||
} | ||
); | ||
}, | ||
loaded: () => true | ||
}; | ||
}; | ||
|
||
const analytics = Analytics({ | ||
app: 'appwrite', | ||
plugins: [plausible('appwrite.io')] | ||
}); | ||
|
||
export const trackEvent = async (name: string, data: object = {}) => { | ||
if (!isTrackingAllowed()) { | ||
return; | ||
} | ||
|
||
const currentPage = get(page); | ||
const path = currentPage.route.id ?? ''; | ||
|
||
if (ENV.DEV || ENV.PREVIEW) { | ||
console.log(`[Analytics] Event ${name} ${path}`, data); | ||
} else { | ||
await analytics.track(name, { ...data, path }); | ||
} | ||
}; | ||
|
||
export function isTrackingAllowed() { | ||
if (ENV.TEST) { | ||
return; | ||
} | ||
if (window.navigator?.doNotTrack) { | ||
if (navigator.doNotTrack === '1' || navigator.doNotTrack === 'yes') { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} else { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { dev } from '$app/environment'; | ||
import { PUBLIC_GROWTH_ENDPOINT } from '$env/static/public'; | ||
|
||
export const VARS = { | ||
GROWTH_ENDPOINT: PUBLIC_GROWTH_ENDPOINT ?? undefined | ||
}; | ||
|
||
export const ENV = { | ||
DEV: dev, | ||
PROD: !dev, | ||
PREVIEW: import.meta.env?.VERCEL === '1', | ||
TEST: !!import.meta.env?.VITEST | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
layout: changelog | ||
title: "Deno 2.0 support for local function development" | ||
date: 2024-10-16 | ||
cover: /images/blog/deno-2-appwrite-functions/cover.png | ||
--- | ||
|
||
Appwrite now supports Deno 2.0 for local function development. When you run `appwrite init functions`, you'll see Deno as an available runtime option. This allows you to develop and test your functions locally using Deno's modern, secure, and fast runtime. | ||
|
||
With Deno 2.0, you can take advantage of built-in tools like the linter, test runner, and formatter, making local development much easier. | ||
|
||
{% arrow_link href="/blog/post/deno-2-appwrite-functions" %} Learn more about Deno 2.0 in our blog {% /arrow_link %} |