mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-09 20:06:18 +00:00

If binary packages are installed, then loading rust-module.cjs will work and we don't need to do anything. Otherwise, fall back to building.
20 lines
668 B
JavaScript
20 lines
668 B
JavaScript
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
|
|
|
// This file checks if a binary package was installed (through architecture dependencies), and
|
|
// builds slint if no binary was found.
|
|
|
|
import { Worker } from "node:worker_threads";
|
|
import { spawn } from "child_process";
|
|
|
|
const worker = new Worker("./rust-module.cjs")
|
|
// Define dummy error handler to prevent node from aborting on errors
|
|
worker.on('error', () => { })
|
|
worker.on('exit', (code) => {
|
|
if (code != 0) {
|
|
spawn("npm", ["run", "build"], {
|
|
stdio: 'inherit'
|
|
})
|
|
}
|
|
})
|
|
|