Files
dev-plugins/scripts/build-webui.js
Kudo Chien d5fd8eccc3 feat: bump expo sdk 53 (#66)
# Why

SDK 53 has a breaking change to devtools client transport. We have to
bump the version for dev-plugins packages

# How

- update packages to expo sdk 53
- fix typescript errors and lint errors
- apply workaround for antd:
https://github.com/expo/expo/discussions/36551#discussioncomment-13015890
2025-05-03 00:28:09 +08:00

43 lines
1.2 KiB
JavaScript
Executable File

#!/usr/bin/env node
const spawnAsync = require('@expo/spawn-async');
const path = require('path');
const fs = require('fs');
const ROOT = path.resolve(__dirname, '..');
async function runAsync() {
const args = process.argv.slice(2);
if (args.length === 0) {
console.log(`Usage: ${path.basename(process.argv[1])} package [package2...]`);
process.exit(1);
}
const packageNames = args;
for (const packageName of packageNames) {
await buildAsync(packageName);
}
}
async function buildAsync(packageName) {
console.log(`⚙️ Building web assets for ${packageName}`);
const packageRoot = path.join(ROOT, 'packages', packageName);
await Promise.all([
fs.promises.rm(path.join(packageRoot, 'dist'), { recursive: true, force: true }),
fs.promises.rm(path.join(packageRoot, 'webui', 'dist'), { recursive: true, force: true }),
]);
await spawnAsync('npx', ['expo', 'export', '-p', 'web', '--output-dir', 'dist'], {
cwd: path.join(packageRoot, 'webui'),
});
await fs.promises.rename(path.join(packageRoot, 'webui', 'dist'), path.join(packageRoot, 'dist'));
}
(async () => {
try {
await runAsync();
} catch (e) {
console.error('Uncaught Error', e);
process.exit(1);
}
})();