New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

readmyconfig

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readmyconfig

A simple JavaScript library to read Node.js project configuration files synchronously without requiring await.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

readmyconfig

A simple JavaScript library to read Node.js project configuration files synchronously without requiring await.

npm version Downloads License: MIT Node.js Version

Installation

npm install readmyconfig

Usage

import Konf from 'readmyconfig';

// Read package.json
const pkg = Konf.package();
console.log(pkg.name, pkg.version);

// Read tsconfig.json
const tsconfig = Konf.tsconfig();
console.log(tsconfig.compilerOptions?.target);

// Read vite config
const vite = Konf.vite();
console.log(vite); // Raw content for JS/TS files

// Read ESLint config
const eslint = Konf.eslint();
console.log(eslint);

// Read Prettier config
const prettier = Konf.prettier();
console.log(prettier);

// Check what configs are available
console.log(Konf.list());

// Check if a specific config exists
if (Konf.has('package')) {
  console.log('package.json found');
}

// Get any config by name
const customConfig = Konf.get('webpack');

Supported Configuration Files

  • package.json
  • tsconfig.json
  • vite.config.js / vite.config.ts
  • .eslintrc.json / .eslintrc.js / eslint.config.js
  • .prettierrc / .prettierrc.json / prettier.config.js
  • webpack.config.js
  • rollup.config.js
  • .babelrc / babel.config.json
  • jest.config.js
  • vitest.config.ts
  • tailwind.config.js
  • postcss.config.js
  • next.config.js
  • nuxt.config.js

API

Methods

  • Konf.package() - Returns package.json content
  • Konf.tsconfig() - Returns tsconfig.json content
  • Konf.vite() - Returns vite config content
  • Konf.eslint() - Returns ESLint config content
  • Konf.prettier() - Returns Prettier config content
  • Konf.webpack() - Returns webpack config content
  • Konf.rollup() - Returns rollup config content
  • Konf.babel() - Returns babel config content
  • Konf.jest() - Returns jest config content
  • Konf.vitest() - Returns vitest config content
  • Konf.tailwind() - Returns tailwind config content
  • Konf.postcss() - Returns postcss config content
  • Konf.next() - Returns next.js config content
  • Konf.nuxt() - Returns nuxt.js config content
  • Konf.get(name) - Returns config by name
  • Konf.has(name) - Checks if config exists
  • Konf.list() - Returns array of available config names

Features

  • Synchronous reading (no await needed)
  • Automatic file detection in current and parent directories
  • JSON parsing for .json files
  • Raw content for .js/.ts files
  • Graceful handling of missing files
  • ESM support

Requirements

  • Node.js 14.0.0 or higher
  • ESM support

Contributing

  • Fork the repository
  • Create a feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Made with ❤️ by Puparia

Keywords

config

FAQs

Package last updated on 13 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts