fix(bun): remove need for manual setClient

This commit is contained in:
Ruben Fiszel
2023-08-12 01:23:26 +02:00
parent 0fdf38a235
commit 4794bd0b60
5 changed files with 27 additions and 16 deletions
+1
View File
@@ -8,6 +8,7 @@ sed -i -e "/^export const VERSION =/s/= .*/= \"v$VERSION\";/" cli/main.ts
sed -i -e "/^export const VERSION =/s/= .*/= \"v$VERSION\";/" benchmarks/main.ts
sed -i -e "/version: /s/: .*/: $VERSION/" backend/windmill-api/openapi.yaml
sed -i -e "/version: /s/: .*/: $VERSION/" openflow.openapi.yaml
sed -i -e "/\"version\": /s/: .*,/: \"$VERSION\",/" typescript-client/package.json
sed -i -e "/\"version\": /s/: .*,/: \"$VERSION\",/" frontend/package.json
sed -i -e "/^version =/s/= .*/= \"$VERSION\"/" python-client/wmill/pyproject.toml
sed -i -e "/^windmill-api =/s/= .*/= \"\\^$VERSION\"/" python-client/wmill/pyproject.toml
+18
View File
@@ -0,0 +1,18 @@
name: Publish deno-client
on:
push:
tags:
- "v*"
jobs:
build_npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: cd typescript-client && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+1
View File
@@ -0,0 +1 @@
node_modules
+6 -14
View File
@@ -263,16 +263,12 @@
editor.insertAtCursor(`(await wmill.getVariable('${path}'))`)
} else if (lang === 'bun') {
const code = editor.getCode()
if (!code.includes('import { setClient, getVariable } from "windmill-client@0.3.15')) {
if (!code.includes('import { getVariable } from "windmill-client@0.3.15')) {
editor.insertAtBeginning(
`import { setClient, getVariable } from "windmill-client@0.3.15"\n`
`import { getVariable } from "windmill-client@0.3.15"\n`
)
}
if (!code.includes('setClient()')) {
editor.insertAtCursor(`setClient()\n(await getVariable('${path}'))`)
} else {
editor.insertAtCursor(`(await getVariable('${path}'))`)
}
editor.insertAtCursor(`(await getVariable('${path}'))`)
} else if (lang == 'python3') {
if (!editor.getCode().includes('import wmill')) {
editor.insertAtBeginning('import wmill\n')
@@ -325,16 +321,12 @@
editor.insertAtCursor(`(await wmill.getResource('${path}'))`)
} else if (lang === 'bun') {
const code = editor.getCode()
if (!code.includes('import { setClient, getResource } from "windmill-client@0.3.15')) {
if (!code.includes('import { getResource } from "windmill-client@0.3.15')) {
editor.insertAtBeginning(
`import { setClient, getResource } from "windmill-client@0.3.15"\n`
`import { getResource } from "windmill-client@0.3.15"\n`
)
}
if (!code.includes('setClient()')) {
editor.insertAtCursor(`setClient()\n(await getResource('${path}'))`)
} else {
editor.insertAtCursor(`(await getResource('${path}'))`)
}
editor.insertAtCursor(`(await getResource('${path}'))`)
} else if (lang == 'python3') {
if (!editor.getCode().includes('import wmill')) {
editor.insertAtBeginning('import wmill\n')
+1 -2
View File
@@ -45,7 +45,7 @@ export async function main(
`
export const BUN_INIT_CODE = `// import { toWords } from "number-to-words@1"
import { setClient, getVariable } from "windmill-client@0.3.15"
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
@@ -57,7 +57,6 @@ export async function main(
d = "inferred type string from default arg",
e = { nested: "object" },
) {
// setClient()
// let x = await getVariable('u/user/foo')
return { foo: a };
}