@storm-stack/plugin-system
Version:
A library used to create and manage a plugin-styled architecture in a TypeScript application.
25 lines (24 loc) • 516 B
JavaScript
import { detect, getCommand } from "@antfu/ni";
import { execaCommand } from "execa";
export const execute = (command, rootPath) => {
return execaCommand(command, {
preferLocal: true,
shell: true,
stdio: "inherit",
cwd: rootPath
});
};
export const install = async (name, rootPath) => {
await execute(
getCommand(
await detect({
autoInstall: false,
cwd: rootPath,
programmatic: true
}) ?? "npm",
"install",
[name]
),
rootPath
);
};