| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0c80bef commit 8cb1f81
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,6 +60,9 @@ jobs: | |||
| 60 | 60 | EOF | |
| 61 | 61 | npm run build # This includes CSS building via npm run build-css | |
| 62 | 62 | ||
| 63 | + - name: Check Obsidian Sync bundle size budget | ||
| 64 | + run: npm run check:bundle-size | ||
| 65 | + | ||
| 63 | 66 | - name: Verify release notes | |
| 64 | 67 | run: | | |
| 65 | 68 | if [ ! -f "$RELEASE_NOTES_PATH" ]; then | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,34 @@ on: | |||
| 7 | 7 | branches: [ main, develop, v3-maintenance ] | |
| 8 | 8 | ||
| 9 | 9 | jobs: | |
| 10 | + bundle-size: | ||
| 11 | + runs-on: ubuntu-latest | ||
| 12 | + steps: | ||
| 13 | + - name: Checkout code | ||
| 14 | + uses: actions/checkout@v4 | ||
| 15 | + with: | ||
| 16 | + submodules: true | ||
| 17 | + | ||
| 18 | + - name: Setup Node.js | ||
| 19 | + uses: actions/setup-node@v4 | ||
| 20 | + with: | ||
| 21 | + node-version: '20' | ||
| 22 | + cache: 'npm' | ||
| 23 | + | ||
| 24 | + - name: Install dependencies | ||
| 25 | + run: npm ci --prefer-offline --no-audit | ||
| 26 | + timeout-minutes: 5 | ||
| 27 | + | ||
| 28 | + - name: Test bundle size guard | ||
| 29 | + run: node --test scripts/check-bundle-size.test.mjs | ||
| 30 | + | ||
| 31 | + - name: Build production plugin | ||
| 32 | + run: npm run build | ||
| 33 | + timeout-minutes: 10 | ||
| 34 | + | ||
| 35 | + - name: Check Obsidian Sync bundle size budget | ||
| 36 | + run: npm run check:bundle-size | ||
| 37 | + | ||
| 10 | 38 | test: | |
| 11 | 39 | runs-on: ubuntu-latest | |
| 12 | 40 | strategy: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,8 @@ When a change has user-facing documentation, include a canonical tasknotes.dev l | |||
| 34 | 34 | ||
| 35 | 35 | ## Fixed | |
| 36 | 36 | ||
| 37 | + - (#2336) Reduced the plugin bundle below Obsidian Sync Standard's 5 MB per-file limit so it can sync between devices again. Thanks to @kmalakoff for reporting and @CyberBlaed for confirming. | ||
| 38 | + | ||
| 37 | 39 | - (#2301) Fixed clicking the Pomodoro timer display to edit its duration. Thanks to @minnyee for reporting and identifying the cause. | |
| 38 | 40 | ||
| 39 | 41 | - (#2328) Fixed direct status edits on occurrence notes not updating the recurring parent’s completion history or creating the next occurrence when configured. Thanks to @mudnug for reporting this. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -96,6 +96,8 @@ const context = await esbuild.context({ | |||
| 96 | 96 | treeShaking: true, | |
| 97 | 97 | outfile: "main.js", | |
| 98 | 98 | minify: prod, | |
| 99 | + // Avoid bulky Unicode escapes in translations; keep the bundle within Obsidian Sync's limit. | ||
| 100 | + charset: "utf8", | ||
| 99 | 101 | plugins: [markdownPlugin, ...(!prod ? [copyToVaultPlugin] : [])], | |
| 100 | 102 | }); | |
| 101 | 103 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ | |||
| 7 | 7 | "build": "npm run build-css && node generate-release-notes-import.mjs && tsc -noEmit --skipLibCheck && node esbuild.config.mjs production", | |
| 8 | 8 | "dev": "npm run build-css && node generate-release-notes-import.mjs && node esbuild.config.mjs", | |
| 9 | 9 | "build:test": "npm run build && node copy-files.mjs", | |
| 10 | + "check:bundle-size": "node scripts/check-bundle-size.mjs", | ||
| 10 | 11 | "copy-files": "node copy-files.mjs", | |
| 11 | 12 | "build-css": "node build-css.mjs", | |
| 12 | 13 | "e2e": "playwright test", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + import { statSync } from "node:fs"; | ||
| 2 | + | ||
| 3 | + // Use decimal MB conservatively, and require headroom below the limit. | ||
| 4 | + const limit = 5_000_000; | ||
| 5 | + const bundle = process.argv[2] ?? "main.js"; | ||
| 6 | + | ||
| 7 | + try { | ||
| 8 | + const stats = statSync(bundle); | ||
| 9 | + if (!stats.isFile() || stats.size === 0) { | ||
| 10 | + throw new Error("expected a non-empty bundle file"); | ||
| 11 | + } | ||
| 12 | + console.log(`${bundle}: ${stats.size.toLocaleString("en-US")} bytes; must be below ${limit.toLocaleString("en-US")} bytes.`); | ||
| 13 | + if (stats.size >= limit) { | ||
| 14 | + console.error("Bundle exceeds the size budget for Obsidian Sync Standard. Reduce the production bundle before releasing."); | ||
| 15 | + process.exitCode = 1; | ||
| 16 | + } | ||
| 17 | + } catch (error) { | ||
| 18 | + console.error(`Cannot check bundle ${bundle}: ${error.message}`); | ||
| 19 | + process.exitCode = 1; | ||
| 20 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,38 @@ | |||
| 1 | + import { test } from "node:test"; | ||
| 2 | + import assert from "node:assert/strict"; | ||
| 3 | + import { mkdtempSync, writeFileSync, truncateSync, rmSync } from "node:fs"; | ||
| 4 | + import { tmpdir } from "node:os"; | ||
| 5 | + import { join } from "node:path"; | ||
| 6 | + import { fileURLToPath } from "node:url"; | ||
| 7 | + import { spawnSync } from "node:child_process"; | ||
| 8 | + | ||
| 9 | + const script = fileURLToPath(new URL("./check-bundle-size.mjs", import.meta.url)); | ||
| 10 | + | ||
| 11 | + for (const [name, size, expectedStatus] of [ | ||
| 12 | + ["below limit", 4_999_999, 0], | ||
| 13 | + ["at limit", 5_000_000, 1], | ||
| 14 | + ["above limit", 5_000_001, 1], | ||
| 15 | + ["empty file", 0, 1], | ||
| 16 | + ["missing file", null, 1], | ||
| 17 | + ]) { | ||
| 18 | + test(name, () => { | ||
| 19 | + const directory = mkdtempSync(join(tmpdir(), "tasknotes-bundle-size-")); | ||
| 20 | + try { | ||
| 21 | + const bundle = join(directory, "main.js"); | ||
| 22 | + if (size !== null) { | ||
| 23 | + writeFileSync(bundle, ""); | ||
| 24 | + truncateSync(bundle, size); | ||
| 25 | + } | ||
| 26 | + // Check both the default main.js path and an explicit path. | ||
| 27 | + for (const args of [[], [bundle]]) { | ||
| 28 | + const result = spawnSync(process.execPath, [script, ...args], { | ||
| 29 | + cwd: directory, | ||
| 30 | + encoding: "utf8", | ||
| 31 | + }); | ||
| 32 | + assert.equal(result.status, expectedStatus, result.stdout + result.stderr); | ||
| 33 | + } | ||
| 34 | + } finally { | ||
| 35 | + rmSync(directory, { recursive: true, force: true }); | ||
| 36 | + } | ||
| 37 | + }); | ||
| 38 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments