Skip to content

Commit 3b63734

Browse files
authored
upgrade ndc-nodejs version to v1.15.0 (#98)
1 parent 8105feb commit 3b63734

File tree

4 files changed

+113
-1
lines changed

4 files changed

+113
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Update NDC NodeJS Lambda to `v1.15.0` ([#98](https://github.com/hasura/ndc-open-api-lambda/pull/98))
56
- Add support for `.npmrc` ([#96](https://github.com/hasura/ndc-open-api-lambda/pull/96))
67

78
## [[1.6.1](https://github.com/hasura/ndc-open-api-lambda/releases/tag/v1.6.1)] 2025-05-12

connector-definition/.hasura-connector/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/hasura/ndc-nodejs-lambda:v1.14.0
1+
FROM ghcr.io/hasura/ndc-nodejs-lambda:v1.15.0
22

33
COPY package-lock.json package.json api.ts /functions/
44

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
param(
2+
[Parameter(Mandatory=$true)]
3+
[string]$connector_path,
4+
5+
[Parameter(Mandatory=$true)]
6+
[string]$target_connector_version,
7+
8+
[Parameter(Mandatory=$false)]
9+
[string[]]$npm_flags = @()
10+
)
11+
12+
if (-not (Get-Command "npm" -ErrorAction SilentlyContinue)) {
13+
Write-Host "npm could not be found. Is Node.js installed?"
14+
exit 1
15+
}
16+
17+
Push-Location $connector_path -ErrorAction Stop
18+
try {
19+
try {
20+
$packageJson = Get-Content 'package.json' -Raw | ConvertFrom-Json
21+
$existing_connector_version = $packageJson.dependencies.'@hasura/ndc-lambda-sdk'
22+
} catch {
23+
Write-Host "Unable to read the @hasura/ndc-lambda-sdk version from your package.json"
24+
Write-Host "Please manually upgrade the @hasura/ndc-lambda-sdk package in your package.json to version $target_connector_version"
25+
exit 1
26+
}
27+
28+
if (-not $existing_connector_version) {
29+
# This is very strange, their package.json must have the SDK installed but doesn't
30+
# We'll roll with it and just install the package
31+
Write-Host "Missing the @hasura/ndc-lambda-sdk package in your package.json. Installing version $target_connector_version"
32+
} else {
33+
Write-Host "Upgrading @hasura/ndc-lambda-sdk package from version $existing_connector_version to version $target_connector_version"
34+
}
35+
36+
try {
37+
& npm install "@hasura/ndc-lambda-sdk@$target_connector_version" --save-exact --no-update-notifier @npm_flags
38+
$exit_status = $LASTEXITCODE
39+
} catch {
40+
$exit_status = 1
41+
}
42+
43+
if ($exit_status -ne 0) {
44+
Write-Host "Failed to upgrade @hasura/ndc-lambda-sdk package to version $target_connector_version"
45+
Write-Host "Please manually upgrade the @hasura/ndc-lambda-sdk package in your package.json to version $target_connector_version"
46+
exit 1
47+
}
48+
49+
Write-Host "Successfully upgraded @hasura/ndc-lambda-sdk package to version $target_connector_version"
50+
} finally {
51+
Pop-Location
52+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
set -eu -o pipefail
3+
4+
connector_path="${1:-}"
5+
target_connector_version="${2:-}"
6+
npm_flags="${3:-}"
7+
8+
if [ -z "$connector_path" ]; then
9+
echo "Error: connector path must be passed as the first argument"
10+
exit 1
11+
fi
12+
13+
if [ -z "$target_connector_version" ]; then
14+
echo "Error: target connector version must be passed as the second argument"
15+
exit 1
16+
fi
17+
18+
if ! command -v npm &> /dev/null
19+
then
20+
echo "npm could not be found on the PATH. Is Node.js installed?"
21+
exit 1
22+
fi
23+
24+
if ! command -v jq &> /dev/null
25+
then
26+
echo "jq could not be found on the PATH. Is jq installed?"
27+
exit 1
28+
fi
29+
30+
cd "$connector_path"
31+
32+
set +e
33+
existing_connector_version=$(jq '.dependencies["@hasura/ndc-lambda-sdk"]' -r package.json)
34+
exit_status=$?
35+
if [ $exit_status -ne 0 ]; then
36+
echo "Unable to read the @hasura/ndc-lambda-sdk version from your package.json"
37+
echo "Please manually upgrade the @hasura/ndc-lambda-sdk package in your package.json to version $target_connector_version"
38+
exit 1
39+
fi
40+
41+
if [ $existing_connector_version = "null" ]; then
42+
# This is very strange, their package.json must have the SDK installed but doesn't
43+
# We'll roll with it and just install the package
44+
echo "Missing the @hasura/ndc-lambda-sdk package in your package.json. Installing version $target_connector_version"
45+
else
46+
echo "Upgrading @hasura/ndc-lambda-sdk package from version $existing_connector_version to version $target_connector_version"
47+
fi
48+
49+
npm install "@hasura/ndc-lambda-sdk@$target_connector_version" --save-exact --no-update-notifier $npm_flags
50+
exit_status=$?
51+
set -e
52+
53+
if [ $exit_status -ne 0 ]; then
54+
echo "Failed to upgrade @hasura/ndc-lambda-sdk package to version $target_connector_version"
55+
echo "Please manually upgrade the @hasura/ndc-lambda-sdk package in your package.json to version $target_connector_version"
56+
exit 1
57+
fi
58+
59+
echo "Successfully upgraded @hasura/ndc-lambda-sdk package to version $target_connector_version"

0 commit comments

Comments
 (0)