Getting Started on your first FOLIO UI module
This tutorial requires Git, NodeJS and Yarn.
It includes screenshots from the VS CODE UI to display directory/file structure.
Create a single development folder for your workspace. We’ll call it the “FOLIO_Workspace” folder for sake of examples.
From a command line, navigate to the workspace folder and clone the sample platform.
git clone https://github.com/folio-org/stripes-sample-platform.git
Navigate into the command line and switch to the current updated branch of stripes-sample-platform:
git checkout ramsons-yarnv1
Back in the Create a
package.json
file in your workspace folder, sibling to the stripes-sample-platform folder. Add these contents to the file:{ "private": true, "workspaces": [ "*" ], "devDependencies": { "@folio/stripes-cli": "^3.2.0" } }
Your project directory should now look like this:Install the workspace by running the
yarn
command from the “FOLIO_Workspace” folder. Give the dependencies a few minutes to install.
The install process creates anode_modules
folder as well as ayarn.lock
file in the “FOLIO_Workspace” folder.Now the exciting part: Create a new FOLIO App by running the following command in the “FOLIO_Workspace” folder:
Feel free to substitute the intended name of your app for “starter”.
stripes-cli
will ask for a brief description. Fill it in with “My First FOLIO App!” Just for example purposes.stripes-cli
will clone an example repo to the folder and fill out the templated strings using your app’s name and the description that you provided. It willyarn install/update
dependencies within the workspace as well.Now your workspace directory structure will look like this:
Within the stripes-sample-platform folder, open the
stripes.config.js
file. This configuration controls the build process. Look for themodules
field. It contains only a single entry -"@folio/users": {}
Add your UI module to thismodules
list like so:Back at the command line, navigate to the
stripes-sample-platform
folder, and run the command:You’ll see console output that looks like the following. Notice the name of our module (
ui-starter
) shows up in the list!Eventually you’ll see something like
Open a web browser to
localhost:3000
The login page will appear. Enderdiku_admin
andadmin
for credentials.The FOLIO Landing page will appear. You should see a link to our custom UI module in the Main navigation:
The title looks odd in the header, right? It’s actually rendering a key to a translation string. To fix this, you’ll need to navigate to the
<your app>/translations
folder and copy theen.json
file, renaming the copy toen_US.json
- or to whichever locale you set the FOLIO UI to. Exiting theserve
command and re-running it should now display your module’s name up top!The branch we switched
stripes-sample-platform
to a ‘training wheels’ branch to make this process quicker.
If you’re developing your own backend module, you should definitely modifystripes.config.js
to point to your locally running okapi instance (set theurl
under theokapi
field -okapi: { 'url':'http://localhost:9130', 'tenant':'diku' }
)
and apply your custom app’s permissions to your local okapi’s “diku_admin” user with the following command from the app’s directory:This will remove the need for the
hasAllPerms: true
(or the--hasAllPerms
command-line flag.)
The list of your custom app’s permissions can be found in thepackage.json
. The process executed byyarn stripes app create
filled in your custom module’s name into the baseline permissions.