This repository contains a collection of KGrid Knowledge Objects that demonstrate features of the grid, good development practices and useful tools.
Anatomy of this Knowledge Object project.
There are testing and packaging features in this project that require npm, npm is installed with Node.js
npm. Once npm is installed run
npm install at the root of this project.
- collection/ contains one to many directories representing knowledge objects
- naan-name is intended for each knowledge object (e.g. hello-world)
- tests/ is for all of your project test scripts
- etc/ is a sub-directory for miscellaneous project
- docs/ is a sub-directory for more detailed information about these KOs
- dist/ is created and destroyed when running
npm run package
- scripts/ is intended to capture various scripts need for the project (using scripty)
- scriptswin/ windows versions of the scripts
Example Knowledge Objects
- Hello World - Simple KO designed as a starting point. Demonstrates a project structure the includes unit testing and scripts to package the KO deposit.
- BMI Calculator - Simple KO designed to calculate BMI based on height and weight. Demostrates passing mulitple attributes.
- Minimum Viable - Simple KO designed demostrate the smallest amount of information needed to get KO
Bundled Object Example
Currently the KGrid Activator uses the
Objects. Nashorn implements ECMAScript 5.1 specification
This limits the tools and technics avalable to the KO developer. The KGrid has experimented with webpack and babel as a method to all the developer it until more current tools and techniques. Very simple example is Nashorn doesn't support const and let statements but use babel transpiler we can convert es6 to es5.
Please review Hello World bundle.v1 and bundle.v2 implementations.
Executive Object Example
Running Example KOs in an Activator
You can now test the example objects in an activator via a npm script. This script will download the latest released activator and start up the activator using the example repository as it's shelf.
Open a terminal window at the root of the cloned repository and run the following command.
npm run dev
You can create zip file of the Knowledge Object which can be used to deposit to a KGrid Library or load/activate on a KGrid Activator.
npm run package