<commit_before>#!/usr/bin/env node
const path = require(`path`)
const fs = require(`fs`)

const version = process.version
const verDigit = Number(version.match(/\d+/)[0])

if (verDigit < 4) {
  console.error(`Gatsby 1.0+ requires node.js v4 or higher (you have ${version}).
Upgrade node to the latest stable release.`)
  process.exit()
}

console.log(`bin/gatsby: time since started: ${process.uptime()}`)

console.time(`initial loading`)
global.appStartTime = Date.now()

/*
  Get the locally installed version of gatsby/lib/bin/cli.js from the place
  where this program was executed.
*/
const cliFile = `dist/bin/cli.js`
const localPath = path.resolve(`node_modules/gatsby`, cliFile)

const useGlobalGatsby = function() {
  // Never use global install for new and help commands
  if ([`new`, `--help`].includes(process.argv[2])) {
    report.error(`A local install of Gatsby was not found.
You should save Gatsby as a site dependency e.g. npm install --save gatsby`)
    process.exit()
  }

  require(`./bin/cli`)
}

if (fs.existsSync(localPath)) {
  try {
    require(localPath)
    console.timeEnd(`initial loading`)
  } catch (error) {
    report.error(`A local install of Gatsby exists but failed to load.`)
    report.error(error)
  }
} else {
  useGlobalGatsby()<commit_msg>fix typo<commit_after>#!/usr/bin/env node
const path = require(`path`)
const fs = require(`fs`)

const version = process.version
const verDigit = Number(version.match(/\d+/)[0])

if (verDigit < 4) {
  console.error(`Gatsby 1.0+ requires node.js v4 or higher (you have ${version}).
Upgrade node to the latest stable release.`)
  process.exit()
}

console.log(`bin/gatsby: time since started: ${process.uptime()}`)

console.time(`initial loading`)
global.appStartTime = Date.now()

/*
  Get the locally installed version of gatsby/lib/bin/cli.js from the place
  where this program was executed.
*/
const cliFile = `dist/bin/cli.js`
const localPath = path.resolve(`node_modules/gatsby`, cliFile)

const useGlobalGatsby = function() {
  // Never use global install for new and help commands
  if ([`new`, `--help`].includes(process.argv[2])) {
    console.error(`A local install of Gatsby was not found.
You should save Gatsby as a site dependency e.g. npm install --save gatsby`)
    process.exit()
  }

  require(`./bin/cli`)
}

if (fs.existsSync(localPath)) {
  try {
    require(localPath)
    console.timeEnd(`initial loading`)
  } catch (error) {
    console.error(`A local install of Gatsby exists but failed to load.`)
    console.error(error)
  }
} else {
  useGlobalGatsby()
{'fraction_non_alphanumeric': 0.14040561622464898, 'fraction_numerical': 0.0046801872074883, 'mean_word_length': 3.951737451737452, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3202363', 'n_tokens_mistral': 857, 'n_tokens_neox': 842, 'n_words': 250}