mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
33 lines
879 B
TypeScript
33 lines
879 B
TypeScript
import path from "node:path";
|
|
import fs from "fs-extra";
|
|
import type { PackageManager } from "../../../types";
|
|
import { addPackageDependency } from "../../../utils/add-package-deps";
|
|
|
|
export async function setupReactRouterAlchemyDeploy(
|
|
projectDir: string,
|
|
_packageManager: PackageManager,
|
|
options?: { skipAppScripts?: boolean },
|
|
) {
|
|
const webAppDir = path.join(projectDir, "apps/web");
|
|
if (!(await fs.pathExists(webAppDir))) return;
|
|
|
|
await addPackageDependency({
|
|
devDependencies: ["alchemy", "dotenv"],
|
|
projectDir: webAppDir,
|
|
});
|
|
|
|
const pkgPath = path.join(webAppDir, "package.json");
|
|
if (await fs.pathExists(pkgPath)) {
|
|
const pkg = await fs.readJson(pkgPath);
|
|
|
|
if (!options?.skipAppScripts) {
|
|
pkg.scripts = {
|
|
...pkg.scripts,
|
|
deploy: "alchemy deploy",
|
|
destroy: "alchemy destroy",
|
|
};
|
|
}
|
|
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
}
|
|
}
|