@ibm-wch-sdk/wrtp
v7.2.608
Published
A schematics to enable an application for WRTP
Downloads
2
Readme
WCH SDK Schematics
These schematics add workflow to application development for Angular applications for Watson Content Hub.
Suggestion
You might want to bootstrap your application by using the @ibm-wch-sdk/app schematics.
Prereq
- Install the Angular CLI
- Make sure you have an Angular project set up
Installation
If you have bootstrapped your application with @ibm-wch-sdk/app no extra installation step is required.
Otherwise from the command line from within you application folder run
npm install --dev @ibm-wch-sdk/schematics
Basic usage
The schematics integrate with the ng generate
command and use the following syntax:
npx ng generate @ibm-wch-sdk/schematics:<COMMAND> <OPTIONS>
You can get help on the supported options for a particular command via
npx ng generate @ibm-wch-sdk/schematics:<COMMAND> --help
Commands
The following commands are supported:
Layouts
Generates layouts and layout mappings based on type information in a batch in the wchtools folder. The names of the artifacts are derived from the type names.
npx ng generate @ibm-wch-sdk/schematics:layouts
This command only generates the JSON descriptors for layouts and mappings, no code components. It works on top of the wchtools folder and assumes the existence of JSON records for content types.
Layout
Generates a layout and layout mapping for one type. The name of the desired layout can be specified.
npx ng generate @ibm-wch-sdk/schematics:layout <NAME>
This command only generates the JSON descriptors for layouts and mappings, no code components. Use this command to create additional layouts to the auto generated ones, when the default naming mechanism is not sufficient.
Components
Generates angular layouts and components based on a wchtools folder. Uses information from the content types, layout and layout mappings.
npx ng generate @ibm-wch-sdk/schematics:components
This command creates Angular components that represent the mapped layouts from the wchtools folder. The command is designed to work in batch mode and should be called whenever layouts, layout mappings or types change.
WCH Tools Folder
Many command operate on top of a wchtools folder, that contains the WCH content model in form of JSON records. This folder is typically maintained by calling wchtools commands, e.g. wchtools pull -t
.
The location of the wchtools folder folder can be configured via the package.json
in the config.data
field, relative to the location of the package.json
, we recommend ./data
as the default name of this folder. Specify additional configuration in the ./data/.wchtoolsoptions.json
inside that folder.
If you have bootstrapped your application with @ibm-wch-sdk/app then the folder and necessary configuration will be setup, already.