
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@wrhs/extract-config
Advanced tools
Extract warehouse.ai configuration from a given unpacked directory
@wrhs/extract-config
Extracts warehouse.ai configuration from a given unpacked directory
npm install --save @wrhs/extract-config
const extract = require('@wrhs/extract-config');
const path = require('path');
const unpackedRepo = path.join('path', 'to', 'repo');
const config = await extract(unpackedRepo);
config
?At most, the config
will provide the following information:
{
pkg: {
// the entire contents of the repo's package.json
},
wrhs: {
// Whether or not to perform a webpack build for this package, or if
// we can just use the source of this directory as-is.
//
// Optional (default: none)
build: 'webpack',
// Different locales in which to build the package, this is helpful for
// parallelizing builds for any number of locales.
//
// Optional (default: [])
locales: [
'en-US',
'es-CO',
'de-DE',
'zh-CN'
],
// What recommended files to use in each environment
files: {
dev: [
'dist/output.css',
'dist/output.js'
],
test: [
'dist/output.min.css',
'dist/output.min.js'
],
prod: [
'dist/output.min.css',
'dist/output.min.js'
]
},
// Minification options to apply to the output code
minify: {
compress: {
unsafe: true,
dead_code: true,
collapse_vars: true,
drop_console: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true
}
}
}
}
@wrhs/extract-config
will recognize the following configuration files and
formats.
.wrhsrc
This is a simple json
file that contains information in the above format
{
"build": "webpack",
"locales": [
"C",
"C++",
"ArnoldC"
]
}
package.json
Similar to .wrhsrc
you can place these values into either the base level of
your package.json
, or into a wrhs
object (we will merge the base level into
the wrhs
object if any)
{
"name": "my-cool-package",
"version": "1.2.3",
"wrhs": {
"build": "webpack",
"locales": [
"en-US",
"es-CO",
"de-DE"
],
"files": {
"test": ["dist/output.js", "dist/output.css"],
"prod": ["dist/output.min.js", "dist/output.min.css"]
}
}
}
wrhs.toml
[files]
dev = ['output.js', 'output.css']
test = ['output.min.js', 'output.min.css']
prod = ['output.min.js', 'output.min.css']
build = 'webpack'
locales = [
'English',
'Sindarin',
'Klingon',
'Dothraki'
]
[minify]
[minify.compress]
unsafe = true
dead_code = true
unsafe = true
dead_code = true
collapse_vars = true
drop_console = true
conditionals = true
booleans = true
unused = true
if_return = true
join_vars = true
They are listed in order above, but we will resolve potentially conflicting information based on this precedence:
.wrhsrc
package.json
wrhs.toml
Any configuration from earlier in the list will override identically named configuration later in the list. For example, I have these 2 files present:
.wrhsrc
{
"build" :"webpack",
"locales": [
"Earth", "Mars"
]
}
wrhs.toml
locales=['Krypton', 'Oa']
[files]
test = ['output.css']
prod = ['output.min.css']
The final configuration object will be:
{
build: 'webpack',
locales: [
'Earth', 'Mars'
],
files: {
test: ['output.css']
prod: ['output.min.css']
}
}
It's important to note that nested lists and objects will not be merged, just overridden.
We highly recommended keeping all of your configuration in one single location, but to support legacy formats, we allow multiple points of entry.
npm test
1.0.0
FAQs
Extract warehouse.ai configuration from a given unpacked directory
The npm package @wrhs/extract-config receives a total of 2 weekly downloads. As such, @wrhs/extract-config popularity was classified as not popular.
We found that @wrhs/extract-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.