diff --git a/typescript-client/package-lock.json b/typescript-client/package-lock.json index cb5190aa1d..e299444082 100644 --- a/typescript-client/package-lock.json +++ b/typescript-client/package-lock.json @@ -1,12 +1,12 @@ { "name": "windmill-client", - "version": "1.617.3", + "version": "1.618.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "windmill-client", - "version": "1.617.3", + "version": "1.618.3", "license": "Apache 2.0", "devDependencies": { "@types/node": "^20.17.16", diff --git a/typescript-client/package.json b/typescript-client/package.json index 8b710046ec..1ec6b80568 100644 --- a/typescript-client/package.json +++ b/typescript-client/package.json @@ -11,7 +11,7 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.mts", + "types": "dist/index.d.ts", "exports": { ".": { "require": { @@ -19,19 +19,12 @@ "default": "./dist/index.js" }, "import": { - "types": "./dist/index.d.mts", + "types": "./dist/index.d.ts", "default": "./dist/index.mjs" } } }, - "typesVersions": { - "*": { - "*": [ - "./dist/index.d.mts" - ] - } - }, - "prepublish": "tsdown --format esm --format cjs --dts", + "prepublish": "tsdown --format esm --format cjs --no-dts && tsc", "files": [ "dist", "LICENSE", diff --git a/typescript-client/publish.sh b/typescript-client/publish.sh index 43d05bcb0e..4bfc765b80 100755 --- a/typescript-client/publish.sh +++ b/typescript-client/publish.sh @@ -11,18 +11,12 @@ rm "${script_dirpath}/client.ts" rm "${script_dirpath}/s3Types.ts" rm "${script_dirpath}/sqlUtils.ts" npm install -npx tsdown --format esm --format cjs --dts -# Fix default export for TypeScript/Monaco compatibility -# tsdown generates "export { ..., client_d_exports as default, ... }" which doesn't work properly -# We need to replace it with a proper "export default" statement -for dts in "${script_dirpath}/dist/index.d.ts" "${script_dirpath}/dist/index.d.mts"; do - # Remove "client_d_exports as default, " from the export statement - sed -i 's/client_d_exports as default, //g' "$dts" - # Add proper default export at the end - echo "" >> "$dts" - echo "export default client_d_exports;" >> "$dts" -done +# Build JS bundles with tsdown (ESM + CJS, no dts) +npx tsdown --format esm --format cjs --no-dts + +# Generate .d.ts files with tsc (clean output, no bundling) +npx tsc cp "${script_dirpath}/src/client.ts" ${script_dirpath} cp "${script_dirpath}/src/s3Types.ts" ${script_dirpath} diff --git a/typescript-client/tsconfig.json b/typescript-client/tsconfig.json index 0c6f37969c..07ca8fab9b 100644 --- a/typescript-client/tsconfig.json +++ b/typescript-client/tsconfig.json @@ -2,16 +2,15 @@ "include": ["src/**/*"], "compilerOptions": { "declaration": true, + "emitDeclarationOnly": true, "outDir": "dist", "rootDir": "src/", - "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "lib": [ - "ES2018", - "DOM" - ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, - "module": "ESNext" /* Specify what module code is generated. */, - "strict": true /* Enable all strict type-checking options. */, - "skipLibCheck": true /* Skip type checking all .d.ts files. */, + "target": "ESNext", + "lib": ["ES2018", "DOM"], + "module": "ESNext", + "moduleResolution": "bundler", + "strict": true, + "skipLibCheck": true, "forceConsistentCasingInFileNames": true } }