constatic
Version:
Constatic is a CLI for creating and managing modern TypeScript projects, providing an organized structure and features that streamline development.
22 lines (21 loc) • 602 B
JavaScript
// src/actions/bot/add/server.ts
import merge from "lodash.merge";
import { updateEnv } from "../init.js";
import { copy } from "fs-extra";
import { join } from "node:path";
async function addBotServerAction(props) {
const { cli, pkg, server, envFile, envSchema, index } = props;
merge(pkg, server.packageJson);
if (server.env) {
await updateEnv(envSchema, envFile, server.env);
}
if (server.path) {
await copy(join(cli.templates.botPath, "servers", server.path), props.dist);
}
index.addImportDeclaration({
moduleSpecifier: "#server"
});
}
export {
addBotServerAction
};