fix client package self-reference and alpha publish workflow#433
fix client package self-reference and alpha publish workflow#433ekraffmiller wants to merge 1 commit intodevelopfrom
Conversation
There was a problem hiding this comment.
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
dependenciesinpackage.json. - Updated PR and alpha publish workflows to use the lowercase
@iqssscope. - Adjusted alpha version calculation to derive the base version from
package.jsoninstead 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 ciwill 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.
| 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)) |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
| 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) |
What this PR does / why we need it:
Which issue(s) this PR closes:
Related Dataverse PRs:
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: