Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getGatsbyCliVersion() {
try {
const jsonfile = join(
require
.resolve(`gatsby-cli`) // Resolve where current gatsby-cli would be loaded from.
.split(sep)
.slice(0, -2) // drop lib/index.js
.join(sep),
`package.json`
)
const { version } = require(jsonfile).version
return version
} catch (e) {
// ignore
}
return undefined
}
captureEvent(type = ``, tags = {}, opts = { debounce: false }) {
constructor() {
try {
if (this.store.isTrackingDisabled()) {
this.trackingEnabled = false
}
this.defaultTags = this.getTagsFromEnv()
// These may throw and should be last
this.componentVersion = require(`../package.json`).version
this.gatsbyCliVersion = this.getGatsbyCliVersion()
this.installedGatsbyVersion = this.getGatsbyVersion()
} catch (e) {
// ignore
}
}