diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..11c5d72908 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 diff --git a/create_sitemap.js b/create_sitemap.js new file mode 100644 index 0000000000..0d8bdb21cd --- /dev/null +++ b/create_sitemap.js @@ -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 = ` + + ${[...prerendered].filter(route => !route.endsWith('.json')).map(route => ` + https://appwrite.io${route} + + `).join('')} + `; + + writeFileSync('./build/sitemap.xml', sitemap, { encoding: 'utf8', flag: 'w' }); + console.log('sitemap.xml created successfully!'); +} + +createSitemap(); \ No newline at end of file diff --git a/package.json b/package.json index 74d78b66ea..66b7eb4d71 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6f2629ce8b..9b31a4ec82 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,7 +13,7 @@ dependencies: version: 0.1.0-next.9 '@appwrite.io/repo': specifier: github:appwrite/appwrite - version: github.com/appwrite/appwrite/49155a97d42a152f26e188a3910548bc209785d8 + version: github.com/appwrite/appwrite/edf06962ec0b5a7d58d3ce1aa126e612498c9d0a '@splinetool/viewer': specifier: 0.9.455 version: 0.9.455 @@ -58,9 +58,6 @@ devDependencies: '@typescript-eslint/parser': specifier: ^5.62.0 version: 5.62.0(eslint@8.49.0)(typescript@5.2.2) - dotenv: - specifier: ^16.3.1 - version: 16.3.1 eslint: specifier: ^8.49.0 version: 8.49.0 @@ -97,9 +94,6 @@ devDependencies: svelte-sequential-preprocessor: specifier: ^2.0.1 version: 2.0.1 - svelte-sitemap: - specifier: ^2.6.0 - version: 2.6.0 svgo: specifier: ^3.0.2 version: 3.0.2 @@ -611,35 +605,6 @@ packages: semver: 7.5.4 dev: true - /@oozcitak/dom@1.15.10: - resolution: {integrity: sha512-0JT29/LaxVgRcGKvHmSrUTEvZ8BXvZhGl2LASRUgHqDTC1M5g1pLmVv56IYNyt3bG2CUjDkc67wnyZC14pbQrQ==} - engines: {node: '>=8.0'} - dependencies: - '@oozcitak/infra': 1.0.8 - '@oozcitak/url': 1.0.4 - '@oozcitak/util': 8.3.8 - dev: true - - /@oozcitak/infra@1.0.8: - resolution: {integrity: sha512-JRAUc9VR6IGHOL7OGF+yrvs0LO8SlqGnPAMqyzOuFZPSZSXI7Xf2O9+awQPSMXgIWGtgUf/dA6Hs6X6ySEaWTg==} - engines: {node: '>=6.0'} - dependencies: - '@oozcitak/util': 8.3.8 - dev: true - - /@oozcitak/url@1.0.4: - resolution: {integrity: sha512-kDcD8y+y3FCSOvnBI6HJgl00viO/nGbQoCINmQ0h98OhnGITrWR3bOGfwYCthgcrV8AnTJz8MzslTQbC3SOAmw==} - engines: {node: '>=8.0'} - dependencies: - '@oozcitak/infra': 1.0.8 - '@oozcitak/util': 8.3.8 - dev: true - - /@oozcitak/util@8.3.8: - resolution: {integrity: sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==} - engines: {node: '>=8.0'} - dev: true - /@pkgjs/parseargs@0.11.0: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -1229,12 +1194,6 @@ packages: readable-stream: 3.6.2 dev: true - /argparse@1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - dependencies: - sprintf-js: 1.0.3 - dev: true - /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} @@ -1904,11 +1863,6 @@ packages: domhandler: 5.0.3 dev: true - /dotenv@16.3.1: - resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} - engines: {node: '>=12'} - dev: true - /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true @@ -2127,12 +2081,6 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /esprima@4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - dev: true - /esquery@1.5.0: resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} engines: {node: '>=0.10'} @@ -2879,14 +2827,6 @@ packages: hasBin: true dev: true - /js-yaml@3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - dev: true - /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -4236,10 +4176,6 @@ packages: through2: 2.0.5 dev: true - /sprintf-js@1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - dev: true - /ssri@10.0.5: resolution: {integrity: sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -4492,16 +4428,6 @@ packages: tslib: 2.6.2 dev: true - /svelte-sitemap@2.6.0: - resolution: {integrity: sha512-WcwsuIeo8iJFG9a5cgvXwXEGoyjk6Zowb6JmL5BbwfnFXMzakGa1+mQjthw5Ni3UV/gGbE0PgJvc7Ygir3LmFg==} - engines: {node: '>= 14.17.0'} - hasBin: true - dependencies: - fast-glob: 3.3.1 - minimist: 1.2.8 - xmlbuilder2: 3.1.1 - dev: true - /svelte@4.2.0: resolution: {integrity: sha512-kVsdPjDbLrv74SmLSUzAsBGquMs4MPgWGkGLpH+PjOYnFOziAvENVzgJmyOCV2gntxE32aNm8/sqNKD6LbIpeQ==} engines: {node: '>=16'} @@ -5110,16 +5036,6 @@ packages: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} dev: true - /xmlbuilder2@3.1.1: - resolution: {integrity: sha512-WCSfbfZnQDdLQLiMdGUQpMxxckeQ4oZNMNhLVkcekTu7xhD4tuUDyAPoY8CwXvBYE6LwBHd6QW2WZXlOWr1vCw==} - engines: {node: '>=12.0'} - dependencies: - '@oozcitak/dom': 1.15.10 - '@oozcitak/infra': 1.0.8 - '@oozcitak/util': 8.3.8 - js-yaml: 3.14.1 - dev: true - /xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} @@ -5181,8 +5097,8 @@ packages: engines: {node: '>=12.20'} dev: true - github.com/appwrite/appwrite/49155a97d42a152f26e188a3910548bc209785d8: - resolution: {tarball: https://codeload.github.com/appwrite/appwrite/tar.gz/49155a97d42a152f26e188a3910548bc209785d8} + github.com/appwrite/appwrite/edf06962ec0b5a7d58d3ce1aa126e612498c9d0a: + resolution: {tarball: https://codeload.github.com/appwrite/appwrite/tar.gz/edf06962ec0b5a7d58d3ce1aa126e612498c9d0a} name: appwrite version: 0.0.0 dev: false diff --git a/svelte.config.js b/svelte.config.js index c49fa873f5..26344b931a 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,4 +1,3 @@ -import 'dotenv/config'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; import { vitePreprocess } from '@sveltejs/kit/vite';