Skip to content

Commit

Permalink
refactor: ♻️ remove dotEnvPath from options and worker
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 13, 2024
1 parent 1977b7e commit bad8797
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 2 additions & 7 deletions packages/cli/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ export async function run(
* GenAIScript generation options.
*/
options?: Partial<PromptScriptRunOptions> & {
/**
* Path to the .env file
*/
dotEnvPath?: string
/**
* Environment variables to use for the operation.
*/
env?: Record<string, string>
envVars?: Record<string, string>
/**
* The signal to use for aborting the operation. Terminates the worker thread.
*/
Expand All @@ -45,10 +41,9 @@ export async function run(
if (!scriptId) throw new Error("scriptId is required")
if (typeof files === "string") files = [files]

const { dotEnvPath, env, signal, ...rest } = options || {}
const { envVars, signal, ...rest } = options || {}
const workerData = {
type: "run",
dotEnvPath,
scriptId,
files: files || [],
options: rest,
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { runScriptInternal } from "./run"
import { NodeHost } from "./nodehost"

export async function worker() {
const { type, dotEnvPath, ...data } = workerData as {
const { type, ...data } = workerData as {
type: string
dotEnvPath: string
} & object
await NodeHost.install(dotEnvPath) // Install NodeHost with environment options
}
await NodeHost.install(undefined) // Install NodeHost with environment options
switch (type) {
case "run": {
const { scriptId, files, options } = data as {
Expand Down

0 comments on commit bad8797

Please sign in to comment.