This is an automated email from the ASF dual-hosted git repository.

jason810496 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new fd80829617b Move ts-sdk prek hooks to its own config and add compile 
hook (#70277)
fd80829617b is described below

commit fd80829617b09d56cf74d09c2f4af5027ea63aa1
Author: Jason(Zhe-You) Liu <[email protected]>
AuthorDate: Thu Jul 23 23:12:38 2026 +0800

    Move ts-sdk prek hooks to its own config and add compile hook (#70277)
---
 .pre-commit-config.yaml                            | 26 ---------
 ts-sdk/.pre-commit-config.yaml                     | 65 ++++++++++++++++++++++
 ts-sdk/README.md                                   |  7 +++
 .../ci/prek/{ts_sdk_lint.py => compile_ts_sdk.py}  |  6 +-
 ts-sdk/scripts/ci/prek/ts_sdk_lint.py              |  0
 5 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5717c6edb3b..9b448dca750 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -249,32 +249,6 @@ repos:
           ^pyproject\.toml$
         pass_filenames: false
         require_serial: true
-      - id: ts-sdk-lint
-        name: Lint TypeScript SDK
-        entry: ./ts-sdk/scripts/ci/prek/ts_sdk_lint.py
-        language: node
-        files: |
-          (?x)
-          ^ts-sdk/.*\.(js|ts|json)$
-        exclude: |
-          (?x)
-          ^ts-sdk/node_modules/.*|
-          ^ts-sdk/.pnpm-store/.*|
-          ^ts-sdk/dist/.*
-        additional_dependencies: ['[email protected]']
-        pass_filenames: false
-        require_serial: true
-      - id: check-ts-sdk-supervisor-schema
-        name: Check TypeScript SDK supervisor schema is up to date
-        entry: ./ts-sdk/scripts/ci/prek/check_supervisor_schema.py
-        language: node
-        files: >
-          (?x)
-          ^ts-sdk/src/generated/supervisor\.ts$|
-          ^ts-sdk/scripts/generate-supervisor\.mjs$
-        additional_dependencies: ['[email protected]']
-        pass_filenames: false
-        require_serial: true
       - id: check-ci-workflows-in-sync
         name: Check ci-arm.yml and ci-amd.yml stay in sync
         entry: ./scripts/ci/prek/check_ci_workflows_in_sync.py
diff --git a/ts-sdk/.pre-commit-config.yaml b/ts-sdk/.pre-commit-config.yaml
new file mode 100644
index 00000000000..10609453189
--- /dev/null
+++ b/ts-sdk/.pre-commit-config.yaml
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+default_stages: [pre-commit, pre-push]
+minimum_prek_version: '0.3.4'
+default_language_version:
+  python: python3
+  node: 22.19.0
+repos:
+  - repo: local
+    hooks:
+      - id: ts-sdk-lint
+        name: Lint TypeScript SDK
+        entry: ./scripts/ci/prek/ts_sdk_lint.py
+        language: node
+        files: |
+          (?x)
+          \.(js|ts|json)$
+        exclude: |
+          (?x)
+          ^node_modules/.*|
+          ^\.pnpm-store/.*|
+          ^dist/.*
+        additional_dependencies: ['[email protected]']
+        pass_filenames: false
+        require_serial: true
+      - id: check-ts-sdk-supervisor-schema
+        name: Check TypeScript SDK supervisor schema is up to date
+        entry: ./scripts/ci/prek/check_supervisor_schema.py
+        language: node
+        files: >
+          (?x)
+          ^src/generated/supervisor\.ts$|
+          ^scripts/generate-supervisor\.mjs$
+        additional_dependencies: ['[email protected]']
+        pass_filenames: false
+        require_serial: true
+      - id: compile-ts-sdk
+        name: Compile TypeScript SDK
+        entry: ./scripts/ci/prek/compile_ts_sdk.py
+        language: node
+        stages: [manual]
+        files: |
+          (?x)
+          ^src/.*\.ts$|
+          ^package\.json$|
+          ^pnpm-lock\.yaml$|
+          ^tsconfig(\.build)?\.json$
+        additional_dependencies: ['[email protected]']
+        pass_filenames: false
+        require_serial: true
diff --git a/ts-sdk/README.md b/ts-sdk/README.md
index 46f57279081..9f2d0c13442 100644
--- a/ts-sdk/README.md
+++ b/ts-sdk/README.md
@@ -202,3 +202,10 @@ pnpm test
 pnpm run typecheck
 pnpm run build
 ```
+
+Without a local pnpm install, [prek](https://prek.j178.dev) can compile the SDK
+with its own managed node + pnpm toolchain:
+
+```bash
+prek run compile-ts-sdk
+```
diff --git a/ts-sdk/scripts/ci/prek/ts_sdk_lint.py 
b/ts-sdk/scripts/ci/prek/compile_ts_sdk.py
old mode 100644
new mode 100755
similarity index 87%
copy from ts-sdk/scripts/ci/prek/ts_sdk_lint.py
copy to ts-sdk/scripts/ci/prek/compile_ts_sdk.py
index c46ccc81d85..b0e43e52510
--- a/ts-sdk/scripts/ci/prek/ts_sdk_lint.py
+++ b/ts-sdk/scripts/ci/prek/compile_ts_sdk.py
@@ -26,7 +26,7 @@ from common_prek_utils import AIRFLOW_ROOT_PATH, run_command
 
 if __name__ not in ("__main__", "__mp_main__"):
     raise SystemExit(
-        "This file is intended to be executed as an executable program. You 
cannot use it as a module."
+        "This file is intended to be executed as an executable program. You 
cannot use it as a module. "
         f"To run this script, run the ./{__file__} command"
     )
 
@@ -34,6 +34,4 @@ if __name__ == "__main__":
     directory = AIRFLOW_ROOT_PATH / "ts-sdk"
     run_command(["pnpm", "config", "set", "store-dir", ".pnpm-store"], 
cwd=directory)
     run_command(["pnpm", "install", "--frozen-lockfile", 
"--config.confirmModulesPurge=false"], cwd=directory)
-    run_command(["pnpm", "run", "lint:fix"], cwd=directory)
-    run_command(["pnpm", "run", "format"], cwd=directory)
-    run_command(["pnpm", "run", "typecheck"], cwd=directory)
+    run_command(["pnpm", "run", "build"], cwd=directory)
diff --git a/ts-sdk/scripts/ci/prek/ts_sdk_lint.py 
b/ts-sdk/scripts/ci/prek/ts_sdk_lint.py
old mode 100644
new mode 100755

Reply via email to