Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
basisjs-tools-config
Advanced tools
Adds basis.config
support for basisjs-tools commands.
Module provide single function that extends clap
command with basis.config
support.
var clap = require('clap');
var configSupport = require('basisjs-tools-config');
var command = clap.create('example');
// extend command
configSupport(command);
// or
command.extend(configSupport);
It adds two options to command:
-n, --no-config
– to prevent config using-c, --config-file <filename>
- to specify path to config fileAlso it adds getConfig(options)
method to command that search and fetch config content if needed and globalConfig
property to get global config content.
getConfig(options)
usualy uses in command's init
method and could accepts command options to decide is config should be fetched or not.
// this call will search and fetch config content
var config = command.getConfig();
// but this call doesn't
var config = command.getConfig({ config: false });
// specify config location
var config = command.getConfig({ config: 'path/to/my.config' });
If config file doesn't found or could be parsed error outputs in console and exit process.
Extended command tries to find and use basis.config
file by default. It attempts to find basis.config
at the current working directory. If it's not found, then it moves to the parent directory, and so on, until the file system root is reached.
Besides basis.config
module also check for package.json
. Config may be stored with basisjsConfig
key. If no basisjsConfig
found then package.json
ignores and searching is continue.
If basis.config
found, it's content parses as json
. Usualy properties treats as corresponding command options, and could be overridden by options in command line.
Any command's option could be declared in config, as it's long name. All option names should be camelize, i.e. --css-pack
becomes cssPack
. If flag contains -no-
, it should be omited, i.e. --no-color
becomes color
.
You can disable basis.config
usage by --no-config
option or specify your own file with -c
or --config-file
option.
Config file useful to set up command's defaults option values.
Example of basis.config
at /path/to/config
:
{
"build": {
"file": "app.html",
"output": "build"
},
"server": {
"port": 8123
}
}
Config also can be stored in package.json
:
{
"basisjsConfig": {
"build": {
"file": "app.html",
"output": "build"
},
"server": {
"port": 8123
}
}
}
basis.config
has higher priority. Config inpackage.json
ignores ifbasis.config
file exists.
In both cases doesn't matter at what directory you run basis build
command, for example. File /path/to/config/app.html
will be used for built and result will be put at /path/to/config/output
directory. But you still able to override settings in config but using option with command, for example, if you run basis build -o temp
at /path/to/config/foo/bar
than result will be put at /path/to/config/foo/bar/temp
.
Basis works with many various paths, and often it is relative paths. There are two general rules for relative path resolving.
basis.config
) resolves to config file location1.1.0 (March 19, 2016)
package.json
FAQs
Fetch config for basis.js tools
The npm package basisjs-tools-config receives a total of 98 weekly downloads. As such, basisjs-tools-config popularity was classified as not popular.
We found that basisjs-tools-config demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.