refactor: remove cloudflare vite plugin

This commit is contained in:
hazre committed 2026-04-14 17:06:17 +02:00
1 parent cf6da2402c
commit 9998034c5c
8 files changed
+27 -861

No files matched your search

+5 -3
View File
@@ -6,7 +6,8 @@ on:
- 'src/**'
- 'index.html'
- 'package.json'
- 'package-lock.json'
- 'pnpm-lock.yaml'
- 'wrangler.jsonc'
- 'vite.config.ts'
- 'tsconfig.web.json'
- 'tsconfig.json'
@@ -20,7 +21,8 @@ on:
- 'src/**'
- 'index.html'
- 'package.json'
- 'package-lock.json'
- 'pnpm-lock.yaml'
- 'wrangler.jsonc'
- 'vite.config.ts'
- 'tsconfig.web.json'
- 'tsconfig.json'
@@ -101,7 +103,7 @@ jobs:
accountId: ${{ secrets.TF_VAR_ACCOUNT_ID }}
command: >
versions upload
-c dist/wrangler.json
-c wrangler.jsonc
--preview-alias ${{ steps.alias.outputs.alias }}
--message "$PREVIEW_MESSAGE"
+2 -2
View File
@@ -87,12 +87,12 @@ Preview builds:
- `infra/web/main.tf` enables preview URL capability with `subdomain.previews_enabled = true`.
- Previews are handled by Cloudflare Workers Builds, not GitHub Actions.
- Connect the repo once in Cloudflare Workers Builds.
- Set the Cloudflare Builds deploy command to `npx wrangler versions upload`.
- Set the Cloudflare Builds deploy command to `pnpm run wrangler versions upload`.
- This disables automatic deployments while still allowing Cloudflare to build PRs/branches and save them as preview versions.
- That keeps Cloudflare from promoting `dev` commits to production. Production stays on the OpenTofu/GitHub Actions path in this repo.
```bash
npx wrangler versions upload
pnpm run wrangler versions upload
```
Production deploys:
+3 -3
View File
@@ -5,7 +5,8 @@
"src/ext.d.ts",
"src/types/matrix-sdk-events.d.ts",
"src/client/secretStorageKeys.d.ts",
"src/app/utils/bgColorImg.d.ts"
"src/app/utils/bgColorImg.d.ts",
"scripts/*"
],
"ignoreExportsUsedInFile": {
"interface": true,
@@ -14,8 +15,7 @@
"ignoreDependencies": [
"buffer",
"@sableclient/sable-call-embedded",
"@matrix-org/matrix-sdk-crypto-wasm",
"@testing-library/user-event"
"@matrix-org/matrix-sdk-crypto-wasm"
],
"ignoreBinaries": ["knope"],
"rules": {
+3 -5
View File
@@ -23,7 +23,8 @@
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
"knip": "knip",
"tunnel": "cloudflared tunnel --url http://localhost:8080",
"tunnel": "pnpm dlx cloudflared tunnel --url http://localhost:8080",
"wrangler": "pnpm dlx --allow-build=esbuild --allow-build=sharp --allow-build=workerd wrangler",
"knope": "knope",
"document-change": "knope document-change",
"postinstall": "node scripts/install-knope.js"
@@ -95,7 +96,6 @@
"workbox-precaching": "^7.4.0"
},
"devDependencies": {
"@cloudflare/vite-plugin": "^1.30.2",
"@e18e/eslint-plugin": "^0.3.0",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@eslint/compat": "2.0.2",
@@ -119,7 +119,6 @@
"@vitest/coverage-v8": "^4.1.2",
"@vitest/ui": "^4.1.2",
"buffer": "^6.0.3",
"cloudflared": "^0.7.1",
"eslint": "9.39.3",
"eslint-config-airbnb-extended": "3.0.1",
"eslint-config-prettier": "10.1.8",
@@ -136,7 +135,6 @@
"vite-plugin-static-copy": "^4.0.0",
"vite-plugin-svgr": "4.5.0",
"vite-plugin-top-level-await": "^1.6.0",
"vitest": "^4.1.2",
"wrangler": "^4.78.0"
"vitest": "^4.1.2"
}
}
-835
View File
File diff suppressed because it is too large. Load diff
-2
View File
@@ -1,11 +1,9 @@
allowBuilds:
'@sentry/cli': true
'@swc/core': true
cloudflared: true
esbuild: true
sharp: true
unrs-resolver: true
workerd: true
engineStrict: true
minimumReleaseAge: 1440
minimumReleaseAgeExclude:
+5 -11
View File
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import type { ViteDevServer, PluginOption } from 'vite';
import { execSync } from 'child_process';
import { execFileSync, execSync } from 'child_process';
import type { RollupInjectOptions } from '@rollup/plugin-inject';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
@@ -16,7 +16,6 @@ import { compression, defineAlgorithm } from 'vite-plugin-compression2';
import { constants as zlibConstants } from 'zlib';
import fs from 'fs';
import path from 'path';
import { cloudflare } from '@cloudflare/vite-plugin';
import { createRequire } from 'module';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import buildConfig from './build.config.ts';
@@ -61,7 +60,10 @@ const isReleaseTag = (() => {
const envVal = process.env.VITE_IS_RELEASE_TAG;
if (envVal !== undefined && envVal !== '') return envVal === 'true';
try {
const tag = execSync('git describe --exact-match --tags HEAD 2>/dev/null').toString().trim();
const tag = execFileSync('git', ['describe', '--exact-match', '--tags', 'HEAD'], {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'ignore'],
}).trim();
return tag.startsWith('v');
} catch {
return false;
@@ -178,14 +180,6 @@ export default defineConfig(({ command }) => ({
type: 'module',
},
}),
cloudflare({
config: {
compatibility_date: '2026-03-03',
assets: {
not_found_handling: 'single-page-application',
},
},
}),
compression({
algorithms: [
defineAlgorithm('brotliCompress', {
+9
View File
@@ -0,0 +1,9 @@
{
"$schema": "https://www.unpkg.com/wrangler/config-schema.json",
"name": "sable",
"compatibility_date": "2026-03-03",
"assets": {
"directory": "./dist",
"not_found_handling": "single-page-application",
},
}