Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Website
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: pnpm run build
27 changes: 27 additions & 0 deletions create_sitemap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { writeFileSync } from 'fs';

const isVercel = process.env.VERCEL === '1';

if (isVercel) {
console.log('Skipping sitemap.xml creation on Vercel preview.');
process.exit(0);
}

async function createSitemap() {
console.log('Building sitemap.xml ...');
const manifest = await import('./build/server/manifest.js');
const prerendered = manifest.prerendered;

const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${[...prerendered].filter(route => !route.endsWith('.json')).map(route => `<url>
<loc>https://appwrite.io${route}</loc>
</url>
`).join('')}
</urlset>`;

writeFileSync('./build/sitemap.xml', sitemap, { encoding: 'utf8', flag: 'w' });
console.log('sitemap.xml created successfully!');
}

createSitemap();
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"postbuild": "svelte-sitemap --domain https://appwrite.io",
"build:sitemap": "node create_sitemap.js",
"postbuild": "pnpm build:sitemap",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
Expand All @@ -26,7 +27,6 @@
"@types/markdown-it": "^13.0.1",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"dotenv": "^16.3.1",
"eslint": "^8.49.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-svelte": "^2.33.1",
Expand All @@ -39,7 +39,6 @@
"svelte-check": "^3.5.1",
"svelte-markdoc-preprocess": "^1.0.0",
"svelte-sequential-preprocessor": "^2.0.1",
"svelte-sitemap": "^2.6.0",
"svgo": "^3.0.2",
"svgtofont": "^4.0.0",
"tslib": "^2.6.2",
Expand Down
90 changes: 3 additions & 87 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dotenv/config';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { vitePreprocess } from '@sveltejs/kit/vite';
Expand Down