CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-envinfo

Command-line tool and library for collecting development environment information needed for debugging and troubleshooting software issues

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

configuration-presets.mddocs/

Configuration Presets

Pre-configured templates for common development environments and frameworks that provide optimized environment collection for specific use cases.

Capabilities

Default Configuration

The standard preset used when no specific configuration is provided.

/**
 * Default environment collection configuration
 * Includes all major categories for comprehensive environment reporting
 */
presets.defaults = {
  System: ['OS', 'CPU', 'Memory', 'Container', 'Shell'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun', 'Watchman'],
  Managers: ['Apt', 'Cargo', 'CocoaPods', 'Composer', 'Gradle', 'Homebrew', 'Maven', 'pip2', 'pip3', 'RubyGems', 'Yum'],
  Utilities: ['Bazel', 'CMake', 'Make', 'GCC', 'Git', 'Clang', 'Ninja', 'Mercurial', 'Subversion', 'FFmpeg', 'Curl', 'OpenSSL'],
  Servers: ['Apache', 'Nginx'],
  Virtualization: ['Docker', 'Docker Compose', 'Parallels', 'VirtualBox', 'VMware Fusion'],
  SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'],
  IDEs: ['Android Studio', 'Atom', 'Emacs', 'IntelliJ', 'NVim', 'Nano', 'PhpStorm', 'Sublime Text', 'VSCode', 'Visual Studio', 'Vim', 'WebStorm', 'Xcode'],
  Languages: ['Bash', 'Go', 'Elixir', 'Erlang', 'Java', 'Perl', 'PHP', 'Protoc', 'Python', 'Python3', 'R', 'Ruby', 'Rust', 'Scala'],
  Databases: ['MongoDB', 'MySQL', 'PostgreSQL', 'SQLite'],
  Browsers: ['Brave Browser', 'Chrome', 'Chrome Canary', 'Chromium', 'Edge', 'Firefox', 'Firefox Developer Edition', 'Firefox Nightly', 'Internet Explorer', 'Safari', 'Safari Technology Preview'],
  Monorepos: ['Yarn Workspaces', 'Lerna'],
  npmPackages: null,        // Not collected by default
  npmGlobalPackages: null   // Not collected by default
};

React Native Development

Optimized configuration for React Native development environments.

/**
 * React Native development preset
 * Focuses on mobile development tools and React Native ecosystem
 */
presets['react-native'] = {
  System: ['OS', 'CPU'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun', 'Watchman'],
  SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'],
  IDEs: ['Android Studio', 'Xcode', 'Visual Studio'],
  npmPackages: ['react', 'react-native'],
  npmGlobalPackages: ['react-native-cli']
};

Usage Example:

const envinfo = require('envinfo');

// Use React Native preset
const result = await envinfo.run('react-native');
// Or explicitly
const result = await envinfo.run({ preset: 'react-native' });

Jest Testing Framework

Configuration tailored for Jest testing environments.

/**
 * Jest testing framework preset
 * Minimal system info with Jest package detection
 */
presets.jest = {
  System: ['OS', 'CPU'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun'],
  npmPackages: ['jest']
};

Webpack Build Tool

Configuration for Webpack-based build environments.

/**
 * Webpack build tool preset
 * Includes webpack packages and related build tools
 */
presets.webpack = {
  System: ['OS', 'CPU'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun'],
  npmPackages: '*webpack*',                    // All webpack-related packages
  npmGlobalPackages: ['webpack', 'webpack-cli']
};

Create React App

Comprehensive preset for Create React App development.

/**
 * Create React App preset
 * Includes browsers for testing and CRA-specific packages
 */
presets['create-react-app'] = {
  System: ['OS', 'CPU'],
  Binaries: ['Node', 'npm', 'Yarn', 'pnpm', 'bun'],
  Browsers: ['Chrome', 'Edge', 'Internet Explorer', 'Firefox', 'Safari'],
  npmPackages: ['react', 'react-dom', 'react-scripts'],
  npmGlobalPackages: ['create-react-app'],
  options: {
    duplicates: true,      // Show duplicate package versions
    showNotFound: true     // Include missing packages in output
  }
};

CSS Build Tools

Configuration for CSS processing with cssnano.

/**
 * CSS build tools preset (cssnano example)
 * Minimal configuration for CSS processing environments
 */
presets.cssnano = {
  System: ['OS', 'CPU'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun'],
  npmPackages: ['cssnano', 'postcss'],
  options: {
    duplicates: true
  }
};

Code Coverage (NYC)

Configuration for NYC code coverage analysis.

/**
 * NYC code coverage preset
 * Includes testing and coverage related packages
 */
presets.nyc = {
  System: ['OS', 'CPU', 'Memory'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun'],
  npmPackages: '/**/{*babel*,@babel/*/,*istanbul*,nyc,source-map-support,typescript,ts-node}'
};

Styled Components

Configuration for styled-components development.

/**
 * Styled components preset
 * Includes browsers for styling testing
 */
presets['styled-components'] = {
  System: ['OS', 'CPU'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun'],
  Browsers: ['Chrome', 'Firefox', 'Safari'],
  npmPackages: '*styled-components*'
};

Apollo GraphQL

Configuration for Apollo GraphQL development.

/**
 * Apollo GraphQL preset
 * Includes apollo packages and modern browsers
 */
presets.apollo = {
  System: ['OS'],
  Binaries: ['Node', 'npm', 'Yarn', 'pnpm', 'bun'],
  Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
  npmPackages: '{*apollo*,@apollo/*}',
  npmGlobalPackages: '{*apollo*,@apollo/*}'
};

Babel Transpilation

Configuration for Babel JavaScript transpilation.

/**
 * Babel transpilation preset
 * Comprehensive package detection for build tools
 */
presets.babel = {
  System: ['OS'],
  Binaries: ['Node', 'npm', 'Yarn', 'pnpm', 'bun'],
  Monorepos: ['Yarn Workspaces', 'Lerna'],
  npmPackages: '{*babel*,@babel/*,eslint,webpack,create-react-app,react-native,lerna,jest,next,rollup}'
};

Playwright Testing

Configuration for Playwright end-to-end testing.

/**
 * Playwright testing preset
 * Includes system details and playwright packages
 */
presets.playwright = {
  System: ['OS', 'CPU', 'Memory', 'Container'],
  Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun'],
  Languages: ['Bash'],
  IDEs: ['VSCode'],
  npmPackages: '{playwright*,@playwright/*}'
};

React Native Web

Configuration for React Native Web development.

/**
 * React Native Web preset
 * Cross-platform React Native for web development
 */
presets['react-native-web'] = {
  System: ['OS', 'CPU'],
  Binaries: ['Node', 'npm', 'Yarn', 'pnpm', 'bun'],
  Browsers: ['Chrome', 'Edge', 'Internet Explorer', 'Firefox', 'Safari'],
  npmPackages: ['react', 'react-native-web'],
  options: {
    showNotFound: true
  }
};

Using Presets

Direct Preset Usage

const envinfo = require('envinfo');

// Use preset by name
const reactNativeEnv = await envinfo.run('react-native');
const jestEnv = await envinfo.run('jest');
const webpackEnv = await envinfo.run('webpack');

// Use preset with additional options
const craEnv = await envinfo.run('create-react-app', {
  json: true,
  console: false
});

Extending Presets

const envinfo = require('envinfo');

// Extend preset with additional configuration
const customConfig = {
  ...envinfo.presets['react-native'],
  Languages: ['Java', 'Swift'],         // Add languages
  npmPackages: ['react', 'react-native', 'expo']  // Override packages
};

const result = await envinfo.run(customConfig);

// Combine multiple presets (merge manually)
const combinedConfig = {
  System: envinfo.presets.jest.System,
  Binaries: envinfo.presets.webpack.Binaries,
  npmPackages: ['jest', 'webpack', 'react'],
  options: {
    duplicates: true,
    json: true
  }
};

Custom Presets

// Create custom preset for your specific environment
const myCustomPreset = {
  System: ['OS', 'CPU', 'Memory'],
  Binaries: ['Node', 'npm'],
  Languages: ['Python', 'Go'],
  IDEs: ['VSCode'],
  npmPackages: ['express', 'mongoose', 'lodash'],
  npmGlobalPackages: ['nodemon', 'pm2'],
  options: {
    duplicates: true,
    markdown: true,
    title: 'My Development Environment'
  }
};

// Use custom preset
const result = await envinfo.run(myCustomPreset);

Preset Options

interface PresetOptions {
  duplicates?: boolean;      // Show duplicate package versions
  showNotFound?: boolean;    // Include "Not Found" results
  fullTree?: boolean;        // Traverse full dependency tree
}

// Presets with options
const presetsWithOptions = {
  'create-react-app': { duplicates: true, showNotFound: true },
  'cssnano': { duplicates: true },
  'react-native-web': { showNotFound: true }
};

CLI Integration

Presets work seamlessly with the command-line interface:

# Use preset from command line
envinfo --preset react-native
envinfo --preset jest --json
envinfo --preset webpack --markdown

# Combine preset with additional options
envinfo --preset create-react-app --duplicates --json

Available Preset Names

// All available preset names
const availablePresets = [
  'defaults',           // Default comprehensive collection
  'react-native',       // React Native development
  'jest',              // Jest testing framework
  'webpack',           // Webpack build tool
  'create-react-app',  // Create React App
  'cssnano',           // CSS processing
  'nyc',               // Code coverage
  'styled-components', // Styled components
  'apollo',            // Apollo GraphQL
  'babel',             // Babel transpilation
  'playwright',        // Playwright testing
  'react-native-web'   // React Native Web
];

// Check if preset exists
const presetExists = (name) => name in envinfo.presets;

Install with Tessl CLI

npx tessl i tessl/npm-envinfo

docs

configuration-presets.md

core-functions.md

environment-detection.md

index.md

output-formatting.md

package-management.md

tile.json