### Get Git Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the Git installation. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Git info envinfo.helpers.getGitInfo().then(info => { console.log(info); // Output: ["Git", "2.38.1", "/usr/local/bin/git"] }); ``` -------------------------------- ### Example envinfo output Source: https://github.com/tabrindle/envinfo/blob/main/README.md This is an example of the report generated by running the envinfo command. ```bash System: OS: macOS Mojave 10.14.5 CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Memory: 2.97 GB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 8.16.0 - ~/.nvm/versions/node/v8.16.0/bin/node Yarn: 1.15.2 - ~/.yarn/bin/yarn npm: 6.9.0 - ~/.nvm/versions/node/v8.16.0/bin/npm pnpm: 8.7.6 - /usr/local/bin/pnpm bun: 1.0.2 - /usr/local/bin/bun Watchman: 4.9.0 - /usr/local/bin/watchman Managers: Cargo: 1.31.0 - ~/.cargo/bin/cargo CocoaPods: 1.7.3 - /usr/local/bin/pod Composer: 1.8.6 - /usr/local/bin/composer Gradle: 5.5 - /usr/local/bin/gradle Homebrew: 2.1.7 - /usr/local/bin/brew Maven: 3.6.1 - /usr/local/bin/mvn pip2: 19.0.3 - /usr/local/bin/pip2 pip3: 19.0.2 - /usr/local/bin/pip3 RubyGems: 2.5.2.3 - /usr/bin/gem Utilities: CMake: 3.13.3 - /usr/local/bin/cmake Make: 3.81 - /usr/bin/make GCC: 10.14. - /usr/bin/gcc Git: 2.20.0 - /usr/local/bin/git Mercurial: 4.5.3 - /usr/bin/hg Clang: 1001.0.46.4 - /usr/bin/clang Subversion: 1.10.3 - /usr/bin/svn Servers: Apache: 2.4.34 - /usr/sbin/apachectl Nginx: 1.13.12 - /usr/local/bin/nginx Virtualization: Docker: 18.09.1 - /usr/local/bin/docker Parallels: 13.3.0 - /usr/local/bin/prlctl VirtualBox: 5.2.20 - /usr/local/bin/vboxmanage SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 Android SDK: API Levels: 28 Build Tools: 28.0.3 System Images: android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Atom: 1.23.3 Emacs: 22.1.1 - /usr/bin/emacs Nano: 2.0.6 - /usr/bin/nano VSCode: 1.36.0 - /usr/local/bin/code Vim: 8.0 - /usr/bin/vim Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild Languages: Bash: 4.4.23 - /usr/local/bin/bash Elixir: 1.6.2 - /usr/local/bin/elixir Go: 1.11.1 - /usr/local/bin/go Java: 1.8.0_192 - /usr/bin/javac Perl: 5.18.4 - /usr/bin/perl PHP: 7.1.23 - /usr/bin/php Python: 2.7.16 - /usr/local/bin/python Python3: 3.7.2 - /usr/local/bin/python3 R: 3.6.0 - /usr/local/bin/R Ruby: 2.3.7 - /usr/bin/ruby Rust: 1.16.0 - /Users/tabrindle/.cargo/bin/rustup Databases: MongoDB: 3.6.4 - /usr/local/bin/mongo MySQL: 10.3.10 (MariaDB) - /usr/local/bin/mysql PostgreSQL: 10.3 - /usr/local/bin/postgres SQLite: 3.24.0 - /usr/bin/sqlite3 Browsers: Chrome: 75.0.3770.100 Chrome Canary: 77.0.3847.0 Firefox: 68.0 Firefox Developer Edition: 69.0 Firefox Nightly: 69.0a1 Safari: 12.1.1 Safari Technology Preview: 13.0 npmPackages: apollo-client: ^2.3.1 => 2.3.1 jest: ^22.2.1 => 22.2.1 ... react: ^16.3.2 => 16.3.2 react-apollo: ^2.1.4 => 2.1.4 run4staged: ^1.1.1 => 1.1.1 solidarity: 2.0.5 => 2.0.5 styled-components: ^3.1.6 => 3.1.6 npmGlobalPackages: create-react-app: 1.5.2 create-react-native-app: 1.0.0 envinfo: 5.10.0 exp: 49.2.2 gatsby-cli: 1.1.52 npm: 5.6.0 react-native-cli: 2.0.1 solidarity: 2.1.0 typescript: 2.8.1 ``` -------------------------------- ### Collect SDK Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --SDKs flag to gather information about installed SDKs. ```bash envinfo --SDKs ``` -------------------------------- ### Get Comprehensive System Report Source: https://context7.com/tabrindle/envinfo/llms.txt Generates a comprehensive system report by specifying desired categories and items using envinfo.run(). This example requests system, binaries, languages, IDEs, virtualization, and databases information in JSON format. Requires the envinfo library. ```javascript const envinfo = require('envinfo'); // Example: Get comprehensive system report envinfo.run({ System: ['OS', 'CPU', 'Memory', 'Shell'], Binaries: ['Node', 'npm', 'Yarn', 'pnpm'], Languages: ['Python3', 'Ruby', 'Go', 'Rust'], IDEs: ['VSCode', 'Vim', 'Xcode'], Virtualization: ['Docker'], Databases: ['PostgreSQL', 'MongoDB'], }, { json: true }).then(console.log); ``` -------------------------------- ### Combined Example: Preset, Duplicates, and Full Tree Source: https://context7.com/tabrindle/envinfo/llms.txt Use a preset configuration and enable duplicate package detection and full tree traversal. ```bash envinfo --preset webpack --duplicates --fullTree ``` -------------------------------- ### Show Version Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --version flag to display the installed version of envinfo. ```bash envinfo --version ``` -------------------------------- ### Combined Example: System, Binaries, and JSON Output Source: https://context7.com/tabrindle/envinfo/llms.txt Combine multiple flags to collect system and binary information and output it as JSON. ```bash envinfo --system --binaries --json ``` -------------------------------- ### Install envinfo globally Source: https://github.com/tabrindle/envinfo/blob/main/README.md Use this command to install the package globally for use as a CLI tool. ```sh npm install -g envinfo || yarn global add envinfo ``` -------------------------------- ### Install envinfo as a library Source: https://github.com/tabrindle/envinfo/blob/main/README.md Use this command to add the package as a dependency in another project. ```sh npm install envinfo || yarn add envinfo ``` -------------------------------- ### Envinfo JSON Output Example Source: https://github.com/tabrindle/envinfo/blob/main/README.md Example of the JSON structure returned by the envinfo.run method. ```json { "System": { "OS": "macOS High Sierra 10.13", "CPU": "x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" }, "Binaries": { "Node": { "version": "8.11.0", "path": "~/.nvm/versions/node/v8.11.0/bin/node" }, "Yarn": { "version": "1.5.1", "path": "~/.yarn/bin/yarn" }, "npm": { "version": "5.6.0", "path": "~/.nvm/versions/node/v8.11.0/bin/npm" } }, "Browsers": { "Chrome": { "version": "67.0.3396.62" }, "Firefox": { "version": "59.0.2" }, "Safari": { "version": "11.0" } }, "npmPackages": { "styled-components": { "wanted": "^3.2.1", "installed": "3.2.1" }, "babel-plugin-styled-components": "Not Found" } } ``` -------------------------------- ### Combined Example: System, Browsers, Markdown, and Title Source: https://context7.com/tabrindle/envinfo/llms.txt Collect system and browser information, output as Markdown, and add a custom title. ```bash envinfo --system --browsers --markdown --title "Browser Compatibility Check" ``` -------------------------------- ### Combined Example: npm Packages, JSON, and Show Not Found Source: https://context7.com/tabrindle/envinfo/llms.txt Collect specific npm packages using glob patterns, output as JSON, and include not found items. ```bash envinfo --npmPackages 'react*,@babel/*' --json --showNotFound ``` -------------------------------- ### Get Docker Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the Docker installation. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Docker info envinfo.helpers.getDockerInfo().then(info => { console.log(info); // Output: ["Docker", "20.10.21", "/usr/local/bin/docker"] }); ``` -------------------------------- ### Get npm Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the npm installation. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get npm info envinfo.helpers.getnpmInfo().then(info => { console.log(info); // Output: ["npm", "8.19.2", "/usr/local/bin/npm"] }); ``` -------------------------------- ### Get Node.js Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the Node.js installation. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Node.js info envinfo.helpers.getNodeInfo().then(info => { console.log(info); // Output: ["Node", "18.12.0", "/usr/local/bin/node"] }); ``` -------------------------------- ### Get Yarn Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the Yarn installation. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Yarn info envinfo.helpers.getYarnInfo().then(info => { console.log(info); // Output: ["Yarn", "1.22.19", "/usr/local/bin/yarn"] }); ``` -------------------------------- ### Get Python Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the Python 2 installation. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Python info envinfo.helpers.getPythonInfo().then(info => { console.log(info); // Output: ["Python", "2.7.18", "/usr/bin/python"] }); ``` -------------------------------- ### Get Python3 Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the Python 3 installation. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Python3 info envinfo.helpers.getPython3Info().then(info => { console.log(info); // Output: ["Python3", "3.10.8", "/usr/local/bin/python3"] }); ``` -------------------------------- ### Collect Programming Language Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --languages flag to get a list of all supported programming languages. ```bash envinfo --languages ``` -------------------------------- ### List Global pnpm Packages Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --pnpmGlobalPackages flag to list all globally installed pnpm packages. ```bash envinfo --pnpmGlobalPackages ``` -------------------------------- ### Collect Server Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --servers flag to get information about web servers like Apache and Nginx. ```bash envinfo --servers ``` -------------------------------- ### Get CPU Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the CPU. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get CPU info envinfo.helpers.getCPUInfo().then(info => { console.log(info); // Output: ["CPU", "(10) arm64 Apple M1 Pro"] }); ``` -------------------------------- ### Get OS Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about the operating system. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get OS info envinfo.helpers.getOSInfo().then(info => { console.log(info); // Output: ["OS", "macOS Monterey 12.6"] }); ``` -------------------------------- ### List Global npm Packages Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --npmGlobalPackages flag to list all globally installed npm packages. ```bash envinfo --npmGlobalPackages ``` -------------------------------- ### Get Memory Info Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves information about system memory. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Memory info envinfo.helpers.getMemoryInfo().then(info => { console.log(info); // Output: ["Memory", "4.23 GB / 16.00 GB"] }); ``` -------------------------------- ### CLI Usage for Environment Reporting Source: https://context7.com/tabrindle/envinfo/llms.txt Commands for installing and running envinfo to generate reports in various formats or for specific ecosystems. ```bash # Install globally npm install -g envinfo # Or use without installing npx envinfo # Basic usage - prints all default categories envinfo # Output example: # System: # OS: macOS Mojave 10.14.5 # CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz # Memory: 2.97 GB / 16.00 GB # Shell: 5.3 - /bin/zsh # Binaries: # Node: 8.16.0 - ~/.nvm/versions/node/v8.16.0/bin/node # Yarn: 1.15.2 - ~/.yarn/bin/yarn # npm: 6.9.0 - ~/.nvm/versions/node/v8.16.0/bin/npm # Get specific categories envinfo --system --binaries --browsers # Output in JSON format envinfo --system --binaries --json # Output in Markdown format (great for GitHub issues) envinfo --system --binaries --markdown # Get all available information envinfo --all # Use with a preset for specific tools envinfo --preset react-native envinfo --preset webpack envinfo --preset jest # Check specific npm packages envinfo --npmPackages react,react-dom,webpack # Check npm packages with glob patterns envinfo --npmPackages '*babel*' # Include duplicate package detection envinfo --npmPackages --duplicates --fullTree # Add a custom title to the report envinfo --system --title "Bug Report Environment" ``` -------------------------------- ### Get Chrome Browser Version Source: https://context7.com/tabrindle/envinfo/llms.txt Retrieves the version of the Chrome browser. Requires the envinfo library to be imported. ```javascript const envinfo = require('envinfo'); // Get Chrome browser version envinfo.helpers.getChromeInfo().then(info => { console.log(info); // Output: ["Chrome", "108.0.5359.124"] }); ``` -------------------------------- ### Show Help Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --help flag to display the help message and available CLI options. ```bash envinfo --help ``` -------------------------------- ### Print All Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --all flag to collect and display all available environment information. ```bash envinfo --all ``` -------------------------------- ### Collect Virtualization Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --virtualization flag to list virtualization software like Docker and VMware. ```bash envinfo --virtualization ``` -------------------------------- ### CLI Options Reference Source: https://github.com/tabrindle/envinfo/blob/main/README.md List of available command-line flags for configuring the output format and information scope. ```text --system Print general system info such as OS, CPU, Memory and Shell --browsers Get version numbers of installed web browsers --SDKs Get platforms, build tools and SDKs of iOS and Android --IDEs Get version numbers of installed IDEs --languages Get version numbers of installed languages such as Java, Python, PHP, etc --binaries Get version numbers of node, npm, watchman, etc --npmPackages Get version numbers of locally installed npm packages - glob, string, or comma delimited list --npmGlobalPackages Get version numbers of globally installed npm packages --duplicates Mark duplicate npm packages inside parentheses eg. (2.1.4) --fullTree Traverse entire node_modules dependency tree, not just top level --markdown Print output in markdown format --json Print output in JSON format --console Print to console (defaults to on for CLI usage, off for programmatic usage) ``` -------------------------------- ### Use Preset Configuration Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --preset flag followed by a preset name (e.g., react-native) to apply a predefined configuration. ```bash envinfo --preset react-native ``` -------------------------------- ### Collect Binary Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --binaries flag to list information about common development binaries like Node, npm, and Yarn. ```bash envinfo --binaries ``` -------------------------------- ### Collect Utility Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --utilities flag to list information about development utilities such as Git and Make. ```bash envinfo --utilities ``` -------------------------------- ### Collect IDE Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --IDEs flag to list all supported Integrated Development Environments. ```bash envinfo --IDEs ``` -------------------------------- ### Collect System Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --system flag to collect operating system, CPU, and memory details. ```bash envinfo --system ``` -------------------------------- ### Collect Browser Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --browsers flag to list all supported browsers. ```bash envinfo --browsers ``` -------------------------------- ### Run Envinfo Programmatically Source: https://github.com/tabrindle/envinfo/blob/main/README.md Executes envinfo with a configuration object to retrieve system, binary, and package information as a Promise. ```javascript import envinfo from 'envinfo'; envinfo.run( { System: ['OS', 'CPU'], Binaries: ['Node', 'Yarn', 'npm'], Browsers: ['Chrome', 'Firefox', 'Safari'], npmPackages: ['styled-components', 'babel-plugin-styled-components'], }, { json: true, showNotFound: true } ).then(env => console.log(env)); ``` -------------------------------- ### Raw JSON Configuration via CLI Source: https://context7.com/tabrindle/envinfo/llms.txt Provide a raw JSON string to specify exactly which environment information to collect. ```bash envinfo --raw '{"System":["OS","CPU"],"Binaries":["Node"]}' ``` -------------------------------- ### List All Local npm Packages Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --npmPackages flag to list all local npm packages in the current project. ```bash envinfo --npmPackages ``` -------------------------------- ### Define All Available Categories and Items Source: https://context7.com/tabrindle/envinfo/llms.txt Defines a comprehensive object listing all categories and their associated items that can be used with envinfo.run(). Includes system info, binaries, package managers, utilities, servers, virtualization, SDKs, IDEs, languages, databases, browsers, monorepos, and npm packages. ```javascript const envinfo = require('envinfo'); // All available categories and items const allCategories = { // System information System: ['OS', 'CPU', 'Memory', 'Container', 'Shell'], // Binary/runtime versions Binaries: ['Node', 'Yarn', 'npm', 'pnpm', 'bun', 'Deno', 'Watchman'], // Package managers Managers: [ 'Apt', 'Cargo', 'CocoaPods', 'Composer', 'Gradle', 'Homebrew', 'Maven', 'pip2', 'pip3', 'RubyGems', 'Yum' ], // Utility tools Utilities: [ '7z', 'Bazel', 'CMake', 'Make', 'GCC', 'Git', 'Git LFS', 'jq', 'Clang', 'Ninja', 'Mercurial', 'Subversion', 'FFmpeg', 'Curl', 'OpenSSL', 'ccache', 'Calibre', 'Clash Meta' ], // Web servers Servers: ['Apache', 'Nginx'], // Virtualization tools Virtualization: ['Docker', 'Docker Compose', 'Parallels', 'VirtualBox', 'VMware Fusion'], // Platform SDKs SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'], // Development IDEs and editors IDEs: [ 'Android Studio', 'Atom', 'Emacs', 'IntelliJ', 'NVim', 'Nano', 'PhpStorm', 'Sublime Text', 'VSCode', 'Cursor', 'Claude Code', 'Codex', 'opencode', 'Visual Studio', 'Vim', 'WebStorm', 'Xcode' ], // Programming languages Languages: [ 'Bash', 'Go', 'Elixir', 'Erlang', 'Java', 'Perl', 'PHP', 'Protoc', 'Python', 'Python3', 'R', 'Ruby', 'Rust', 'Scala', 'Zig' ], // Database systems Databases: ['MongoDB', 'MySQL', 'PostgreSQL', 'SQLite'], // Web browsers Browsers: [ 'Brave Browser', 'Chrome', 'Chrome Canary', 'Chromium', 'Edge', 'Firefox', 'Firefox Developer Edition', 'Firefox Nightly', 'Internet Explorer', 'Safari', 'Safari Technology Preview' ], // Monorepo tools Monorepos: ['Yarn Workspaces', 'Lerna'], // npm packages (special handling) npmPackages: ['react', 'webpack'], // array of names, glob pattern, or true for all npmGlobalPackages: true, // or array of package names pnpmGlobalPackages: true, // or array of package names }; ``` -------------------------------- ### Collect Package Manager Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --managers flag to list supported package managers like Cargo, Homebrew, and pip. ```bash envinfo --managers ``` -------------------------------- ### Construct Custom Environment Info Source: https://context7.com/tabrindle/envinfo/llms.txt Combines information from multiple helper functions (Node, npm, Yarn, OS) into a custom object. Uses Promise.all for concurrent retrieval. Requires the envinfo library. ```javascript const envinfo = require('envinfo'); // Construct custom output from multiple helpers async function getCustomEnvInfo() { const [node, npm, yarn, os] = await Promise.all([ envinfo.helpers.getNodeInfo(), envinfo.helpers.getnpmInfo(), envinfo.helpers.getYarnInfo(), envinfo.helpers.getOSInfo(), ]); return { os: os[1], node: `${node[1]} - ${node[2]}`, npm: `${npm[1]} - ${npm[2]}`, yarn: yarn[1] !== 'Not Found' ? `${yarn[1]} - ${yarn[2]}` : 'Not installed', }; } getCustomEnvInfo().then(console.log); // Output: // { // os: "macOS Monterey 12.6", // node: "18.12.0 - /usr/local/bin/node", // npm: "8.19.2 - /usr/local/bin/npm", // yarn: "1.22.19 - /usr/local/bin/yarn" // } ``` -------------------------------- ### Show Full Node Modules Tree Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --fullTree flag to traverse and display the entire node_modules dependency tree. ```bash envinfo --fullTree ``` -------------------------------- ### Retrieve npm package information with envinfo.run() Source: https://context7.com/tabrindle/envinfo/llms.txt Use specific package names, glob patterns, or dependency tree traversal to inspect local and global npm packages. ```javascript const envinfo = require('envinfo'); // Check specific packages envinfo.run( { System: ['OS', 'CPU'], Binaries: ['Node', 'npm'], npmPackages: ['react', 'react-dom', 'webpack'], }, { json: true, showNotFound: true } ).then(env => { console.log(env); // Output: // { // "System": { "OS": "macOS 12.6", "CPU": "arm64 Apple M1" }, // "Binaries": { "Node": {...}, "npm": {...} }, // "npmPackages": { // "react": { "wanted": "^18.2.0", "installed": "18.2.0" }, // "react-dom": { "wanted": "^18.2.0", "installed": "18.2.0" }, // "webpack": { "wanted": "^5.75.0", "installed": "5.75.0" } // } // } }); // Use glob patterns to find packages envinfo.run( { npmPackages: '*babel*', }, { json: true } ).then(env => console.log(env)); // Finds all packages matching *babel* pattern // Detect duplicate packages in node_modules envinfo.run( { npmPackages: ['lodash', 'react'], }, { json: true, duplicates: true, fullTree: true } ).then(env => console.log(env)); // Output shows duplicates: // { // "npmPackages": { // "lodash": { // "wanted": "^4.17.21", // "installed": "4.17.21", // "duplicates": ["4.17.15", "4.17.19"] // } // } // } // Check global npm packages envinfo.run( { npmGlobalPackages: ['typescript', 'create-react-app', 'npm'], }, { json: true } ).then(env => console.log(env)); // Check global pnpm packages envinfo.run( { pnpmGlobalPackages: true, }, { json: true } ).then(env => console.log(env)); ``` -------------------------------- ### Use Individual Envinfo Helpers Source: https://github.com/tabrindle/envinfo/blob/main/README.md Demonstrates using specific helper functions exported by envinfo, which return promises resolving to an array of values. ```javascript const envinfo = require('envinfo'); // each helper returns a promise const node = await envinfo.helpers.getNodeInfo(); // The promises resolve to an array of values: ["Name", "Version", "Path"] // e.g. ["Node", "10.9.0", "/usr/local/bin/node"] console.log(`Node: ${node[1]} - ${node[2]}`); // "Node: 10.9.0 - ~/.nvm/versions/node/v8.14.0/bin/node" ``` -------------------------------- ### List npm Packages with Glob Pattern Source: https://context7.com/tabrindle/envinfo/llms.txt Use a glob pattern with the --npmPackages flag to list matching local npm packages. ```bash envinfo --npmPackages '*babel*' ``` -------------------------------- ### Collect Database Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --databases flag to gather information about databases like MongoDB and PostgreSQL. ```bash envinfo --databases ``` -------------------------------- ### Include Not Found Items Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --showNotFound flag to include items that could not be found in the report. ```bash envinfo --showNotFound ``` -------------------------------- ### Output as Markdown Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --markdown flag to format the output as Markdown text. ```bash envinfo --markdown ``` -------------------------------- ### Programmatic Usage Source: https://github.com/tabrindle/envinfo/blob/main/README.md Use the envinfo library in your JavaScript projects to gather environment information. The `run` method takes a configuration object and options, returning a Promise that resolves to a string (JSON, YAML, or Markdown). ```APIDOC ## Programmatic Usage Envinfo takes a configuration object and returns a Promise that resolves a string (optionally yaml, json or markdown) ```javascript import envinfo from 'envinfo'; envinfo.run( { System: ['OS', 'CPU'], Binaries: ['Node', 'Yarn', 'npm'], Browsers: ['Chrome', 'Firefox', 'Safari'], npmPackages: ['styled-components', 'babel-plugin-styled-components'], }, { json: true, showNotFound: true } ).then(env => console.log(env)); ``` ### Response Example (JSON) ```json { "System": { "OS": "macOS High Sierra 10.13", "CPU": "x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" }, "Binaries": { "Node": { "version": "8.11.0", "path": "~/.nvm/versions/node/v8.11.0/bin/node" }, "Yarn": { "version": "1.5.1", "path": "~/.yarn/bin/yarn" }, "npm": { "version": "5.6.0", "path": "~/.nvm/versions/node/v8.11.0/bin/npm" } }, "Browsers": { "Chrome": { "version": "67.0.3396.62" }, "Firefox": { "version": "59.0.2" }, "Safari": { "version": "11.0" } }, "npmPackages": { "styled-components": { "wanted": "^3.2.1", "installed": "3.2.1" }, "babel-plugin-styled-components": "Not Found" } } ``` ### Helper Functions Envinfo also exports helper functions for specific information retrieval. Each helper returns a Promise that resolves to an array of values. ```javascript const envinfo = require('envinfo'); // each helper returns a promise const node = await envinfo.helpers.getNodeInfo(); // The promises resolve to an array of values: ["Name", "Version", "Path"] // e.g. ["Node", "10.9.0", "/usr/local/bin/node"] console.log(`Node: ${node[1]} - ${node[2]}`); // "Node: 10.9.0 - ~/.nvm/versions/node/v8.14.0/bin/node" ``` ``` -------------------------------- ### Gather environment data using presets Source: https://context7.com/tabrindle/envinfo/llms.txt Utilize built-in presets to automatically collect environment information tailored to specific frameworks and tools. ```javascript const envinfo = require('envinfo'); // React Native preset envinfo.run({ preset: 'react-native' }, { json: true }) .then(env => console.log(env)); // Includes: System, Binaries (Node, Yarn, npm, Watchman), SDKs (iOS, Android, Windows), // IDEs (Android Studio, Xcode, Visual Studio), and relevant npm packages // Webpack preset envinfo.run({ preset: 'webpack' }, { json: true }) .then(env => console.log(env)); // Includes: System, Binaries, webpack-related npm packages // Jest preset envinfo.run({ preset: 'jest' }, { json: true }) .then(env => console.log(env)); // Includes: System, Binaries, jest npm package // Create React App preset (includes showNotFound and duplicates options) envinfo.run({ preset: 'create-react-app' }, { json: true }) .then(env => console.log(env)); // Apollo preset envinfo.run({ preset: 'apollo' }, { json: true }) .then(env => console.log(env)); // Includes apollo-related packages with glob pattern '{*apollo*,@apollo/*}' // Babel preset envinfo.run({ preset: 'babel' }, { json: true }) .then(env => console.log(env)); // Playwright preset envinfo.run({ preset: 'playwright' }, { json: true }) .then(env => console.log(env)); // Available presets: jest, react-native, webpack, styled-components, // create-react-app, apollo, react-native-web, babel, nyc, cssnano, playwright ``` -------------------------------- ### Output as JSON Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --json flag to format the output as a JSON object. ```bash envinfo --json ``` -------------------------------- ### List Specific npm Packages Source: https://context7.com/tabrindle/envinfo/llms.txt Specify package names, separated by commas, to list only those local npm packages. ```bash envinfo --npmPackages react,webpack ``` -------------------------------- ### CLI Options Source: https://github.com/tabrindle/envinfo/blob/main/README.md Command-line interface options for using envinfo. These flags allow you to specify the type of information to retrieve and the output format. ```APIDOC ## CLI Options ``` --system Print general system info such as OS, CPU, Memory and Shell --browsers Get version numbers of installed web browsers --SDKs Get platforms, build tools and SDKs of iOS and Android --IDEs Get version numbers of installed IDEs --languages Get version numbers of installed languages such as Java, Python, PHP, etc --binaries Get version numbers of node, npm, watchman, etc --npmPackages Get version numbers of locally installed npm packages - glob, string, or comma delimited list --npmGlobalPackages Get version numbers of globally installed npm packages --duplicates Mark duplicate npm packages inside parentheses eg. (2.1.4) --fullTree Traverse entire node_modules dependency tree, not just top level --markdown Print output in markdown format --json Print output in JSON format --console Print to console (defaults to on for CLI usage, off for programmatic usage) ``` ``` -------------------------------- ### envinfo.run() Source: https://context7.com/tabrindle/envinfo/llms.txt The main programmatic interface that returns a Promise resolving to a formatted string containing environment information. It accepts a configuration object specifying categories and an options object for output formatting. ```APIDOC ## envinfo.run(config, options) ### Description Generates a comprehensive report about the development environment based on the provided configuration and output options. ### Parameters #### config (Object) - Required - An object specifying which categories and specific items to include (e.g., { System: ['OS', 'CPU'], Binaries: ['Node'] }). #### options (Object) - Optional - **json** (boolean) - Output the report in JSON format. - **markdown** (boolean) - Output the report in Markdown format. - **title** (string) - Add a custom title to the report. ### Request Example const envinfo = require('envinfo'); envinfo.run( { System: ['OS', 'CPU'], Binaries: ['Node'] }, { json: true, title: 'Environment Report' } ).then(env => console.log(env)); ### Response #### Success Response (Promise) - **env** (string) - A formatted string (JSON, YAML, or Markdown) containing the requested environment details. ``` -------------------------------- ### Show Duplicate Package Versions Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --duplicates flag to identify and display duplicate package versions within the project. ```bash envinfo --duplicates ``` -------------------------------- ### Collect Monorepo Information Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --monorepos flag to gather details about monorepo tools like Yarn Workspaces and Lerna. ```bash envinfo --monorepos ``` -------------------------------- ### Programmatic API Usage Source: https://context7.com/tabrindle/envinfo/llms.txt Using envinfo.run() to generate environment reports within Node.js applications, supporting JSON, YAML, and Markdown outputs. ```javascript const envinfo = require('envinfo'); // Basic usage with JSON output envinfo.run( { System: ['OS', 'CPU'], Binaries: ['Node', 'Yarn', 'npm'], Browsers: ['Chrome', 'Firefox', 'Safari'], }, { json: true } ).then(env => { console.log(env); // Output: // { // "System": { // "OS": "macOS High Sierra 10.13", // "CPU": "x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" // }, // "Binaries": { // "Node": { "version": "8.11.0", "path": "~/.nvm/versions/node/v8.11.0/bin/node" }, // "Yarn": { "version": "1.5.1", "path": "~/.yarn/bin/yarn" }, // "npm": { "version": "5.6.0", "path": "~/.nvm/versions/node/v8.11.0/bin/npm" } // }, // "Browsers": { // "Chrome": { "version": "67.0.3396.62" }, // "Firefox": { "version": "59.0.2" }, // "Safari": { "version": "11.0" } // } // } }); // YAML output (default) envinfo.run({ System: ['OS', 'CPU', 'Memory', 'Shell'], Binaries: ['Node', 'npm', 'pnpm', 'bun'], }).then(env => console.log(env)); // Output: // System: // OS: macOS Monterey 12.6 // CPU: (10) arm64 Apple M1 Pro // Memory: 4.23 GB / 16.00 GB // Shell: 5.8 - /bin/zsh // Binaries: // Node: 18.12.0 - /usr/local/bin/node // npm: 8.19.2 - /usr/local/bin/npm // pnpm: 7.14.0 - /usr/local/bin/pnpm // bun: 1.0.2 - /usr/local/bin/bun // Markdown output for GitHub issues envinfo.run( { System: ['OS'], Binaries: ['Node', 'npm'] }, { markdown: true } ).then(env => console.log(env)); // Output: // ## System: // - OS: macOS Monterey 12.6 // ## Binaries: // - Node: 18.12.0 - /usr/local/bin/node // - npm: 8.19.2 - /usr/local/bin/npm // With custom title envinfo.run( { System: ['OS', 'CPU'], Binaries: ['Node'] }, { json: true, title: 'Environment Report' } ).then(env => console.log(env)); ``` -------------------------------- ### Force Console Output Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --console flag to ensure output is displayed in the console, even if other output formats are specified. ```bash envinfo --console ``` -------------------------------- ### Add Custom Title to Report Source: https://context7.com/tabrindle/envinfo/llms.txt Use the --title flag followed by a string to add a custom title to the generated report. ```bash envinfo --title "My Report" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.