The @ldo/cli is a command line interface for initializing LDO and building ShapeTypes.
To setup LDO, cd into your typescript project and run npx @ldo/cli init.
cd my-typescript-project
npx @ldo/cli initManual Setup
The following is handled by the __automatic setup__:Install the LDO dependencies.
npm install @ldo/ldo
npm install @ldo/cli --save-devCreate a folder to store your ShEx shapes:
mkdir shapesCreate a script to build ShEx shapes and convert them into Linked Data Objects. You can put this script in package.json
{
...
scripts: {
...
"build:ldo": "ldo build --input ./shapes --output ./ldo"
...
}
...
}@ldo/cli generates shape types using the *.shex files in the "input" folder. If you followed the instructions above, run the following command:
npm run build:ldoThis will generate five files:
./ldo/foafProfile.shapeTypes.ts<-- This is the important file./ldo/foafProfile.typings.ts./ldo/foafProfile.schema.ts./ldo/foafProfile.context.ts
Sometimes, you might want to distribute shapes to others. The easiest way to do that is to deploy them to NPM. The LDO CLI has an easy-to-use command for generating a standalone project just for your shapes.
npx @ldo/cli create ./my-projectThis script will generate a project with a place to put your shapes. Running npm publish will build the shapes and push to project to NPM for you.
This project was made possible by a grant from NGI Zero Entrust via nlnet. Learn more on the NLnet project page.
MIT
