generator-project-statics
The generator for quickly scaffolding a project structure for static files.
It uses maven and the @bb-cli/bb-package tool to download project dependencies, and create collection static packages suitable for CXP.
Prerequisites
You should have @bb-cli/bb-generate CLI installed globally first.
Install
The generator should be installed globally:
npm install -g @backbase/generator-project-statics
Usage
bb-generate list
Generate statics project:
bb-generate project-statics
Follow the prompts to generate your project statics.
Prompts:
- ? Folder name: This folder will be created, and is where you should put all your widgets and frontend code.
- ? Project Group Id: The maven group ID (see maven-naming). If you're creating this folder within another maven project you should usually use the same group ID.
- ? Collection Name: The name of the frontend collection. Should start with collection-. This folder will be created within the statics folder. A collection is a set of related widgets and frontend features.
- ? Project Version: The maven version (see maven-naming). If you're creating this folder within another maven project you should usually use the same version.
- ? Node Version: A local version of node will be installed (by the maven frontend plugin) with this version to run the frontend code compilation.
- ? NPM Version: As above, a local version of npm will be installed with this version.
- ? Collection depends on: Your collection should extend one of the default Backbase collection. If you don't want to re-use any Backbase widgets you can still depend on collection-bb-blocks to help write your own widgets. Otherwise you can select which Backbase widget collection you'd like to extend.
- ? Version for collection: If you have correctly set up your maven settings this version should automatically default to the latest released version of the collection. Otherwise, please refer to the widget collection documentation to find the version you'd like to use.
After that, your directory structure will look like this:
└─ statics
├── collection-myportal
│ ├── pom.xml
│ └── src
├── package.json
└── pom.xml
Usage after generation:
Use maven to build the project:
cd statics
mvn clean package
This will generate 2 files in target
:
collection-<name>-cxp-dist-1.0-SNAPSHOT.zip
collection-<name>-ext-dist-1.0-SNAPSHOT.zip
See bb-package for more details on the frontend packaging.
Add a new collection to the project
This generator also contains a template to add more collections within the static folder:
cd statics
bb-generate project-statics collection
Don't forget to add the new collection to the pom.xml modules.