Call hardhat script from frontend?

Hello,
Generally, i'm using hardhat tasks for compiling and deploying smart contracts, like "npx hardhat compile" etc. on the command line.
But i want to call hardhat scripts from "frontend" and trigger via button onClick...
How can i do that?
Thanks.