feat: typescript client esm build (#7709)
* feat: typescript client esm build * fix: add --dts flag and restore tsconfig options for typescript client ESM build - Add --dts flag to tsdown commands to generate declaration files - Restore outDir in tsconfig.json for compatibility - Restore forceConsistentCasingInFileNames for case-sensitive systems - Update README_DEV.md to reflect new tsdown build process Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
# Generate windmill-client bundle
|
||||
|
||||
```bash
|
||||
./node_modules/.bin/esbuild src/index.ts --bundle --outfile=windmill.js --format=esm --platform=node
|
||||
npx tsdown --format esm --format cjs --dts
|
||||
```
|
||||
|
||||
# Generate d.ts bundle
|
||||
|
||||
node_modules/dts-bundle-generator/dist/bin/dts-bundle-generator.js -o
|
||||
windmill.d.ts types/in dex.d.ts
|
||||
|
||||
# Develop client locally
|
||||
|
||||
`./dev.nu watch`
|
||||
|
||||
@@ -40,4 +40,4 @@ cp "${script_dirpath}/sqlUtils.ts" "${script_dirpath}/src/"
|
||||
echo "" >> "${script_dirpath}/src/index.ts"
|
||||
echo 'export type { DenoS3LightClientSettings } from "./s3Types";' >> "${script_dirpath}/src/index.ts"
|
||||
echo "" >> "${script_dirpath}/src/index.ts"
|
||||
echo 'export { type Base64, setClient, getVariable, setVariable, getResource, setResource, getResumeUrls, setState, setProgress, getProgress, getState, getIdToken, denoS3LightClientSettings, loadS3FileStream, loadS3File, writeS3File, signS3Objects, signS3Object, getPresignedS3PublicUrls, getPresignedS3PublicUrl, task, runScript, runScriptAsync, runScriptByPath, runScriptByHash, runScriptByPathAsync, runScriptByHashAsync, runFlow, runFlowAsync, waitJob, getRootJobId, setFlowUserState, getFlowUserState, usernameToEmail, requestInteractiveSlackApproval, Sql, requestInteractiveTeamsApproval, appendToResultStream, streamResult, datatable, ducklake, type DatatableSqlTemplateFunction, type SqlTemplateFunction, type S3Object, type S3ObjectRecord, type S3ObjectURI } from "./client";' >> "${script_dirpath}/src/index.ts"
|
||||
echo 'export { type Base64, setClient, getVariable, setVariable, getResource, setResource, getResumeUrls, setState, setProgress, getProgress, getState, getIdToken, denoS3LightClientSettings, loadS3FileStream, loadS3File, writeS3File, signS3Objects, signS3Object, getPresignedS3PublicUrls, getPresignedS3PublicUrl, task, runScript, runScriptAsync, runScriptByPath, runScriptByHash, runScriptByPathAsync, runScriptByHashAsync, runFlow, runFlowAsync, waitJob, getRootJobId, setFlowUserState, getFlowUserState, usernameToEmail, requestInteractiveSlackApproval, type Sql, requestInteractiveTeamsApproval, appendToResultStream, streamResult, datatable, ducklake, type DatatableSqlTemplateFunction, type SqlTemplateFunction, type S3Object, type S3ObjectRecord, type S3ObjectURI } from "./client";' >> "${script_dirpath}/src/index.ts"
|
||||
|
||||
1247
typescript-client/package-lock.json
generated
1247
typescript-client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,13 +6,32 @@
|
||||
"license": "Apache 2.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.17.16",
|
||||
"dts-bundle-generator": "^9.5.1",
|
||||
"esbuild": "^0.21.1",
|
||||
"tsdown": "^0.12.9",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"prepublish": "tsc",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.mts",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"*": [
|
||||
"./dist/index.d.mts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"prepublish": "tsdown --format esm --format cjs --dts",
|
||||
"files": [
|
||||
"dist",
|
||||
"LICENSE",
|
||||
|
||||
@@ -11,7 +11,7 @@ rm "${script_dirpath}/client.ts"
|
||||
rm "${script_dirpath}/s3Types.ts"
|
||||
rm "${script_dirpath}/sqlUtils.ts"
|
||||
npm install
|
||||
tsc
|
||||
npx tsdown --format esm --format cjs --dts
|
||||
cp "${script_dirpath}/src/client.ts" ${script_dirpath}
|
||||
cp "${script_dirpath}/src/s3Types.ts" ${script_dirpath}
|
||||
cp "${script_dirpath}/src/sqlUtils.ts" ${script_dirpath}
|
||||
|
||||
@@ -2,18 +2,16 @@
|
||||
"include": ["src/**/*"],
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"rootDir": "src/",
|
||||
"outDir": "dist",
|
||||
"target": "ES6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
"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": "CommonJS" /* Specify what module code is generated. */,
|
||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||
"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. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user