@softr/sdk
Version:
The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.
27 lines (25 loc) • 664 B
JavaScript
import { SOFTR_CONFIG_FILE, loadSoftrConfig } from "./softr-config.schema.js";
import path from "node:path";
//#region src/vite.ts
function softr() {
return [softrConfig()];
}
function softrConfig() {
let root;
return {
name: "softr:config",
config(userConfig) {
root = path.resolve(userConfig.root ?? process.cwd());
return { define: { __SOFTR_CONFIG__: JSON.stringify(loadSoftrConfig(root)) } };
},
configureServer(server) {
const file = path.join(root, SOFTR_CONFIG_FILE);
server.watcher.add(file);
server.watcher.on("change", (changed) => {
if (changed === file) server.restart();
});
}
};
}
//#endregion
export { softr };