Created
February 11, 2022 22:00
-
-
Save Pierstoval/7d65014c039699c69cb2f9c5c96fd342 to your computer and use it in GitHub Desktop.
A Node.js script to run both Node frontend & Rust backend when developing with Tauri
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {spawn} from "child_process"; | |
const yarn_path = process.env.npm_execpath; | |
const node_path = process.env.npm_node_execpath; | |
const create_process = function(name, args) { | |
let child = spawn(node_path, [yarn_path, ...args], {stdio: 'inherit'}); | |
child.on('close', (code) => console.log(`child process ${name} exited with code ${code}`)); | |
return child; | |
} | |
create_process('FRONTEND', ['run', 'dev']); | |
create_process('BACKEND', ['run', 'tauri', 'dev']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment