@old-keg-hub/keg-core
v9.5.1
Published
> NOTE: This repository is deprecated and unmaintained. Please use [@keg-hub/keg-hub](https://github.com/keg-hub/keg-hub) instead.
Downloads
3
Readme
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
cd
into your tap's directory, then runyarn setup
- The tap you generated will have installed
keg-core
as 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 anenvs
property in thekeg
object 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.json
or an app config by using the form:<tap|core>.<package|config>.<some_property>
- so the
tap.package.license
will evaluate to the value of thelicense
property 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
getKegEnvs
function fromkeg-core/core/scripts/js/getKegEnvs
- learn more here
- then, just use them into your tool's replacement plugin