Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@rushstack/heft-config-file
Advanced tools
@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.
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();
Cosmiconfig is a popular library for finding and loading configuration files. It supports a variety of file formats and locations. Compared to @rushstack/heft-config-file, cosmiconfig is more flexible in terms of file formats and locations but does not provide built-in schema validation.
The config package is a configuration manager for Node.js applications. It allows you to define configuration files in a hierarchical manner and supports environment-specific configurations. Compared to @rushstack/heft-config-file, the config package is more focused on managing hierarchical configurations and environment-specific settings.
The rc package is a simple configuration loader that supports various file formats and locations. It is lightweight and easy to use. Compared to @rushstack/heft-config-file, rc is more lightweight and flexible but lacks advanced features like schema validation.
A library for loading config files for use with the Heft build system.
Heft is part of the Rush Stack family of projects.
FAQs
Configuration file loader for @rushstack/heft
The npm package @rushstack/heft-config-file receives a total of 230,939 weekly downloads. As such, @rushstack/heft-config-file popularity was classified as popular.
We found that @rushstack/heft-config-file demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.