mirror of
https://github.com/Momoko-Ayase/Senbei.git
synced 2026-11-25 02:52:47 +08:00
feat(web): bring the Senbei workbench to the browser
Add folder scanning, Android library and package recovery, and the localized desktop-style workbench. Keep browser-refused outputs in a fallback ZIP and include logs with folder and ZIP exports. Align the desktop and web modal transitions and polish the desktop About and legal dialogs.
This commit is contained in:
1 parent
20a68b1c73
commit
21236e8b98
59 files changed
+11612
-3436
No files matched your search
@@ -0,0 +1,46 @@
|
||||
// Stage the static site: the files the page loads, and nothing else.
|
||||
//
|
||||
// node web/tools/stage.mjs <dist>
|
||||
//
|
||||
// Run after `wasm-pack build --target web --out-dir ../web/pkg`. The CI
|
||||
// artifact and the release deployment are both made from this directory, so
|
||||
// the list of what ships is here once.
|
||||
|
||||
import { cpSync, existsSync, mkdirSync, readdirSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import path from 'node:path';
|
||||
|
||||
const web = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
/** Paths under `web/` that make up the site. */
|
||||
export function siteFiles() {
|
||||
const top = readdirSync(web).filter(
|
||||
(name) => name.endsWith('.js') || ['index.html', 'style.css', 'LICENSE'].includes(name),
|
||||
);
|
||||
const catalogs = readdirSync(path.join(web, 'i18n'))
|
||||
.filter((name) => name.endsWith('.js'))
|
||||
.map((name) => `i18n/${name}`);
|
||||
const assets = readdirSync(path.join(web, 'assets')).map((name) => `assets/${name}`);
|
||||
const engine = ['pkg/senbei_wasm.js', 'pkg/senbei_wasm_bg.wasm'];
|
||||
return [...top, ...catalogs, ...assets, ...engine].sort();
|
||||
}
|
||||
|
||||
function main() {
|
||||
const dist = process.argv[2];
|
||||
if (!dist) {
|
||||
console.error('usage: stage.mjs <dist>');
|
||||
process.exit(2);
|
||||
}
|
||||
for (const file of siteFiles()) {
|
||||
const from = path.join(web, file);
|
||||
if (!existsSync(from)) {
|
||||
console.error(`${file} is missing; build senbei-wasm into web/pkg first`);
|
||||
process.exit(1);
|
||||
}
|
||||
const to = path.join(dist, file);
|
||||
mkdirSync(path.dirname(to), { recursive: true });
|
||||
cpSync(from, to);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main();
|
||||
Reference in new issue
Block a user