To export apps built in Laska to your existing React Native codebase, you need to use an NPM package. Install the Laska CLI using NPM:
From the root directory of your project, run:
Tip: you can also export your project from laska straight from the editor. Once you've downloaded and extracted the archive, simply run laska from the root folder of the archive.
You will be asked for an App Id and an API Key. You can find both in the App Settings screen.
The App Settings button can be found in the bottom left corner.
Once run, your preferred export settings and credentials will be saved in a file called .laskarc. Next time, laska will run immediately without having to ask questions.
Do not commit .laskarc to Git.
If you do, anyone with access to your git repository can also access your app.
Running laska from a terminal
Running your app
Depending on the codebase that you are using, you may need to do some additional steps.
When using Expo / Create React Native App
Modify App.js to look like this:
import StartComponent from './src/laska/StartComponent';
export default StartComponent;
You will also need to install additional dependencies:
yarn add react-navigation@2 moment recompose
Laska currently does not support react-navigation v3.
Now, you should be all set. Simply run npm start and connect to your app on your phone using the Expo Client.
.laskarc is a JSON document. Outside of the questions when initially running the command line tool, there are additional options that can be set.
Optional. Name of a component in your project that will be exported to a file called StartComponent.js in the root of the folder you chose for exporting. This allows you to designate a component as the start or launch component in your application. If you don't specify this, the CLI will use the page which you designated as the Landing Page.
Optional. Array of component names which will not be exported. This allows you to add additional logic to certain components (eg. Redux) and be sure they will not be overwritten next time you run laska .
Optional. Array of component names which will only be exported.
Optional. This value determines how assets (currently only images) are handled by the CLI. Can be one of the following values:
This is the default mode. Images will be saved to the local filesystem, and required() when needed.
Images will be converted to base64, and not saved to your local filesystem at all. Instead, all your image tags will use base64 urls.
Images are not saved to the local filesystem. Instead, they will be downloaded from Google Cloud every time your app opens.
"whiteList": ["Dashboard", "FancyButton"],
Outputs the version number.
Shows a help screen with these commands.
In this mode, the CLI wil stay active and update your files as you continue working in Laska. Your changes propagate real time to your local project.
Automatically install dependencies using Yarn or NPM (Yarn will be used if NPM cannot be found).