@mnc-software/mosaic-build-plus
v0.0.5
Published
Angular builder that extends ngx-build-plus with manifest generation, i18n copy, and WMD packaging
Maintainers
Readme
@mnc-software/mosaic-build-plus
@mnc-software/mosaic-build-plus is an Angular builder that wraps ngx-build-plus:browser and adds Mosaic-specific packaging steps:
- Generate
manifest.jsonfrom:angular.jsonbuild metadata- Module Federation
exposesfrom webpack config - TypeScript source analysis (
ICustomWidgetand@Option(...))
- Copy
manifest.jsonto output root - Copy
i18nfolder to output root - Optionally create
.wmdpackage (zip containingmanifest.json,ngwebmodule,i18n)
Builder Name
@mnc-software/mosaic-build-plus:browser
Example angular.json configuration
{
"projects": {
"myapp": {
"architect": {
"build": {
"builder": "@mnc-software/mosaic-build-plus:browser",
"options": {
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "tsconfig.app.json",
"extraWebpackConfig": "webpack.config.js",
"manifestPath": "manifest.json",
"angularConfigPath": "angular.json",
"projectName": "myapp",
"widgetLabelPrefix": "DashboardWidget.",
"generateManifest": true,
"copyManifest": true,
"i18nPath": "i18n",
"copyI18n": true
},
"configurations": {
"production": {
"createWmd": true
},
"development": {
"createWmd": false
}
}
}
}
}
}
}Builder options
outputPath: Optional. Defaults todist/ngwebmodule.manifestPath: Source manifest path. Defaultmanifest.json.angularConfigPath: Path to angular workspace config. Defaultangular.json.projectName: Optional explicit angular project name.widgetLabelPrefix: Optional prefix for widget labels in generated manifestwidgetDataentries. Defaults toDashboardWidget..webpackConfigPath: Optional explicit webpack config path. Defaults to active build config.generateManifest: Defaulttrue.copyManifest: Defaulttrue.i18nPath: Source i18n folder. Defaulti18n.copyI18n: Defaulttrue.outputRoot: Optional packaging root. Defaults todirname(outputPath).createWmd: Optional. If omitted:WMD_PACKAGE=true=> force onWMD_PACKAGE=false=> force off- otherwise defaults to on
wmdFileName: Optional package file name. Defaults to${manifest.name}.wmd.
All standard ngx-build-plus:browser options are also passed through.
WMD file name and manifest name resolution
The generated WMD package file name is resolved in this order:
wmdFileNamebuilder option (if provided)${manifest.name}.wmdmodule.wmd(only ifmanifest.nameis missing)
manifest.name is resolved in this order when manifest generation is enabled:
- Module Federation plugin name from webpack config (
new ModuleFederationPlugin({ name: ... })) package.jsonname- Angular
projectName
This means the Angular project name is a fallback, not the primary source.
Example
If your Angular project is clientproptest but your Module Federation name is mfe1, the package will default to mfe1.wmd.
To force a specific package name regardless of manifest contents, set:
{
"projects": {
"myapp": {
"architect": {
"build": {
"options": {
"wmdFileName": "clientproptest.wmd"
}
}
}
}
}
}Troubleshooting
- Seeing an unexpected filename like
mfe1.wmd:- Check
manifest.jsonname - Check webpack Module Federation
name - Check
package.jsonname - If needed, set
wmdFileNameexplicitly
- Check
Publishing
- Ensure package metadata is correct in
package.json. - Pack locally:
npm pack
- Publish to npm/artifactory using your normal registry workflow.
Notes
- Widget/component classification is source-based:
implements ICustomWidget=>widgetData- otherwise =>
componentData
- Widget options are parsed from class property
@Option(...)decorators.
