Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@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
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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.