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.
@percy/config
Advanced tools
Handles loading and adding options to Percy configuration files. Uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) to load configuration files and [JSON schema](https://json-schema.org/) with [AJV](https://github.com/epoberezkin/ajv) to val
@percy/config is a configuration management package for Percy, a visual testing and review platform. It allows users to define and manage configuration settings for Percy in a structured and programmatic way.
Load Configuration
This feature allows you to load the configuration settings for Percy from a configuration file. The `load` function reads the configuration and returns it as a JavaScript object.
const { load } = require('@percy/config');
const config = load();
console.log(config);
Validate Configuration
This feature allows you to validate a given configuration object against the expected schema. The `validate` function returns an object indicating whether the configuration is valid and any errors if it is not.
const { validate } = require('@percy/config');
const config = { version: 2, snapshots: { widths: [375, 1280] } };
const { valid, errors } = validate(config);
console.log(valid, errors);
Merge Configuration
This feature allows you to merge multiple configuration objects into one. The `merge` function takes two or more configuration objects and combines them, with later objects overriding earlier ones.
const { merge } = require('@percy/config');
const baseConfig = { version: 2, snapshots: { widths: [375] } };
const overrideConfig = { snapshots: { widths: [1280] } };
const mergedConfig = merge(baseConfig, overrideConfig);
console.log(mergedConfig);
The `config` package is a configuration management tool for Node.js applications. It allows you to define configuration settings for different environments and load them dynamically. Compared to @percy/config, it is more general-purpose and not specific to visual testing.
The `convict` package provides a way to define a schema for your configuration files and validate them. It also supports environment-specific configurations and type validation. While @percy/config is tailored for Percy, `convict` is more flexible and can be used in various types of applications.
The `dotenv` package loads environment variables from a `.env` file into `process.env`. It is simpler and more lightweight compared to @percy/config, focusing on environment variable management rather than structured configuration schemas.
Handles loading and adding options to Percy configuration files. Uses cosmiconfig to load configuration files and JSON schema with AJV to validate those configuration files.
The .load()
method will load and validate a configuation file, optionally merging it with any
provided overrides
. If no path
is provided, will search for the first supported config found
from the current directory up to the home directoy. Configuration files are cached and reused unless
reload
is true
.
import PercyConfig from '@percy/config'
// loading is done synchronously
const config = PercyConfig.load(options)
path
— Config file path or directory containing a config fileoverrides
— Config option overridesreload
— Do not use cached config (default false
)bail
— Return undefined when failing validation (default false
)print
— Print info and error logs (default false
)"percy"
entry in package.json
.percyrc
YAML or JSON file.percy.json
JSON file.percy.yaml
or .percy.yml
YAML file.percy.js
or percy.config.js
file that exports an objectThe .addSchema()
function will add a sub-schema to the Percy configuration file which will be
parsed and validated when PercyConfig.load()
is called. See JSON
schema for possible schema options.
import PercyConfig from '@percy/config'
PercyConfig.addSchema({
propertyName: JSONSchema
})
FAQs
Handles loading and adding options to Percy configuration files. Uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) to load configuration files and [JSON schema](https://json-schema.org/) with [AJV](https://github.com/epoberezkin/ajv) to val
We found that @percy/config 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
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.