StaticJsonFile
The StaticJsonFile resource creates formatted JSON files using Prettier for consistent formatting.
Minimal Example
Section titled “Minimal Example”Creates a simple JSON configuration file.
import { StaticJsonFile } from "alchemy/fs";
const config = await StaticJsonFile("config.json", { name: "my-app", version: "1.0.0",});
Custom Path
Section titled “Custom Path”Creates a JSON file at a specific path.
import { StaticJsonFile } from "alchemy/fs";
const config = await StaticJsonFile("config", "config/settings.json", { api: { endpoint: "https://api.example.com", version: "v1", }, features: ["auth", "logging"],});
Complex Configuration
Section titled “Complex Configuration”Creates a JSON file with nested configuration.
import { StaticJsonFile } from "alchemy/fs";
const config = await StaticJsonFile("app-config.json", { app: { name: "my-app", version: "1.0.0", settings: { theme: "dark", notifications: true, }, }, database: { host: "localhost", port: 5432, credentials: { user: "admin", password: "secret", }, }, features: ["authentication", "authorization", "logging"],});