<commit_before>/**
 * Module for installing Encoda native modules and executables
 *
 * The [`pkg`](https://github.com/zeit/pkg) Node.js packager does not
 * package native modules.  i.e `*.node` files. There are various ways to handle this but
 * we found the easiest/safest was to simply copy the directories for the
 * packages with native modules, from the host system, into directory where the
 * binary is installed. This script does that via `encoda-deps.tar.gz` which is
 * packaged in the binary snapshot as an `asset`.
 *
 * See:
 *   - https://github.com/stencila/encoda/pull/47#issuecomment-489912132
 *   - https://github.com/zeit/pkg/issues/329
 *   - https://github.com/JoshuaWise/better-sqlite3/issues/173
 *   - `package.json`
 */
import fs from 'fs-extra'
import path from 'path'
import puppeteer from 'puppeteer'
import tar from 'tar'

import { getLogger } from '@stencila/logga'

const logger = getLogger('stencila')

/**
 * Is this process being run as a `pkg` packaged binary?
 */
const packaged =
  ((process.mainModule && process.mainModule.id.endsWith('.exe')) ||
    process.hasOwnProperty('pkg')) &&
  fs.existsSync(path.join('/', 'snapshot'))

/**
 * The home directory for this modules or process where
 * native modules and executables are placed.
 */
const home = packaged ? path.dirname(process.execPath) : path.dirname(__dirname)

/**
 *  Unzip the native dependencies to home
 */
export function extractDeps(forceExtract: boolean = false) {
  const shouldExtract =
    packaged && (forceExtract || fs.existsSync(path.join(home, 'node_modules')))
  if (shouldExtract) {
    tar.x({
      sync: true,
      file: path.join('/', 'snapshot', 'stencila', 'stencila-deps.tgz'),
      C: home
    })

    logger.info('Dependencies extracted.')
  }
}
<commit_msg>chore: Remove puppeteer from code<commit_after>/**
 * Module for installing Encoda native modules and executables
 *
 * The [`pkg`](https://github.com/zeit/pkg) Node.js packager does not
 * package native modules.  i.e `*.node` files. There are various ways to handle this but
 * we found the easiest/safest was to simply copy the directories for the
 * packages with native modules, from the host system, into directory where the
 * binary is installed. This script does that via `encoda-deps.tar.gz` which is
 * packaged in the binary snapshot as an `asset`.
 *
 * See:
 *   - https://github.com/stencila/encoda/pull/47#issuecomment-489912132
 *   - https://github.com/zeit/pkg/issues/329
 *   - https://github.com/JoshuaWise/better-sqlite3/issues/173
 *   - `package.json`
 */
import fs from 'fs-extra'
import path from 'path'
import tar from 'tar'

import { getLogger } from '@stencila/logga'

const logger = getLogger('stencila')

/**
 * Is this process being run as a `pkg` packaged binary?
 */
const packaged =
  ((process.mainModule && process.mainModule.id.endsWith('.exe')) ||
    process.hasOwnProperty('pkg')) &&
  fs.existsSync(path.join('/', 'snapshot'))

/**
 * The home directory for this modules or process where
 * native modules and executables are placed.
 */
const home = packaged ? path.dirname(process.execPath) : path.dirname(__dirname)

/**
 *  Unzip the native dependencies to home
 */
export function extractDeps(forceExtract: boolean = false) {
  const shouldExtract =
    packaged && (forceExtract || fs.existsSync(path.join(home, 'node_modules')))
  if (shouldExtract) {
    tar.x({
      sync: true,
      file: path.join('/', 'snapshot', 'stencila', 'stencila-deps.tgz'),
      C: home
    })

    logger.info('Dependencies extracted.')
  }
}

{'fraction_non_alphanumeric': 0.13327721661054995, 'fraction_numerical': 0.010101010101010102, 'mean_word_length': 3.7093791281373845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '4170665', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1092, 'n_words': 336}