Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
config-file-ts
Advanced tools
Use Typescript for configuration files. Types for safety. Compiled for speed.
Just use TypeScript for configuration files.
TypeScript is more syntactically flexible than JSON. Comments are allowed. Keys needn't be quoted. Arrays can have trailing commas.
TypeScript allows a little programming in config files. Share variables, use utility functions, etc.
TypeScript types provide free error checking, and free IDE support for getting config files right.
Parsing TypeScript config files is plenty quick. config-file-ts caches the TypeScript output.
Assuming TypeScript is in your environment, config-file-ts adds about 5kb to your program, or 1.5kb minified.
$ yarn add config-file-ts
In the config file, export default. my.config.ts
:
export default {
entry: "my stuff" // comments are welcome now
};
Feel free to add types and scripting. my.config.ts
:
import os from "os"; // use installed libraries in the config
import { MyConfig } from "./MyProgram";
export default {
entry: `${os.userInfo().username}'s stuff` // use scripting in the config file
} as MyConfig; // typecheck the config file
Read the config file in your program. MyProgram.ts
:
export interface MyConfig {
entry?: string;
}
const config = loadTsConfig<MyConfig>("my.config.ts");
FAQs
Use Typescript for configuration files. Types for safety. Compiled for speed.
We found that config-file-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.