Skip to content

Commit

Permalink
chore: optimize assets
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Aug 21, 2024
1 parent 7b45ebc commit 5ccac0b
Show file tree
Hide file tree
Showing 47 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"build": "pnpm download-contributors && vite build",
"build": "node ./scripts/build.js",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"clean": "rm -rf node_modules && rm -rf .svelte_kit && pnpm i",
Expand All @@ -18,7 +18,8 @@
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"test:integration": "playwright test",
"test:unit": "vitest"
"test:unit": "vitest",
"optimize": "node ./scripts/optimize-assets.js"
},
"packageManager": "[email protected]+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a",
"dependencies": {
Expand Down
3 changes: 0 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { fileURLToPath } from 'url';
import { build } from 'vite';
import { downloadContributors } from './download-contributor-data.js';

const __dirname = fileURLToPath(new URL('.', import.meta.url));

async function main() {
await downloadContributors();
await build();
Expand Down
9 changes: 7 additions & 2 deletions scripts/optimize-assets.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { readdirSync, statSync } from 'fs';
import { join } from 'path';
import { join, relative } from 'path';
import sharp from 'sharp';
import { fileURLToPath } from 'url';

const __dirname = fileURLToPath(new URL('.', import.meta.url));
const root_dir = join(__dirname, '../static');

const config = {
jpeg: { quality: 80 },
Expand Down Expand Up @@ -33,10 +34,14 @@ function isImage(file) {
return imageExtensions.includes(extension);
}

function get_relative_path(file) {
return relative(root_dir, file)
}

async function main() {
for (const file of walkSync(join(__dirname, '../static'))) {
if (!isImage(file)) continue;
console.log(file);
console.log(get_relative_path(file));

const image = sharp(file);
const size_before = (await image.toBuffer()).length;
Expand Down
Binary file modified static/assets/logomark/co-brand.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/logomark/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/logotype/black.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/logotype/co-brand.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/logotype/white.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/visuals/auth.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/visuals/dashboard.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/visuals/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/visuals/databases.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/visuals/functions.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/visuals/messaging.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/visuals/storage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/animations/storage-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/avatars/snezhanna.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/ai-docs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/ai-threads.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/cloud-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/cloud-pricing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/cors-error/cors_cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/goodbye-plaintext-passwords/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/messaging-explained/features.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/rest-vs-graphql-websockets/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/blog/social-media-auth/cover.png
Binary file modified static/images/blog/ssr-vs-csr/cover.png
Binary file modified static/images/blog/the-evolution-of-team-appwrite/team.jpg
Binary file modified static/images/blog/tickets-blog2.png
Binary file modified static/images/blog/tickets-blog3.gif
Binary file modified static/images/changelog/2023-08-30.png
Binary file modified static/images/changelog/2024-03-07.png
Binary file modified static/images/changelog/2024-04-22.png
Binary file modified static/images/integrations/deployments-github/cover.png
Binary file modified static/images/integrations/oauth-apple/cover.png
Binary file modified static/images/integrations/oauth-notion/cover.png
Binary file modified static/images/integrations/push-apns/cover.png
Binary file modified static/images/tickets/noise.png
Binary file modified static/images/tickets/rainbow.png
Binary file modified static/images/tutorials/android.png
Binary file modified static/images/tutorials/flutter.png
Binary file modified static/images/tutorials/react.png
Binary file modified static/images/tutorials/svelte.png

0 comments on commit 5ccac0b

Please sign in to comment.