From 57940dc71277fa0618d8dc6ad34130d2cd62947f Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 21 Nov 2019 16:31:11 +0100 Subject: [PATCH] refactor for getting latest squid-js github release --- gatsby-node.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index bb4e0ad0..cc31d127 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -86,7 +86,7 @@ exports.createPages = ({ graphql, actions }) => { ) { name releases( - first: 1 + first: 30 orderBy: { field: CREATED_AT direction: DESC @@ -94,6 +94,8 @@ exports.createPages = ({ graphql, actions }) => { ) { edges { node { + isPrerelease + isDraft releaseAssets( first: 1 name: "squid-js.json" @@ -165,11 +167,13 @@ exports.createPages = ({ graphql, actions }) => { await createSwaggerPages(createPage) // API: squid-js + const lastRelease = result.data.squidJs.repository.releases.edges.filter( + ({ node }) => !node.isPrerelease && !node.isDraft + )[0].node.releaseAssets.edges[0].node await createTypeDocPage( createPage, result.data.squidJs.repository.name, - result.data.squidJs.repository.releases.edges[0].node - .releaseAssets.edges[0].node.downloadUrl + lastRelease.downloadUrl ) //