add back bun versioning to client

This commit is contained in:
Ruben Fiszel
2023-08-12 23:57:07 +02:00
parent 9c978281cd
commit c6c03e887f
2 changed files with 10 additions and 6 deletions
+8 -4
View File
@@ -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') {
+2 -2
View File
@@ -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()