How to use the @pkgr/utils.tryRequirePkg function in @pkgr/utils

To help you get started, we’ve selected a few @pkgr/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 1stG / configs / packages / babel-preset / index.js View on Github external
}

    const reactPreset = [
      require('@babel/preset-react'),
      {
        development: isDev,
      },
    ]
    const reactPlugin = isProd
      ? [
          require('babel-plugin-transform-react-remove-prop-types'),
          {
            removeImport: true,
          },
        ]
      : isDev && tryRequirePkg('react-hot-loader/babel')

    if (react) {
      presets.push(reactPreset)

      if (reactPlugin) {
        plugins.push(reactPlugin)
      }
    }

    if (vue) {
      presets.push('@vue/babel-preset-jsx')
    }

    return {
      presets,
      plugins,
github 1stG / configs / packages / eslint-config / _util.js View on Github external
exports.allowModules = monorepoPkgs.reduce((acc, pkg) => {
    const pkgJson = tryRequirePkg(resolve(pkg, 'package.json'))
    if (!pkgJson) {
      return acc
    }
    const { name, peerDependencies = {}, dependencies = {} } = pkgJson
    return acc.concat(
      name,
      Object.keys(peerDependencies),
      Object.keys(dependencies),
    )
  }, [])
}

@pkgr/utils

Shared utils for `@pkgr` packages or any package else

MIT
Latest version published 11 months ago

Package Health Score

74 / 100
Full package analysis

Similar packages