Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/heft-config-file

Package Overview
Dependencies
Maintainers
3
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/heft-config-file

Configuration file loader for @rushstack/heft

  • 0.14.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
321K
increased by4.79%
Maintainers
3
Weekly downloads
 
Created

What is @rushstack/heft-config-file?

@rushstack/heft-config-file is a package that provides utilities for reading and writing configuration files in a standardized way. It is part of the Rush Stack, a set of tools and libraries for managing large-scale TypeScript monorepos.

What are @rushstack/heft-config-file's main functionalities?

Reading Configuration Files

This feature allows you to read configuration files in a standardized way. The code sample demonstrates how to create a ConfigurationFile instance and load a configuration file asynchronously.

const { ConfigurationFile } = require('@rushstack/heft-config-file');

const myConfigFile = new ConfigurationFile({
  projectRelativeFilePath: 'config/my-config.json'
});

async function loadConfig() {
  const config = await myConfigFile.loadConfigurationFileForProjectAsync(__dirname);
  console.log(config);
}

loadConfig();

Writing Configuration Files

This feature allows you to write configuration files in a standardized way. The code sample demonstrates how to use the JsonFile utility to save a configuration object to a file asynchronously.

const { JsonFile } = require('@rushstack/heft-config-file');

const configData = {
  setting1: 'value1',
  setting2: 'value2'
};

async function saveConfig() {
  await JsonFile.saveAsync(configData, 'config/my-config.json');
  console.log('Configuration saved.');
}

saveConfig();

Schema Validation

This feature allows you to validate configuration files against a JSON schema. The code sample demonstrates how to create a ConfigurationFile instance with a schema and load a configuration file with validation.

const { ConfigurationFile } = require('@rushstack/heft-config-file');
const { JsonSchema } = require('@rushstack/node-core-library');

const schema = JsonSchema.fromFile('config/my-config.schema.json');

const myConfigFile = new ConfigurationFile({
  projectRelativeFilePath: 'config/my-config.json',
  jsonSchema: schema
});

async function loadConfig() {
  const config = await myConfigFile.loadConfigurationFileForProjectAsync(__dirname);
  console.log(config);
}

loadConfig();

Other packages similar to @rushstack/heft-config-file

FAQs

Package last updated on 08 Feb 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc