- Introduced a helper function `_to_sync_database_url` to standardize the conversion of async database URLs to sync URLs in `env.py` and `migrations.py`. - Added `_ensure_sqlite_parent_dir` function in `db_utils.py` to create the parent directory for SQLite databases if it doesn't exist, ensuring compatibility with Windows paths. - Updated the `get_database_url_and_connect_args` function to call `_ensure_sqlite_parent_dir` before processing the database URL. - Simplified the `sync_export_runtime.js` script by removing the build step and directly using committed runtime artifacts, ensuring a smoother export process.
36 lines
979 B
JavaScript
36 lines
979 B
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
const targetRoot = path.join(__dirname, "resources", "export");
|
|
const targetPyDir = path.join(targetRoot, "py");
|
|
const targetIndex = path.join(targetRoot, "index.js");
|
|
const targetConvert = path.join(targetPyDir, "convert");
|
|
|
|
function ensureExists(filePath, label) {
|
|
if (!fs.existsSync(filePath)) {
|
|
throw new Error(`${label} not found at: ${filePath}`);
|
|
}
|
|
}
|
|
|
|
function chmodIfPossible(filePath) {
|
|
if (process.platform !== "win32") {
|
|
fs.chmodSync(filePath, 0o755);
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
ensureExists(
|
|
targetIndex,
|
|
"Committed runtime JS bundle (electron/resources/export/index.js)"
|
|
);
|
|
ensureExists(
|
|
targetConvert,
|
|
"Committed runtime converter binary (electron/resources/export/py/convert)"
|
|
);
|
|
chmodIfPossible(targetConvert);
|
|
|
|
console.log("[export-runtime] Using committed runtime artifacts:");
|
|
console.log(` - ${targetIndex}`);
|
|
console.log(` - ${targetConvert}`);
|
|
}
|
|
|
|
main();
|