This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
rivet backend generate-sdk
command
- Loading branch information
1 parent
4250c20
commit 5bc4b14
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { globalOptsSchema, initProject } from "../common.ts"; | ||
import { build, DbDriver, Format, Runtime } from "../../toolchain/build/mod.ts"; | ||
import { runTask } from "../task.ts"; | ||
|
||
runTask({ | ||
inputSchema: globalOptsSchema, | ||
async run(input) { | ||
const project = await initProject(input); | ||
|
||
await build(project, { | ||
format: Format.Native, | ||
runtime: Runtime.Deno, | ||
dbDriver: DbDriver.NodePostgres, | ||
sdk: {}, | ||
// Require schemas to be generated in order to generate SDk | ||
strictSchemas: true, | ||
skipDenoCheck: true, | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use clap::Parser; | ||
use serde::Serialize; | ||
use std::process::ExitCode; | ||
use toolchain::{backend::run_backend_command_passthrough, paths}; | ||
|
||
use crate::util::global_opts::GlobalOpts; | ||
|
||
/// Generate the SDK. Usually not needed since the SDK is auto-generated in `rivet dev`. | ||
#[derive(Parser, Serialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct Opts { | ||
#[clap(flatten)] | ||
#[serde(flatten)] | ||
global: GlobalOpts, | ||
} | ||
|
||
impl Opts { | ||
pub async fn execute(&self) -> ExitCode { | ||
run_backend_command_passthrough("gen_sdk.ts", self, paths::BackendDataType::Dev).await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters