@cdx-extensions/extension-generator-web
v1.1.0
Published
Nx plugin for CDX web extension widgets from catalog/extension-templates.json (remote GitHub sync + npm template packages). Separate from @cdx-extensions/widget-template-web.
Readme
@cdx-extensions/extension-generator-web
Nx plugin for generating catalog-driven web extension widgets from catalog/extension-templates.json.
Part of extensibility-sdk-extension-generator. Separate from the offline starter: @cdx-extensions/widget-template-web.
Install
pnpm add @cdx-extensions/extension-generator-webGenerate
nx g @cdx-extensions/extension-generator-web:widget <widget-name>Interactive flow:
- Fetches the latest catalog from GitHub (with cache and local fallbacks)
- Lists web widget templates by category (e.g.
financial) - Prompts you to pick a category, then a template
- Downloads the selected npm template package and scaffolds the widget under
widgets/web/<name>-widget/
Skip the template prompt by passing --template (catalog id or npm package name):
nx g @cdx-extensions/extension-generator-web:widget my-widget \
--template=investment-portfolioOptions
| Option | Default | Description |
|--------|---------|-------------|
| name | — | Widget slug (required) |
| template | — | Catalog template id or npm package (skips interactive picker) |
| stackWidget | false | Stack widget layout |
Catalog source
On each run the generator:
- First tries the remote catalog at
https://github.com/candescent-dev/cdx-extensibility-apps/blob/main/catalog/extension-templates.json - On success — caches it at
~/.cdx/cache/catalog/extension-templates.json - On remote failure — uses the cached catalog if present
- On cache miss — uses the workspace
catalog/extension-templates.jsonif present
Widget prompts read from web.templates in the loaded catalog. No nx.json configuration is required.
Template resolution
For each catalog template package:
- Read the pinned version from
catalog/extension-templates.json(or resolvelatestfrom the registry). - If
~/.cdx/cache/<package>@<version>/dist/already exists, use it. - Otherwise run
npm packagainst the registry in workspace.npmrc(JFrog for@cdx-extensions/*), extractdist/, and cache it for the next run.
When to use which generator
| Need | Generator |
|------|-----------|
| Quick offline starter | @cdx-extensions/widget-template-web:widget |
| Catalog / DI templates | @cdx-extensions/extension-generator-web:widget |
Cache
- Catalog:
~/.cdx/cache/catalog/extension-templates.json - Template packages:
~/.cdx/cache/<package>@<version>/dist/
Repeat runs reuse cached templates and do not re-download from npm.
Generated project files
In addition to widget source from the selected template package, the generator writes CDX project scaffold files:
.babelrc,.eslintrc.jsonjest.config.ts,webpack.config.ts,module-federation.config.tsproject.json,tsconfig.json,tsconfig.app.json,tsconfig.spec.json
Scaffold templates ship in this package under dist/projectFiles/. When a published template package includes them under dist/, those versions take precedence.
Utilities
This package also ships monorepo build helpers under src/scripts/ (published as dist/scripts/):
pnpm exec stage-nx-package --projectRoot . --outDir dist --copy src package.jsonBuild & publish
From this directory:
pnpm install
pnpm run build
pnpm publish --tag devThe @cdx-extensions registry is configured in .npmrc (JFrog). Only dist/ and package metadata are published, matching @cdx-extensions/widget-template-web.
CI: extension-generator-workflow.yml (JFrog + public npm on main).
