diff --git a/frontend/src/lib/components/EditorBar.svelte b/frontend/src/lib/components/EditorBar.svelte index e1cfd1c289..f16e3e72a5 100644 --- a/frontend/src/lib/components/EditorBar.svelte +++ b/frontend/src/lib/components/EditorBar.svelte @@ -263,8 +263,10 @@ editor.insertAtCursor(`(await wmill.getVariable('${path}'))`) } else if (lang === 'bun') { const code = editor.getCode() - if (!code.includes('import { getVariable } from "windmill-client')) { - editor.insertAtBeginning(`import { getVariable } from "windmill-client"\n`) + if (!code.includes(`import { getVariable } from "windmill-client@${__pkg__.version}`)) { + editor.insertAtBeginning( + `import { getVariable } from "windmill-client@${__pkg__.version}"\n` + ) } editor.insertAtCursor(`(await getVariable('${path}'))`) } else if (lang == 'python3') { @@ -319,8 +321,10 @@ editor.insertAtCursor(`(await wmill.getResource('${path}'))`) } else if (lang === 'bun') { const code = editor.getCode() - if (!code.includes('import { getResource } from "windmill-client')) { - editor.insertAtBeginning(`import { getResource } from "windmill-client"\n`) + if (!code.includes(`import { getResource } from "windmill-client@${__pkg__.version}`)) { + editor.insertAtBeginning( + `import { getResource } from "windmill-client@${__pkg__.version}"\n` + ) } editor.insertAtCursor(`(await getResource('${path}'))`) } else if (lang == 'python3') { diff --git a/frontend/src/lib/script_helpers.ts b/frontend/src/lib/script_helpers.ts index dee8bc8f12..05468652f9 100644 --- a/frontend/src/lib/script_helpers.ts +++ b/frontend/src/lib/script_helpers.ts @@ -45,7 +45,7 @@ export async function main( ` export const BUN_INIT_CODE = `// import { toWords } from "number-to-words@1" -import { getVariable } from "windmill-client" +import { getVariable } from "windmill-client@${__pkg__.version}" // fill the type, or use the +Resource type to get a type-safe reference to a resource // type Postgresql = object @@ -107,7 +107,7 @@ export async function main(x: string) { } ` -export const BUN_INIT_CODE_CLEAR = `// import { setClient, getVariable } from "windmill-client" +export const BUN_INIT_CODE_CLEAR = `// import { setClient, getVariable } from "windmill-client@${__pkg__.version}" export async function main(x: string) { // setClient()