You might want to bootstrap your application by using the @acoustic-content-sdk/app schematics.
- Install the Angular CLI
- Make sure you have an Angular project set up
If you have bootstrapped your application with @acoustic-content-sdk/app no extra installation step is required.
Otherwise from the command line from within you application folder run
npm install --dev @acoustic-content-sdk/schematics
The schematics integrate with the
ng generate command and use the following syntax:
npx ng generate @acoustic-content-sdk/schematics:<COMMAND> <OPTIONS>
You can get help on the supported options for a particular command via
npx ng generate @acoustic-content-sdk/schematics:<COMMAND> --help
The following commands are supported:
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 @acoustic-content-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.
Generates a layout and layout mapping for one type. The name of the desired layout can be specified.
npx ng generate @acoustic-content-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.
Generates angular layouts and components based on a wchtools folder. Uses information from the content types, layout and layout mappings.
npx ng generate @acoustic-content-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.
Generates the wchtools artifacts required to bootstrap a sites-next application based on an Angular build output. This command would typically be run after a production build of the application.
The build output of the application typically consists of two versions of the application, one for
live mode and one for
preview mode. These are defined by build configurations of the respective names in the workspace configuration, written to different output folders.
The artifacts generated by this command make sure to bootstrap the
preview version of the application when run on the preview host and otherwise the
live version of the application.
npx ng generate @acoustic-content-sdk/schematics:contributions
After running the command push the folders via wchtools to deploy it.
WCH Tools Folder
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 @acoustic-content-sdk/app then the folder and necessary configuration will be setup, already.
When generating NPM modules for application features it is helpful to include an automated way to add the module to an existing application. Modules can use the exported
addFeatureModuleToApplication function to implement this without any additional coding required:
- add a
collection.jsonfile to your module. This schema points to a general purpose implementation of the required command.
- include your
schema.json. This describes your module to the schematics engine.
Make sure to replace
YOUR_MODULE_NAME by the name of the ngModule that exports your components.
- Reference your
package.jsonof your module.
Angular schematics used to add workflow support for Acoustic Content.
|generateComponents(options)||Construct the components|
|generateContributions(options)||Generates all wchtools artifacts required to bootstrap a sites next application from the Angular build configuration that the schema points to.|
|generateVersion(options)||Updates code artifacts to contain the current version|
|VERSION||Version and build number of the package|
Construct the components
the new rule
Generates all wchtools artifacts required to bootstrap a sites next application from the Angular build configuration that the schema points to.
the rule that generates the artifacts
Updates code artifacts to contain the current version
the rule that generates the artifacts
Version and build number of the package