-
Notifications
You must be signed in to change notification settings - Fork 51
Upgrade napi-rs CLI to v3 #497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
85ab2d8
0224071
f0d1862
b39e528
caaee3c
c2eecf7
18e0516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| driver_repo=$(pwd) | ||
| kernel_repo=${DATABRICKS_SQL_KERNEL_REPO:-../../databricks-sql-kernel} | ||
| napi_dir="${kernel_repo}/napi" | ||
| napi_major=$( | ||
| cargo metadata --format-version 1 --locked --manifest-path "${napi_dir}/Cargo.toml" | | ||
| node -e ' | ||
| const metadata = JSON.parse(require("fs").readFileSync(0, "utf8")); | ||
| const rootId = metadata.resolve.root ?? metadata.workspace_members[0]; | ||
| const root = metadata.resolve.nodes.find(({ id }) => id === rootId); | ||
| const napiId = root?.deps.find(({ name }) => name === "napi")?.pkg; | ||
| const version = metadata.packages.find(({ id }) => id === napiId)?.version; | ||
| process.stdout.write(version?.split(".")[0] ?? ""); | ||
| ' | ||
| ) | ||
|
|
||
| # napi-rs v2 and v3 derive macros expect different CLI environment variables. | ||
| case "${napi_major}" in | ||
| 2) | ||
| cli=(npx --yes @napi-rs/cli@2.18.4) | ||
| ;; | ||
| 3) | ||
| cli=(npx --yes --package @napi-rs/cli@3.8.2 napi) | ||
| ;; | ||
| *) | ||
| echo "Unsupported napi-rs major version: ${napi_major:-unknown}" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| build_profile=${BUILD_PROFILE---release} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — The default operator changed from Consequence: running with If empty-means-debug is intentional (the whitespace-stripping |
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium — When On bash 4.3 and earlier, expanding an empty array as The release default path is unaffected (the array holds |
||
| cd "${napi_dir}" | ||
| if [[ -n "${build_profile//[[:space:]]/}" ]]; then | ||
| read -r -a build_profile_args <<< "${build_profile}" | ||
| "${cli[@]}" build --platform "${build_profile_args[@]}" | ||
| else | ||
| "${cli[@]}" build --platform | ||
| fi | ||
| cp index.* "${driver_repo}/native/kernel/" | ||
Uh oh!
There was an error while loading. Please reload this page.