Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@web/config-loader
Advanced tools
Load user config files for node js projects. Supports loading config as es module or common js module, based on the user's node version, package type and file extension. Prints helpful error messages when invalid syntax combinations are used.
Follows node's logic for deciding how to load a file. .mjs
files are loaded as es module, .cjs
as common js. .js
files are loaded based on the type
field of the package.json.
npm i -D @web/config-loader
const { readConfig, ConfigLoaderError } = require('@web/config-loader');
(async () => {
try {
// will look for:
// process.cwd() + 'my-project.config.mjs'
// process.cwd() + 'my-project.config.cjs'
// process.cwd() + 'my-project.config.js'
const config = await readConfig('my-project.config');
} catch (error) {
if (error instanceof ConfigLoaderError) {
// If the error is a ConfigLoaderError it has a human readable error message
// there is no need to print the stack trace.
console.error(error.message);
return;
}
console.error(error);
return;
}
})();
import ConfigLoader from '@web/config-loader';
const { readConfig, ConfigLoaderError } = ConfigLoader;
// samve as above
If you want to let users define a custom config file location, you can pass this as a second optional parameter.
const { readConfig, ConfigLoaderError } = require('@web/config-loader');
(async () => {
try {
const optionalCustomConfigFilePath = '...';
const config = await readConfig('my-project.config', optionalCustomConfigFilePath);
} catch (error) {
if (error instanceof ConfigLoaderError) {
// If the error is a ConfigLoaderError it has a human readable error message
// there is no need to print the stack trace.
console.error(error.message);
return;
}
console.error(error);
return;
}
})();
FAQs
Load a esm or cjs config from the file system
The npm package @web/config-loader receives a total of 0 weekly downloads. As such, @web/config-loader popularity was classified as not popular.
We found that @web/config-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.