gatsby-plugin-statsy
Advanced tools
Comparing version
@@ -6,2 +6,5 @@ "use strict"; | ||
siteId: Joi.string().description(`Your Statsy site ID`).required(), | ||
mode: Joi.string().description( | ||
"The mode of tracking script. `production` or `development`. Defaults to `auto`." | ||
).default("auto").valid("production", "development", "auto"), | ||
trackingEndpointDomain: Joi.string().description( | ||
@@ -8,0 +11,0 @@ `Your optional self hosted Statsy domain. If you are using the self hosted version of Statsy, you can set this to your domain.` |
@@ -28,4 +28,24 @@ "use strict"; | ||
var import_minimatch = require("minimatch"); | ||
function isProduction() { | ||
if (process.env.NODE_ENV === `production`) { | ||
return true; | ||
} | ||
} | ||
function isTest() { | ||
if (process.env.NODE_ENV === `test`) { | ||
return true; | ||
} | ||
} | ||
var onRenderBody = async ({ setHeadComponents, setPostBodyComponents }, pluginOptions) => { | ||
if (process.env.NODE_ENV !== `production` && process.env.NODE_ENV !== `test`) | ||
let { mode } = pluginOptions; | ||
if (!mode || mode === "auto") { | ||
if (isProduction()) { | ||
mode = `production`; | ||
} else if (isTest()) { | ||
mode = `development`; | ||
} else { | ||
mode = `development`; | ||
} | ||
} | ||
if (mode === `development`) | ||
return null; | ||
@@ -32,0 +52,0 @@ const origin = `https://${pluginOptions.trackingEndpointDomain || `statsy.observer`}`; |
{ | ||
"name": "gatsby-plugin-statsy", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "", | ||
@@ -25,3 +25,3 @@ "main": "./dist/index.js", | ||
"typescript": "^5.0.4", | ||
"@statsy/analytics": "0.1.4" | ||
"@statsy/analytics": "0.1.5" | ||
}, | ||
@@ -28,0 +28,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28312
12.51%302
17.97%