gatsby-source-ghost
Advanced tools
Comparing version 2.0.0 to 2.1.0
21
api.js
const axios = require('axios'); | ||
const qs = require('qs'); | ||
const printError = (...args) => printError(...args); // eslint-disable-line no-console | ||
const printError = (...args) => console.error('\n', ...args); // eslint-disable-line no-console | ||
module.exports.fetchAllPosts = (options) => { | ||
if (!options.clientId || !options.clientSecret || !options.adminUrl) { | ||
if (!options.clientId || !options.clientSecret || !options.apiUrl) { | ||
printError('Plugin Configuration Missing: gatsby-source-ghost requires your adminUrl, clientId and clientSecret'); | ||
return; | ||
process.exit(1); | ||
} | ||
const baseApiUrl = `https://${options.adminUrl}/ghost/api/v0.1`; | ||
if (options.apiUrl.substring(0, 4) !== 'http') { | ||
printError('Ghost apiUrl requires a protocol, E.g. https://<yourdomain>.ghost.io'); | ||
process.exit(1); | ||
} | ||
if (options.apiUrl.substring(0, 8) !== 'https://') { | ||
printError('Ghost apiUrl should be served over HTTPS, are you sure you want:', options.apiUrl, '?'); | ||
} | ||
const baseApiUrl = `${options.apiUrl}/ghost/api/v0.1`; | ||
const postApiOptions = { | ||
@@ -26,6 +35,6 @@ client_id: options.clientId, | ||
.catch((err) => { | ||
printError('\nUnable to fetch data from your Ghost API. Perhaps your credentials or adminUrl are incorrect?'); | ||
printError('\nError:', err); | ||
printError('Error:', err); | ||
printError('Unable to fetch data from your Ghost API. Perhaps your credentials or apiUrl are incorrect?'); | ||
process.exit(1); | ||
}); | ||
}; |
{ | ||
"name": "gatsby-source-ghost", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Gatsby source plugin for building websites using the Ghost API as a data source.", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:TryGhost/gatsby-plugin-ghost.git", |
@@ -17,3 +17,3 @@ # Gatsby Source Ghost | ||
options: { | ||
adminUrl: `<your-subdomain>.ghost.io`, | ||
apiUrl: `https://<your-subdomain>.ghost.io`, | ||
clientId: `ghost-frontend`, | ||
@@ -25,4 +25,4 @@ clientSecret: `<your client secret>` | ||
`adminUrl` | ||
The admin URL of your Ghost site. For Ghost(Pro) customers this is your `.ghost.io` domain. For self hosters it is your main domain unless you have a separate `admin` url configured. Note this URL _must_ work over HTTPS. | ||
`apiUrl` | ||
The admin or API URL for your Ghost site. For Ghost(Pro) customers this is your `.ghost.io` domain. For self hosters it is your main domain unless you have a separate `admin` url configured. Note that this URL should be served over HTTPS. | ||
@@ -29,0 +29,0 @@ `clientId` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10458
154
0