Skip to content

fix client package self-reference and alpha publish workflow#433

Open
ekraffmiller wants to merge 1 commit intodevelopfrom
fix-package-dependencies
Open

fix client package self-reference and alpha publish workflow#433
ekraffmiller wants to merge 1 commit intodevelopfrom
fix-package-dependencies

Conversation

@ekraffmiller
Copy link
Contributor

@ekraffmiller ekraffmiller commented Mar 20, 2026

What this PR does / why we need it:

  • Removes the self-dependency from @IQSS/dataverse-client-javascript
  • Fxes GitHub Packages publish workflows to use the correct lowercase package name and the current base version for alpha releases.

Which issue(s) this PR closes:

  • Closes #

Related Dataverse PRs:

  • Depends on #

Special notes for your reviewer:

Suggestions on how to test this:

Is there a release notes or changelog update needed for this change?:

Additional documentation:

@ekraffmiller ekraffmiller marked this pull request as ready for review March 20, 2026 18:05
Copilot AI review requested due to automatic review settings March 20, 2026 18:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes publishing/versioning issues for the scoped npm package and removes an erroneous self-dependency to ensure installs and GitHub Packages publishing work correctly.

Changes:

  • Removed the package’s self-reference from dependencies in package.json.
  • Updated PR and alpha publish workflows to use the lowercase @iqss scope.
  • Adjusted alpha version calculation to derive the base version from package.json instead of hardcoding.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
package.json Removes self-dependency that would cause circular/self install behavior.
.github/workflows/deploy_pr.yml Publishes using the correct lowercase scope without rewriting package name.
.github/workflows/deploy_alpha.yml Computes alpha versions from current package version and publishes under lowercase scope.
Comments suppressed due to low confidence (1)

package.json:65

  • package-lock.json still contains an entry for "@iqss/dataverse-client-javascript": "^2.1.0" (and a node_modules section). Since this dependency was removed from package.json, the lockfile should be regenerated/updated; otherwise npm ci will fail due to package.json/package-lock.json mismatch.
  "dependencies": {
    "@types/node": "^18.15.11",
    "@types/turndown": "^5.0.1",
    "axios": "^1.12.2",
    "turndown": "^7.1.2",
    "typescript": "^4.9.5"
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +75 to 83
BASE_VERSION=${CURRENT_PACKAGE_VERSION%%-alpha.*}

LATEST_VERSION=$(npm show @IQSS/dataverse-client-javascript versions --registry=https://npm.pkg.github.com/ --json | jq -r '.[]' | grep "^2.0.0-alpha." | sort -V | tail -n 1)
LATEST_VERSION=$(npm show @iqss/dataverse-client-javascript versions --registry=https://npm.pkg.github.com/ --json | jq -r '.[]' | grep "^${BASE_VERSION}-alpha\\." | sort -V | tail -n 1)

if [ -z "$LATEST_VERSION" ]; then
NEW_INCREMENTAL_NUMBER=1
else
CURRENT_INCREMENTAL_NUMBER=$(echo $LATEST_VERSION | sed 's/2.0.0-alpha.//')
CURRENT_INCREMENTAL_NUMBER=$(echo "$LATEST_VERSION" | sed "s/^${BASE_VERSION}-alpha\\.//")
NEW_INCREMENTAL_NUMBER=$((CURRENT_INCREMENTAL_NUMBER + 1))
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BASE_VERSION is interpolated into grep/sed regexes, but it contains dots (e.g. 2.1.0) which are regex metacharacters. This can cause incorrect matches/extractions. Escape BASE_VERSION for regex use (or use fixed-string matching) before using it in the grep and sed patterns.

Copilot uses AI. Check for mistakes.
BASE_VERSION=${CURRENT_PACKAGE_VERSION%%-alpha.*}

LATEST_VERSION=$(npm show @IQSS/dataverse-client-javascript versions --registry=https://npm.pkg.github.com/ --json | jq -r '.[]' | grep "^2.0.0-alpha." | sort -V | tail -n 1)
LATEST_VERSION=$(npm show @iqss/dataverse-client-javascript versions --registry=https://npm.pkg.github.com/ --json | jq -r '.[]' | grep "^${BASE_VERSION}-alpha\\." | sort -V | tail -n 1)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm show ... versions --json can return either an array or a single string when only one version exists. Using jq -r '.[]' will error on the string case and fail the workflow. Make the jq filter handle both array and string outputs so first-time/low-version packages don’t break alpha publishing.

Suggested change
LATEST_VERSION=$(npm show @iqss/dataverse-client-javascript versions --registry=https://npm.pkg.github.com/ --json | jq -r '.[]' | grep "^${BASE_VERSION}-alpha\\." | sort -V | tail -n 1)
LATEST_VERSION=$(npm show @iqss/dataverse-client-javascript versions --registry=https://npm.pkg.github.com/ --json | jq -r 'if type=="array" then .[] else . end' | grep "^${BASE_VERSION}-alpha\\." | sort -V | tail -n 1)

Copilot uses AI. Check for mistakes.
@ChengShi-1 ChengShi-1 self-requested a review March 20, 2026 18:11
Copy link
Contributor

@ChengShi-1 ChengShi-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants