
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@apparts/config
Advanced tools
#+TITLE: Config #+DATE: [2019-02-07 Thu] #+AUTHOR: Philipp Uhl
Storage in an environment variable can be done in two ways:
** Node environment
To require a configuration that is stored in one of the files
** Webpack for web environment
To require a configuration that is stored in the environment variable =MY_COLOR= (note, a dash becomes an underscore and everything is in uppercase): #+BEGIN_SRC sh const Colors = require('apparts-config').get('my-color'); #+END_SRC
In order to create environment variables use the following webpack (v
2.0) configuration options:
#+BEGIN_SRC js module.exports = env => { return { plugins: [ new webpack.DefinePlugin({ 'process.env': { 'MY_COLOR': JSON.stringify(JSON.stringify(require('./src/utils/colors.js'))) } }), ] } }; #+END_SRC
** React-Nativ environment
This package is not supported for that kind of environment. In order to use packages that require this package anyways the following configuration is necessary:
It is necessary to create an alias for the module. This requires the module =babel-plugin-module-resolver= to be installed and the following to be present in the file =babel.config.js=:
#+BEGIN_SRC js module.exports = { // ... "plugins": [ ["module-resolver", { "alias": { "apparts-config": "./src/config.js" } }] ] }; #+END_SRC
The file =./src/config.js= must be like the following and containing all the configuration:
#+BEGIN_SRC js module.exports.get = (config) => { return { // my configs here configName: { // all my configuration for configName } // ... }[config]; }; #+END_SRC
FAQs
A config-loading framework
The npm package @apparts/config receives a total of 36 weekly downloads. As such, @apparts/config popularity was classified as not popular.
We found that @apparts/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
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.