Skip to content
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

Add cran support #255

Merged
merged 1 commit into from
Oct 6, 2020
Merged

Add cran support #255

merged 1 commit into from
Oct 6, 2020

Conversation

stefanbuck
Copy link
Member

@stefanbuck stefanbuck commented Oct 1, 2020

Add cran to support as outlined in #252

Example:
https://octolinker-api.now.sh/?cran=usethis

@vercel
Copy link

vercel bot commented Oct 1, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/octolinker/octolinker-api/7kspi6bgz
✅ Preview: https://octolinker-api-git-cran-support.octolinker1.vercel.app

@@ -63,6 +64,13 @@ async function resolve(type, packageName) {
}
}

if (type === 'cran') {
// Some packages export multiple urls seperated by comma.
urls = urls.map((url) => url.split(',').map((s) => s.trim())).flat();
Copy link
Member Author

Choose a reason for hiding this comment

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

Fore example https://crandb.r-pkg.org/usethis returns the following resposne

{
...
URL": "https://usethis.r-lib.org, https://github.com/r-lib/usethis",

@@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '12.x'
Copy link
Member Author

Choose a reason for hiding this comment

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

Sync Node.js version with version specified in the package.json file

api/package.json

Lines 38 to 40 in 2758891

"engines": {
"node": "12.x"
},

@@ -68,7 +68,7 @@ module.exports = async (req, res) => {
await cache.auth();
const timingCacheAuth = Date.now() - timingCacheAuthStart;

let result;
let result = [];
Copy link
Member Author

Choose a reason for hiding this comment

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

result is being used within the finally catch block, which could break under some conditions. Adding an initial value helps preventing this

@stefanbuck stefanbuck merged commit 35c81d1 into master Oct 6, 2020
@stefanbuck stefanbuck deleted the cran-support branch October 6, 2020 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants