mirror of
https://github.com/lobehub/lobehub.git
synced 2026-09-20 04:56:13 +08:00
1001a58a22
* ♻️ refactor(spa): extract verify/acceptance into apps/workbench Move the Workbench SPA into apps/workbench and serve /verify and /acceptance from that runtime for every web UA. The main SPA no longer registers those page routes, so they drop out of its bundle. * 🔧 chore(docker): wire the workbench workspace into image builds Copy apps/workbench/package.json before pnpm i so Docker can resolve the extracted SPA. Keep generateSpaTemplates optional for Cloud, and require the HTML only when WORKBENCH_REQUIRED=1 (build:docker). * ♻️ refactor(workbench): hard-navigate only from markdown entity links Keep Link and useWorkspaceAwareNavigate in-router. Markdown verify, acceptance, and mobile agent-doc links document-navigate. Drop the __WORKBENCH__ Vite define; Electron still skips hard-nav for portals. * ♻️ refactor(verify): slot-inject origin conversation and decouple shared components * 🐛 fix(i18n): make vite glob loaders independent of the vite root * ✨ feat(workbench): React Router framework mode SSR on Cloudflare Workers * 🐛 fix(verify): render viewer-timezone timestamps only after hydration * 💚 ci(workbench): deploy with affected detection and PR build verification * 📝 docs(skills): micro-app split and gateway routing playbook * 🐛 fix(workbench): track app/lib swallowed by the root lib/ ignore rules * ✨ feat(workbench): signed-in acceptance list sidebar on detail pages * 🐛 fix(workbench): survive shared-origin gateway quirks in client navigation * 💄 style(workbench): surface error detail on the boundary page * 💄 style(workbench): adopt the shared ErrorCapture page for the root boundary * 💄 style(verify): drop the app-home back arrow from the acceptance list panel * 🔧 chore(workbench): persist only error logs in wrangler observability * 📝 docs(skills): record Docker vs Cloud hosting for micro apps OSS Docker still builds and serves the SPA in-image. Cloud Next must not build, rewrite, or CDN-upload it — gateway routes to the Worker. * 💄 style(workbench): pin the acceptance logo while the list panel slides * 🐛 fix(workbench): only show the acceptance sidebar when signed in * 🐛 fix(verify): drop namespace prefix on bound verify translations
77 lines
2.4 KiB
JavaScript
77 lines
2.4 KiB
JavaScript
import { execFileSync } from 'node:child_process';
|
|
import { appendFileSync, readFileSync } from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..');
|
|
const manifestPath =
|
|
process.env.WORKBENCH_MANIFEST || path.resolve(repoRoot, 'apps/workbench/build-inputs.txt');
|
|
|
|
// Inputs the bundle graph cannot see: build config and its imports, dependency
|
|
// versions, and files matched by import.meta.glob patterns that may not have
|
|
// existed at the last build.
|
|
const META_TRIGGERS = [
|
|
(file) => file.startsWith('apps/workbench/'),
|
|
(file) => file.startsWith('plugins/vite/'),
|
|
(file) => file.startsWith('packages/locales/src/default/'),
|
|
(file) => /^locales\/[^/]+\/verify\.json$/.test(file),
|
|
(file) => file === 'pnpm-lock.yaml',
|
|
(file) => file === 'tsconfig.json',
|
|
(file) => file === '.github/workflows/deploy-workbench.yml',
|
|
(file) => file === '.github/workflows/verify-workbench.yml',
|
|
];
|
|
|
|
const emit = (shouldBuild, reason, hits = []) => {
|
|
console.log(reason);
|
|
for (const hit of hits) console.log(` ${hit}`);
|
|
console.log(`should_build=${shouldBuild}`);
|
|
if (process.env.GITHUB_OUTPUT) {
|
|
appendFileSync(process.env.GITHUB_OUTPUT, `should_build=${shouldBuild}\n`);
|
|
}
|
|
};
|
|
|
|
const args = process.argv.slice(2);
|
|
let changed;
|
|
|
|
if (args[0] === '--files') {
|
|
changed = args.slice(1);
|
|
} else {
|
|
const [base, head = 'HEAD'] = args;
|
|
if (!base) {
|
|
emit(true, 'no base commit provided — building');
|
|
process.exit(0);
|
|
}
|
|
try {
|
|
changed = execFileSync('git', ['diff', '--name-only', `${base}...${head}`], {
|
|
cwd: repoRoot,
|
|
encoding: 'utf8',
|
|
})
|
|
.split('\n')
|
|
.filter(Boolean);
|
|
} catch {
|
|
emit(true, `base commit ${base} not resolvable — building`);
|
|
process.exit(0);
|
|
}
|
|
}
|
|
|
|
let manifestText;
|
|
try {
|
|
manifestText = readFileSync(manifestPath, 'utf8');
|
|
} catch {
|
|
emit(true, `manifest ${manifestPath} not available — building`);
|
|
process.exit(0);
|
|
}
|
|
|
|
const manifest = new Set(manifestText.split('\n').filter(Boolean));
|
|
const hits = changed.filter(
|
|
(file) => manifest.has(file) || META_TRIGGERS.some((matches) => matches(file)),
|
|
);
|
|
|
|
emit(
|
|
hits.length > 0,
|
|
hits.length > 0
|
|
? `${hits.length} workbench build input(s) changed:`
|
|
: `no workbench build inputs among ${changed.length} changed file(s)`,
|
|
hits.slice(0, 20),
|
|
);
|