9.5.1 • Published 3 years ago
@old-keg-hub/keg-core v9.5.1
Keg Core
NOTE: This repository is deprecated and unmaintained. Please use @keg-hub/keg-hub instead.
Overview
The keg is a platform for developing cross-platform react apps. It comes preconfigured to target both web and mobile, and it contains a collection of utilities for simplifying development, including:
- built-in routing and navigation
- a reducer based on the relational data model
- dynamic theming via re-theme
- cross platform persistent storage
Tap usage
- To start, first setup the keg-cli
- Next, use the cli to generate a tap:
keg gn tap cdinto your tap's directory, then runyarn setup- The tap you generated will have installed
keg-coreas a dependency - Read more about tap-development here
Defining Environment Variables
- Within your tap's config file (e.g.
tap.js,tap.json), you can define anenvsproperty in thekegobject like this:
module.exports = {
...,
keg: {
...
envs: {
'process.env.FOO': 'bar',
SOME_API_KEY: getAPIKey()
'process.env.TAP_LICENSE': 'tap.package.license'
}
}
}And these will be replaced in your code, so that you can use them like this:
const myFunction () {
makeAPICall(SOME_API_KEY)
console.log('Foo', process.env.FOO)
console.log('This tap uses the license', process.env.TAP_LICENSE)
}- you can define dynamic envs that pull data from a
package.jsonor an app config by using the form:<tap|core>.<package|config>.<some_property>- so the
tap.package.licensewill evaluate to the value of thelicenseproperty in your tap'spackage.json
- so the
- every env is automatically stringified
Running with webpack / expo
- These envs are automatically replaced for you at build time
Running with other build tools
- If you use a different bundler, like rollup, you can still use these envs by importing
the
getKegEnvsfunction fromkeg-core/core/scripts/js/getKegEnvs- learn more here
- then, just use them into your tool's replacement plugin
Architecture
Store
9.5.1
3 years ago