This commit is contained in:
Timothy J. Baek 2024-06-17 14:28:56 -07:00
parent a4748af822
commit edfe20b2e1

View File

@ -24,12 +24,16 @@ async function downloadPackages() {
const packageJson = JSON.parse(await readFile('package.json')); const packageJson = JSON.parse(await readFile('package.json'));
const pyodideVersion = packageJson.dependencies.pyodide; const pyodideVersion = packageJson.dependencies.pyodide;
const pyodidePackageJson = JSON.parse(await readFile('static/pyodide/package.json')); try {
const pyodidePackageVersion = pyodidePackageJson.version; const pyodidePackageJson = JSON.parse(await readFile('static/pyodide/package.json'));
const pyodidePackageVersion = pyodidePackageJson.version;
if (pyodideVersion.replace('^', '') !== pyodidePackageVersion) { if (pyodideVersion.replace('^', '') !== pyodidePackageVersion) {
console.log('Pyodide version mismatch, removing static/pyodide directory'); console.log('Pyodide version mismatch, removing static/pyodide directory');
await rmdir('static/pyodide', { recursive: true }); await rmdir('static/pyodide', { recursive: true });
}
} catch (e) {
console.log('Pyodide package not found, downloading packages');
} }
await pyodide.loadPackage('micropip'); await pyodide.loadPackage('micropip');