Skip to content

consume getJson function for better error messages #110

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

Merged
merged 1 commit into from
Feb 5, 2020

Conversation

ericsciple
Copy link
Collaborator

@ericsciple ericsciple commented Feb 5, 2020

also updated package.json scripts to align with setup-ruby, also ran npm audit fix

@ericsciple ericsciple force-pushed the users/ericsciple/m165json branch from a7a7e99 to 2cb5914 Compare February 5, 2020 16:06
@ericsciple ericsciple force-pushed the users/ericsciple/m165json branch from 2cb5914 to cf70565 Compare February 5, 2020 16:11
@@ -22,7 +22,6 @@ jobs:
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run pack
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

npm run build now runs ncc

@@ -5,12 +5,11 @@
"description": "setup node action",
"main": "lib/setup-node.js",
"scripts": {
"build": "tsc",
"build": "tsc && ncc build",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

aligned with the pattern set by setup-ruby

);
let body = await response.readBody();
let nodeVersions = JSON.parse(body) as INodeVersion[];
let response = await httpClient.getJson<INodeVersion[]>(dataUrl);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getJson now checks for errors, so i removed the error checking code here

let body = await response.readBody();
let nodeVersions = JSON.parse(body) as INodeVersion[];
let response = await httpClient.getJson<INodeVersion[]>(dataUrl);
let nodeVersions = response.result || [];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

|| [] is to satisfy typescript. Shouldnt be null since getJson checks for errors

@ericsciple ericsciple merged commit 1c5c137 into master Feb 5, 2020
@ericsciple ericsciple deleted the users/ericsciple/m165json branch February 5, 2020 16:20
crAlfred added a commit to crAlfred/setup-node that referenced this pull request Feb 12, 2020
krzyk pushed a commit to krzyk/setup-node that referenced this pull request Apr 11, 2023
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.

2 participants