Initial commit: Maskan CRM backend
Independent FastAPI backend for Maskan CRM. Owns contacts, organizations, leads, pipelines, activities, products, quotes, users, permissions, audit records and first-party integration credentials, with Alembic migrations against PostgreSQL. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
const { existsSync } = require("node:fs");
|
||||
const { join, resolve } = require("node:path");
|
||||
const { spawnSync } = require("node:child_process");
|
||||
|
||||
const root = resolve(__dirname, "..");
|
||||
|
||||
function canRun(command) {
|
||||
const result = spawnSync(command, ["--version"], {
|
||||
cwd: root,
|
||||
shell: false,
|
||||
stdio: "ignore",
|
||||
});
|
||||
|
||||
return result.status === 0;
|
||||
}
|
||||
|
||||
const configured = process.env.MASKAN_CRM_PYTHON;
|
||||
const localCandidates =
|
||||
process.platform === "win32"
|
||||
? [
|
||||
join(root, ".venv", "Scripts", "python.exe"),
|
||||
join(root, "..", ".venv311", "Scripts", "python.exe"),
|
||||
]
|
||||
: [
|
||||
join(root, ".venv", "bin", "python"),
|
||||
join(root, "..", ".venv311", "bin", "python"),
|
||||
];
|
||||
|
||||
const candidates = [
|
||||
configured,
|
||||
...localCandidates.filter(existsSync),
|
||||
process.platform === "win32" ? "python" : "python3",
|
||||
"python",
|
||||
].filter(Boolean);
|
||||
|
||||
const python = candidates.find(canRun);
|
||||
|
||||
if (!python) {
|
||||
console.error(
|
||||
"Python was not found. Create .venv or set MASKAN_CRM_PYTHON.",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const result = spawnSync(python, process.argv.slice(2), {
|
||||
cwd: root,
|
||||
env: process.env,
|
||||
shell: false,
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
console.error(result.error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
Reference in New Issue
Block a user