@ojiepermana/angular 22.1.11 → 22.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -26
- package/chart/README.md +272 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +137 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +147 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +25 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/ojiepermana-angular-chart-area.mjs +289 -3
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +722 -3
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1482 -3
- package/fesm2022/ojiepermana-angular-chart-line.mjs +294 -3
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +291 -3
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1301 -3
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +421 -3
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +295 -3
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +306 -3
- package/fesm2022/ojiepermana-angular-chart.mjs +12 -3
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +267 -3
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-alert.mjs +101 -3
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-badge.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +192 -3
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +95 -3
- package/fesm2022/ojiepermana-angular-component-button.mjs +73 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +718 -3
- package/fesm2022/ojiepermana-angular-component-card.mjs +167 -3
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +326 -3
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +190 -3
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +117 -3
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-command.mjs +351 -3
- package/fesm2022/ojiepermana-angular-component-composer.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +158 -3
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +482 -3
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +400 -3
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -3
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +689 -3
- package/fesm2022/ojiepermana-angular-component-editor.mjs +511 -3
- package/fesm2022/ojiepermana-angular-component-empty.mjs +134 -3
- package/fesm2022/ojiepermana-angular-component-form.mjs +438 -3
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +273 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +176 -3
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +550 -3
- package/fesm2022/ojiepermana-angular-component-input.mjs +52 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -3
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +48 -3
- package/fesm2022/ojiepermana-angular-component-label.mjs +27 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +378 -3
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +238 -3
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +999 -3
- package/fesm2022/ojiepermana-angular-component-popover.mjs +201 -3
- package/fesm2022/ojiepermana-angular-component-progress.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-radio.mjs +180 -3
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +493 -3
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +51 -3
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +227 -3
- package/fesm2022/ojiepermana-angular-component-select.mjs +609 -3
- package/fesm2022/ojiepermana-angular-component-separator.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +407 -3
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +25 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +456 -3
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +56 -3
- package/fesm2022/ojiepermana-angular-component-switch.mjs +145 -3
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -3
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +315 -3
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +46 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -3
- package/fesm2022/ojiepermana-angular-component-toast.mjs +241 -3
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +290 -3
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +76 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +519 -3
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +34 -3
- package/fesm2022/ojiepermana-angular-component-utils.mjs +3 -2
- package/fesm2022/ojiepermana-angular-component.mjs +4 -4
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +21 -3
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +20 -3
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +91 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +512 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs +623 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +404 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +466 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +2642 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +725 -3
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +65 -4
- package/fesm2022/ojiepermana-angular-navigation.mjs +4 -10
- package/fesm2022/ojiepermana-angular-sdk.mjs +204 -4
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1387 -3
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +331 -3
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +45 -4
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1044 -3
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +729 -3
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +381 -3
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +267 -3
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +361 -3
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +198 -3
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +110 -3
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -2
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +338 -3
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +160 -4
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +811 -3
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +783 -3
- package/fesm2022/ojiepermana-angular-theme.mjs +4 -4
- package/fesm2022/ojiepermana-angular.mjs +6 -11
- package/navigation/README.md +374 -0
- package/package.json +81 -20
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +126 -0
- package/theme/component/settings/README.md +135 -0
- package/theme/layout/README.md +539 -0
- package/theme/page/README.md +453 -0
- package/theme/shell/README.md +340 -0
- package/theme/styles/README.md +178 -0
- package/theme/styles/css/base/components.css +553 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +165 -0
- package/theme/styles/css/base/theme.css +374 -0
- package/theme/styles/css/base/tokens.css +361 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/ojiepermana-angular-chart-area.d.ts +76 -1
- package/types/ojiepermana-angular-chart-bar.d.ts +201 -1
- package/types/ojiepermana-angular-chart-core.d.ts +811 -1
- package/types/ojiepermana-angular-chart-line.d.ts +75 -1
- package/types/ojiepermana-angular-chart-pie.d.ts +131 -1
- package/types/ojiepermana-angular-chart-primitives.d.ts +291 -1
- package/types/ojiepermana-angular-chart-radar.d.ts +116 -1
- package/types/ojiepermana-angular-chart-radial.d.ts +116 -1
- package/types/ojiepermana-angular-chart-scatter.d.ts +125 -1
- package/types/ojiepermana-angular-chart.d.ts +2 -1
- package/types/ojiepermana-angular-component-accordion.d.ts +85 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +140 -1
- package/types/ojiepermana-angular-component-alert.d.ts +42 -1
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -1
- package/types/ojiepermana-angular-component-avatar.d.ts +56 -1
- package/types/ojiepermana-angular-component-badge.d.ts +24 -1
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -1
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -1
- package/types/ojiepermana-angular-component-button.d.ts +27 -1
- package/types/ojiepermana-angular-component-calendar.d.ts +111 -1
- package/types/ojiepermana-angular-component-card.d.ts +69 -1
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -1
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -1
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -1
- package/types/ojiepermana-angular-component-combobox.d.ts +60 -1
- package/types/ojiepermana-angular-component-command.d.ts +130 -1
- package/types/ojiepermana-angular-component-composer.d.ts +90 -1
- package/types/ojiepermana-angular-component-context-menu.d.ts +54 -1
- package/types/ojiepermana-angular-component-date-picker.d.ts +109 -1
- package/types/ojiepermana-angular-component-dialog.d.ts +136 -1
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +248 -1
- package/types/ojiepermana-angular-component-editor.d.ts +135 -1
- package/types/ojiepermana-angular-component-empty.d.ts +50 -1
- package/types/ojiepermana-angular-component-form.d.ts +159 -1
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -1
- package/types/ojiepermana-angular-component-icon.d.ts +89 -1
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -1
- package/types/ojiepermana-angular-component-input-otp.d.ts +155 -1
- package/types/ojiepermana-angular-component-input.d.ts +21 -1
- package/types/ojiepermana-angular-component-item.d.ts +93 -1
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -1
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -1
- package/types/ojiepermana-angular-component-label.d.ts +11 -1
- package/types/ojiepermana-angular-component-menubar.d.ts +93 -1
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -1
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +104 -1
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -1
- package/types/ojiepermana-angular-component-pillbox.d.ts +222 -1
- package/types/ojiepermana-angular-component-popover.d.ts +66 -1
- package/types/ojiepermana-angular-component-progress.d.ts +17 -1
- package/types/ojiepermana-angular-component-radio.d.ts +60 -1
- package/types/ojiepermana-angular-component-resizable.d.ts +117 -1
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -1
- package/types/ojiepermana-angular-component-segmented-control.d.ts +58 -1
- package/types/ojiepermana-angular-component-select.d.ts +122 -1
- package/types/ojiepermana-angular-component-separator.d.ts +14 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +130 -1
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -1
- package/types/ojiepermana-angular-component-slider.d.ts +83 -1
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -1
- package/types/ojiepermana-angular-component-switch.d.ts +44 -1
- package/types/ojiepermana-angular-component-table.d.ts +57 -1
- package/types/ojiepermana-angular-component-tabs.d.ts +124 -1
- package/types/ojiepermana-angular-component-textarea.d.ts +17 -1
- package/types/ojiepermana-angular-component-timeline.d.ts +64 -1
- package/types/ojiepermana-angular-component-toast.d.ts +64 -1
- package/types/ojiepermana-angular-component-toggle-group.d.ts +90 -1
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -1
- package/types/ojiepermana-angular-component-tooltip.d.ts +143 -1
- package/types/ojiepermana-angular-component-utils-core.d.ts +184 -1
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +21 -1
- package/types/ojiepermana-angular-component-utils-scale.d.ts +19 -1
- package/types/ojiepermana-angular-component-utils.d.ts +2 -1
- package/types/ojiepermana-angular-component.d.ts +2 -1
- package/types/ojiepermana-angular-navigation-core.d.ts +59 -1
- package/types/ojiepermana-angular-navigation-icon.d.ts +12 -1
- package/types/ojiepermana-angular-navigation-service.d.ts +116 -1
- package/types/ojiepermana-angular-navigation-types.d.ts +144 -1
- package/types/ojiepermana-angular-navigation.d.ts +507 -1
- package/types/ojiepermana-angular-sdk.d.ts +89 -1
- package/types/ojiepermana-angular-theme-component-settings.d.ts +154 -1
- package/types/ojiepermana-angular-theme-layout-services.d.ts +147 -1
- package/types/ojiepermana-angular-theme-layout-types.d.ts +40 -1
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +299 -1
- package/types/ojiepermana-angular-theme-layout.d.ts +129 -1
- package/types/ojiepermana-angular-theme-page-core.d.ts +157 -1
- package/types/ojiepermana-angular-theme-page-filter.d.ts +77 -1
- package/types/ojiepermana-angular-theme-page-root.d.ts +88 -1
- package/types/ojiepermana-angular-theme-page-side.d.ts +50 -1
- package/types/ojiepermana-angular-theme-page-slots.d.ts +40 -1
- package/types/ojiepermana-angular-theme-page.d.ts +5 -1
- package/types/ojiepermana-angular-theme-shell-services.d.ts +193 -1
- package/types/ojiepermana-angular-theme-shell-types.d.ts +105 -1
- package/types/ojiepermana-angular-theme-shell.d.ts +100 -1
- package/types/ojiepermana-angular-theme-styles.d.ts +319 -1
- package/types/ojiepermana-angular-theme.d.ts +2 -1
- package/types/ojiepermana-angular.d.ts +5 -5
package/sdk/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# @ojiepermana/angular/sdk
|
|
2
|
+
|
|
3
|
+
OpenAPI 3.x → Angular SDK generator for the `@ojiepermana/angular` design system.
|
|
4
|
+
Source lives in [`library/sdk`](.); it ships as the `sdk` subpath of the single
|
|
5
|
+
`@ojiepermana/angular` package, and its schematic collection is the package's own
|
|
6
|
+
`ng add` / `ng generate` collection.
|
|
7
|
+
|
|
8
|
+
It generates a **lightweight Angular SDK** from any OpenAPI 3.x spec (including 3.2.0):
|
|
9
|
+
typed `HttpClient` services, tree-shakeable fn modules, optional metadata
|
|
10
|
+
(permissions / validators), and a navigation tree.
|
|
11
|
+
|
|
12
|
+
## What the published package exposes
|
|
13
|
+
|
|
14
|
+
The package root exposes the **typed config surface** — the contract you author your
|
|
15
|
+
`sdk.config.json` against — as an ESM Angular package-format entry point:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import {
|
|
19
|
+
resolveConfig,
|
|
20
|
+
resolveTarget,
|
|
21
|
+
type SdkConfig,
|
|
22
|
+
type SdkTargetConfig,
|
|
23
|
+
type SdkOutputMode,
|
|
24
|
+
type SdkFeatureFlags,
|
|
25
|
+
} from '@ojiepermana/angular/sdk';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The same npm artifact also includes the compiled generator and its Angular schematic collection.
|
|
29
|
+
The package root is ESM; only the internal `schematics/` and `src/` runtime trees are scoped as
|
|
30
|
+
CommonJS so Angular DevKit can load their factories with `require()`.
|
|
31
|
+
|
|
32
|
+
The source layout is:
|
|
33
|
+
|
|
34
|
+
| Path | Role |
|
|
35
|
+
| -------------------- | ------------------------------------------------------------------------------------------------ |
|
|
36
|
+
| `src/config/` | Config schema + loader (JSONC, `.js`/`.cjs`) — `resolveConfig` / `resolveTarget` |
|
|
37
|
+
| `src/parser/` | OpenAPI → intermediate representation (`bundle`, `ir`, `types`) |
|
|
38
|
+
| `src/emit/` | One emitter per concern (models, operations, services, client, metadata, navigation, public-api) |
|
|
39
|
+
| `src/layout/` | Post-emit transforms (e.g. `per-domain` split-by-domain reorganisation) |
|
|
40
|
+
| `src/render/` | Template rendering |
|
|
41
|
+
| `src/writer/` | Output-mode wrappers (standalone / library / secondary-entrypoint) |
|
|
42
|
+
| `src/engine.ts` | `generate(target, workspaceRoot)` — runs the full pipeline for one target |
|
|
43
|
+
| `schematics/init/` | Scaffolds `config/sdk.config.json` from [`sdk.config.example.json`](sdk.config.example.json) |
|
|
44
|
+
| `schematics/sdk/` | Runs the generator and writes files into the Angular CLI `Tree` |
|
|
45
|
+
| `schematics/ng-add/` | `ng add` support — installs peer deps |
|
|
46
|
+
| `bin/` | Ignored build scratch for compiled `src/` + `schematics/`; copied into the package during build |
|
|
47
|
+
|
|
48
|
+
## Config shape
|
|
49
|
+
|
|
50
|
+
A single config file drives one or more generation targets:
|
|
51
|
+
|
|
52
|
+
```jsonc
|
|
53
|
+
{
|
|
54
|
+
"targets": [
|
|
55
|
+
{
|
|
56
|
+
"input": "./openapi.yaml",
|
|
57
|
+
"output": "./sdk",
|
|
58
|
+
"mode": "library", // "standalone" | "library" | "secondary-entrypoint"
|
|
59
|
+
"clientName": "Api",
|
|
60
|
+
"packageName": "@my-scope/sdk", // used in "library" mode
|
|
61
|
+
"packageVersion": "0.0.1", // used in "library" mode
|
|
62
|
+
"rootUrl": "", // optional; empty string means same-origin requests
|
|
63
|
+
"splitByDomain": true, // optional; defaults true for "library", false otherwise
|
|
64
|
+
"splitDepth": "service", // "service" (default) | "tag"
|
|
65
|
+
"features": {
|
|
66
|
+
"models": true,
|
|
67
|
+
"operations": true,
|
|
68
|
+
"services": true,
|
|
69
|
+
"client": true,
|
|
70
|
+
"metadata": true,
|
|
71
|
+
"navigation": true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Multiple targets are supported — one config run can emit several SDKs. See
|
|
79
|
+
[`sdk.config.example.json`](sdk.config.example.json) for the canonical template the
|
|
80
|
+
`init` schematic scaffolds.
|
|
81
|
+
|
|
82
|
+
If `rootUrl` is omitted or left empty, the generated SDK uses same-origin requests by
|
|
83
|
+
default. Consumer apps can override it at runtime with `provideApiConfiguration(...)`.
|
|
84
|
+
|
|
85
|
+
### Runtime base URL
|
|
86
|
+
|
|
87
|
+
The generated SDK does not read `sdk.config.json` at runtime. The value of
|
|
88
|
+
`targets[].rootUrl` is only used during code generation to seed the default
|
|
89
|
+
`ApiConfiguration.rootUrl` value.
|
|
90
|
+
|
|
91
|
+
- `rootUrl: ""` or omitted: requests use the current origin, for example
|
|
92
|
+
`/api/users` on the same host as the Angular app.
|
|
93
|
+
- `rootUrl: "https://api.example.com"`: the generated SDK defaults to that
|
|
94
|
+
absolute backend URL.
|
|
95
|
+
- Runtime override: consumer apps can replace the default by providing a new
|
|
96
|
+
value during bootstrap.
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
100
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
101
|
+
|
|
102
|
+
import { AppComponent } from './app/app.component';
|
|
103
|
+
import { provideApiConfiguration } from '@my-scope/sdk';
|
|
104
|
+
|
|
105
|
+
bootstrapApplication(AppComponent, {
|
|
106
|
+
providers: [provideHttpClient(), provideApiConfiguration('https://api.example.com')],
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For standalone generated output inside the same workspace, import
|
|
111
|
+
`provideApiConfiguration` from the generated SDK barrel instead of an npm package path.
|
|
112
|
+
|
|
113
|
+
## Output modes
|
|
114
|
+
|
|
115
|
+
| Mode | What it emits | Use when… |
|
|
116
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
|
|
117
|
+
| `standalone` | A plain folder (no `ng-package.json`). | You consume the SDK via path alias / `tsconfig.paths` inside the same app. |
|
|
118
|
+
| `library` | Split-by-domain output plus package metadata and nested `ng-package.json` manifests for secondary entrypoints. | You want a buildable/publishable Angular package with efficient deep imports. |
|
|
119
|
+
| `secondary-entrypoint` | Standalone output **plus** a minimal `ng-package.json` pointing at `public-api.ts`, plus nested `ng-package.json` files for split-by-domain secondary entrypoints. | You drop the folder inside an existing library so ng-packagr picks it up as a subpath. |
|
|
120
|
+
|
|
121
|
+
In `library` mode, output also includes `tsconfig.lib.json` and `tsconfig.lib.prod.json`.
|
|
122
|
+
`ng-package.dest` defaults to `dist/<output-folder-name>`.
|
|
123
|
+
|
|
124
|
+
## Per-domain layout
|
|
125
|
+
|
|
126
|
+
By default, standalone and secondary-entrypoint targets emit a flat layout
|
|
127
|
+
(`models/`, `fn/`, `services/`, … all at the output root). `mode: "library"`
|
|
128
|
+
defaults to `splitByDomain: true` so the generated package is split into
|
|
129
|
+
secondary entrypoints immediately. You can still set `splitByDomain: false` if
|
|
130
|
+
you need the older flat library shape. Cross-domain models and client primitives
|
|
131
|
+
land in `shared/`.
|
|
132
|
+
|
|
133
|
+
`splitDepth` controls granularity. It is only read when `splitByDomain` is `true`.
|
|
134
|
+
|
|
135
|
+
| `splitDepth` | Folder strategy | Example (spec with tags `Access/Role`, `Access/Permission`, `Storage/GCS`, `Storage/S3`, `Auth`) |
|
|
136
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| `service` | One folder per **root** tag (each tag's `parent` chain collapses to its root). One folder per backend service. | `access/` (holds Role + Permission + Role-Permission + …), `storage/` (holds GCS + S3), `auth/`, `shared/`, root `public-api.ts` |
|
|
138
|
+
| `tag` | One folder per **leaf** tag, nested under the parent chain. Keeps fine-grained separation while staying grouped. | `access/role/`, `access/permission/`, `access/role-permission/`, `storage/gcs/`, `storage/s3/`, `auth/`, `shared/`, root `public-api.ts` |
|
|
139
|
+
|
|
140
|
+
Every domain folder contains `services/`, `fn/`, `models/`, `permissions/`,
|
|
141
|
+
and its own `public-api.ts`. The root still owns the aggregate metadata barrel:
|
|
142
|
+
`metadata.ts`, `openapi-helpers.ts`, and `permissions/index.ts` stay at the SDK
|
|
143
|
+
root so `shared/` never depends on sibling domains. In standalone and
|
|
144
|
+
secondary-entrypoint modes, the root `public-api.ts` aggregates `shared`, root
|
|
145
|
+
metadata helpers, and every domain for convenience. In library mode, domain
|
|
146
|
+
exports stay in their secondary entrypoints so consumers deep import the domain
|
|
147
|
+
they need.
|
|
148
|
+
|
|
149
|
+
Model ownership rule (per-domain mode):
|
|
150
|
+
|
|
151
|
+
- A model used by exactly one domain → emitted inside that domain's `models/`.
|
|
152
|
+
- A model shared across two or more domains → emitted inside `shared/models/`.
|
|
153
|
+
- Client primitives (`ApiConfiguration`, `BaseService`, `RequestBuilder`,
|
|
154
|
+
`StrictHttpResponse`, `Api`), shared metadata types, validators, and
|
|
155
|
+
navigation always live under `shared/`.
|
|
156
|
+
- Aggregate metadata helpers (`metadata.ts`, `openapi-helpers.ts`) and the
|
|
157
|
+
top-level `permissions/index.ts` stay at the SDK root.
|
|
158
|
+
|
|
159
|
+
Example consumption when using `mode: 'library'`:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { RoleService } from '@my-scope/sdk/access';
|
|
163
|
+
import { ApprovalInstanceService, SubmitRequest } from '@my-scope/sdk/approval';
|
|
164
|
+
import { GCSService } from '@my-scope/sdk/storage'; // splitDepth: 'service'
|
|
165
|
+
import { GCSService } from '@my-scope/sdk/storage/gcs'; // splitDepth: 'tag'
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Feature flags
|
|
169
|
+
|
|
170
|
+
All default to `true`. Turn off anything you don't need to shrink the output.
|
|
171
|
+
|
|
172
|
+
| Flag | Emits |
|
|
173
|
+
| ------------ | ------------------------------------------------------------------------------------------ |
|
|
174
|
+
| `models` | `models/*.ts` — flat interfaces, enum aliases, array aliases. |
|
|
175
|
+
| `operations` | `fn/<tag>/<operation-id>.ts` — tree-shakeable request functions with `.PATH`. |
|
|
176
|
+
| `services` | `services/<tag>.service.ts` — Angular 22 `@Service()` wrappers. |
|
|
177
|
+
| `client` | `api-configuration.ts`, `base-service.ts`, `request-builder.ts`, `api.ts`. |
|
|
178
|
+
| `metadata` | `permissions/*`, `validators/*`, `metadata.ts`, `openapi-helpers.ts`. |
|
|
179
|
+
| `navigation` | `api.navigation.ts` — `NavigationItem[]` ready for `NavigationService.registerItems(...)`. |
|
|
180
|
+
|
|
181
|
+
## Pipeline
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
sdk.config.json → loader → spec (YAML/JSON) → IR → emitters → layout → writer → Angular CLI Tree
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Output ownership and safe cleanup
|
|
188
|
+
|
|
189
|
+
Each generated output directory contains `.ojiepermana-sdk-manifest.json` with
|
|
190
|
+
the relative files owned by the generator. A later run deletes stale files only
|
|
191
|
+
when they were recorded in that manifest; unrelated source and documentation in
|
|
192
|
+
the same directory are preserved.
|
|
193
|
+
|
|
194
|
+
The schematic rejects output at the workspace root, outside the workspace, or
|
|
195
|
+
inside `.git`/`node_modules`, and rejects absolute, traversing, duplicate, and
|
|
196
|
+
reserved virtual paths. It also refuses to overwrite an unmanaged file whose
|
|
197
|
+
content differs. On the first managed run, identical existing files are adopted;
|
|
198
|
+
move conflicting manual files (or regenerate into a clean directory) before
|
|
199
|
+
running again. Angular CLI `--dry-run` previews the complete Tree transaction.
|
|
200
|
+
|
|
201
|
+
## Generated runtime conventions
|
|
202
|
+
|
|
203
|
+
- Tree-shakeable: `import { listUsers } from './sdk/fn/user/list-users'` pulls only one HTTP call.
|
|
204
|
+
- Services: every operation gets `op()` (body `Observable<T>`) and `op$Response()` (full `StrictHttpResponse<T>`).
|
|
205
|
+
- `RequestBuilder` is intentionally minimal — no `style`/`explode` logic — to keep the output lightweight.
|
|
206
|
+
- All files carry a `DO NOT EDIT` banner and `/* eslint-disable */`.
|
|
207
|
+
|
|
208
|
+
## Support and security
|
|
209
|
+
|
|
210
|
+
The SDK follows the Node engine range in its package manifest and targets Angular 22 output. See
|
|
211
|
+
the bundled `SUPPORT.md`. Report suspected vulnerabilities privately using the instructions in the
|
|
212
|
+
bundled `SECURITY.md`. This package is MIT licensed; see the bundled `LICENSE`.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"factory": "./ng-add/index#ngAdd",
|
|
6
|
+
"schema": "./ng-add/schema.json",
|
|
7
|
+
"description": "Install @ojiepermana/angular/sdk and align its peer dependencies."
|
|
8
|
+
},
|
|
9
|
+
"init": {
|
|
10
|
+
"factory": "./init/index#init",
|
|
11
|
+
"schema": "./init/schema.json",
|
|
12
|
+
"description": "Create an sdk.config.json at the workspace root."
|
|
13
|
+
},
|
|
14
|
+
"sdk": {
|
|
15
|
+
"factory": "./sdk/index#sdk",
|
|
16
|
+
"schema": "./sdk/schema.json",
|
|
17
|
+
"description": "Generate an Angular SDK from an OpenAPI spec using sdk.config.json."
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.init = init;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const SCHEMA_MODULE_PATH = 'node_modules/@ojiepermana/angular/sdk/schematics/sdk/schema.json';
|
|
7
|
+
const NEXT_COMMAND = 'ng generate @ojiepermana/angular:sdk';
|
|
8
|
+
/**
|
|
9
|
+
* Default config template. The published package also ships a concrete
|
|
10
|
+
* `sdk.config.example.json`; this fallback only exists so `init` still works if
|
|
11
|
+
* the file is missing in unusual local/dev states.
|
|
12
|
+
*/
|
|
13
|
+
const FALLBACK_TEMPLATE = {
|
|
14
|
+
$schema: `./${SCHEMA_MODULE_PATH}`,
|
|
15
|
+
targets: [
|
|
16
|
+
{
|
|
17
|
+
input: './openapi.yaml',
|
|
18
|
+
output: './sdk',
|
|
19
|
+
mode: 'library',
|
|
20
|
+
clientName: 'Api',
|
|
21
|
+
packageName: '@my-scope/sdk',
|
|
22
|
+
packageVersion: '0.0.1',
|
|
23
|
+
rootUrl: '',
|
|
24
|
+
splitByDomain: true,
|
|
25
|
+
splitDepth: 'service',
|
|
26
|
+
features: {
|
|
27
|
+
models: true,
|
|
28
|
+
operations: true,
|
|
29
|
+
services: true,
|
|
30
|
+
client: true,
|
|
31
|
+
metadata: true,
|
|
32
|
+
navigation: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
function init(options = {}) {
|
|
38
|
+
return (tree, context) => {
|
|
39
|
+
const workspaceRoot = process.cwd();
|
|
40
|
+
const destRelative = options.path ?? 'config/sdk.config.json';
|
|
41
|
+
const treePath = destRelative.startsWith('/') ? destRelative : `/${destRelative}`;
|
|
42
|
+
if (tree.exists(treePath) && !options.force) {
|
|
43
|
+
throw new Error(`${destRelative} already exists. Re-run with --force to overwrite.`);
|
|
44
|
+
}
|
|
45
|
+
const content = loadTemplate(workspaceRoot, destRelative);
|
|
46
|
+
const buffer = Buffer.from(content, 'utf8');
|
|
47
|
+
if (tree.exists(treePath)) {
|
|
48
|
+
tree.overwrite(treePath, buffer);
|
|
49
|
+
context.logger.info(`[sdk:init] overwrote ${destRelative}`);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
tree.create(treePath, buffer);
|
|
53
|
+
context.logger.info(`[sdk:init] created ${destRelative}`);
|
|
54
|
+
}
|
|
55
|
+
context.logger.info(`[sdk:init] edit targets[].input and targets[].output, then run \`${NEXT_COMMAND}\`.`);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function loadTemplate(workspaceRoot, destRelative) {
|
|
59
|
+
const candidates = [
|
|
60
|
+
(0, node_path_1.resolve)(workspaceRoot, 'sdk.config.example.json'),
|
|
61
|
+
// The published package keeps the example at its root, two levels above
|
|
62
|
+
// `schematics/init/`.
|
|
63
|
+
(0, node_path_1.resolve)(__dirname, '../../sdk.config.example.json'),
|
|
64
|
+
];
|
|
65
|
+
for (const candidate of candidates) {
|
|
66
|
+
try {
|
|
67
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(candidate, 'utf8'));
|
|
68
|
+
parsed['$schema'] = resolveSchemaPath(destRelative);
|
|
69
|
+
return `${JSON.stringify(parsed, null, 2)}\n`;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// try next
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return `${JSON.stringify({ ...FALLBACK_TEMPLATE, $schema: resolveSchemaPath(destRelative) }, null, 2)}\n`;
|
|
76
|
+
}
|
|
77
|
+
function resolveSchemaPath(destRelative) {
|
|
78
|
+
return `${relativePrefix(destRelative)}${SCHEMA_MODULE_PATH}`;
|
|
79
|
+
}
|
|
80
|
+
function relativePrefix(destRelative) {
|
|
81
|
+
const depth = destRelative.replace(/^\/+/, '').split('/').length - 1;
|
|
82
|
+
return depth <= 0 ? './' : '../'.repeat(depth);
|
|
83
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "SdkInitSchema",
|
|
4
|
+
"title": "Initialize SDK generator config",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Path (relative to workspace root) where the config file will be created.",
|
|
10
|
+
"default": "config/sdk.config.json"
|
|
11
|
+
},
|
|
12
|
+
"force": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Overwrite the file if it already exists.",
|
|
15
|
+
"default": false
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = ngAdd;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
7
|
+
const semver_1 = require("semver");
|
|
8
|
+
function ngAdd(options = {}) {
|
|
9
|
+
return (tree, context) => {
|
|
10
|
+
const manifest = loadLibraryManifest();
|
|
11
|
+
const requiredDependencies = collectRequiredDependencies(manifest);
|
|
12
|
+
if (requiredDependencies.length === 0) {
|
|
13
|
+
context.logger.warn('[ng-add] @ojiepermana/angular declares no peer dependencies.');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const workspacePackageJson = readWorkspacePackageJson(tree);
|
|
17
|
+
workspacePackageJson.dependencies ??= {};
|
|
18
|
+
let changed = false;
|
|
19
|
+
for (const dependency of requiredDependencies) {
|
|
20
|
+
const existingDependency = findExistingDependency(workspacePackageJson, dependency.name);
|
|
21
|
+
if (existingDependency) {
|
|
22
|
+
if (shouldUpdateDependency(existingDependency.version, dependency.version)) {
|
|
23
|
+
const section = workspacePackageJson[existingDependency.section] ?? {};
|
|
24
|
+
section[dependency.name] = dependency.version;
|
|
25
|
+
workspacePackageJson[existingDependency.section] = section;
|
|
26
|
+
changed = true;
|
|
27
|
+
context.logger.info(`[ng-add] updated ${dependency.name} from ${existingDependency.version} to ${dependency.version} in ${existingDependency.section}.`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
context.logger.info(`[ng-add] keeping existing ${dependency.name}@${existingDependency.version} from ${existingDependency.section}.`);
|
|
31
|
+
}
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
workspacePackageJson.dependencies[dependency.name] = dependency.version;
|
|
35
|
+
changed = true;
|
|
36
|
+
context.logger.info(`[ng-add] added ${dependency.name}@${dependency.version}.`);
|
|
37
|
+
}
|
|
38
|
+
if (!changed) {
|
|
39
|
+
context.logger.info('[ng-add] Required dependencies are already present.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
workspacePackageJson.dependencies = sortSection(workspacePackageJson.dependencies);
|
|
43
|
+
writeWorkspacePackageJson(tree, workspacePackageJson);
|
|
44
|
+
if (!options.skipInstall) {
|
|
45
|
+
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Use the package manifest as the source of truth so ng-add stays aligned with
|
|
51
|
+
* the published peerDependencies and ng-update packageGroup metadata.
|
|
52
|
+
*/
|
|
53
|
+
function loadLibraryManifest() {
|
|
54
|
+
// Walk up from the compiled schematic (…/<pkg>/sdk/schematics/ng-add/) to the
|
|
55
|
+
// package root. ng-packagr also drops a `module`/`typings` stub manifest into
|
|
56
|
+
// every entry point directory, so the walk skips any manifest without a
|
|
57
|
+
// `name` and stops at the real package manifest.
|
|
58
|
+
for (const candidate of ancestorManifests(__dirname)) {
|
|
59
|
+
const manifest = JSON.parse((0, node_fs_1.readFileSync)(candidate, 'utf8'));
|
|
60
|
+
if (typeof manifest.name === 'string')
|
|
61
|
+
return manifest;
|
|
62
|
+
}
|
|
63
|
+
const workspaceManifest = (0, node_path_1.resolve)(process.cwd(), 'node_modules/@ojiepermana/angular/package.json');
|
|
64
|
+
if ((0, node_fs_1.existsSync)(workspaceManifest)) {
|
|
65
|
+
return JSON.parse((0, node_fs_1.readFileSync)(workspaceManifest, 'utf8'));
|
|
66
|
+
}
|
|
67
|
+
throw new Error('Could not locate the @ojiepermana/angular package manifest for ng-add.');
|
|
68
|
+
}
|
|
69
|
+
function ancestorManifests(from) {
|
|
70
|
+
const manifests = [];
|
|
71
|
+
let directory = from;
|
|
72
|
+
for (;;) {
|
|
73
|
+
const candidate = (0, node_path_1.resolve)(directory, 'package.json');
|
|
74
|
+
if ((0, node_fs_1.existsSync)(candidate))
|
|
75
|
+
manifests.push(candidate);
|
|
76
|
+
const parent = (0, node_path_1.dirname)(directory);
|
|
77
|
+
if (parent === directory)
|
|
78
|
+
return manifests;
|
|
79
|
+
directory = parent;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function collectRequiredDependencies(manifest) {
|
|
83
|
+
const peerDependencies = manifest.peerDependencies ?? {};
|
|
84
|
+
const packageGroup = normalizePackageGroup(manifest['ng-update']?.packageGroup);
|
|
85
|
+
return Object.keys(peerDependencies)
|
|
86
|
+
.sort((left, right) => left.localeCompare(right))
|
|
87
|
+
.map((name) => ({
|
|
88
|
+
name,
|
|
89
|
+
version: packageGroup[name] ?? peerDependencies[name],
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
function normalizePackageGroup(packageGroup) {
|
|
93
|
+
if (!packageGroup) {
|
|
94
|
+
return {};
|
|
95
|
+
}
|
|
96
|
+
if (Array.isArray(packageGroup)) {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
return packageGroup;
|
|
100
|
+
}
|
|
101
|
+
function readWorkspacePackageJson(tree) {
|
|
102
|
+
const buffer = tree.read('/package.json');
|
|
103
|
+
if (!buffer) {
|
|
104
|
+
throw new Error('No package.json found at the workspace root.');
|
|
105
|
+
}
|
|
106
|
+
return JSON.parse(buffer.toString('utf8'));
|
|
107
|
+
}
|
|
108
|
+
function writeWorkspacePackageJson(tree, packageJson) {
|
|
109
|
+
const content = `${JSON.stringify(packageJson, null, 2)}\n`;
|
|
110
|
+
if (tree.exists('/package.json')) {
|
|
111
|
+
tree.overwrite('/package.json', content);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
tree.create('/package.json', content);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function findExistingDependency(packageJson, dependencyName) {
|
|
118
|
+
const sections = [
|
|
119
|
+
'dependencies',
|
|
120
|
+
'devDependencies',
|
|
121
|
+
'peerDependencies',
|
|
122
|
+
'optionalDependencies',
|
|
123
|
+
];
|
|
124
|
+
for (const section of sections) {
|
|
125
|
+
const version = packageJson[section]?.[dependencyName];
|
|
126
|
+
if (version) {
|
|
127
|
+
return { section, version };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
function shouldUpdateDependency(existingVersion, requiredVersion) {
|
|
133
|
+
const existing = (0, semver_1.validRange)(existingVersion);
|
|
134
|
+
const required = (0, semver_1.validRange)(requiredVersion);
|
|
135
|
+
if (!existing || !required) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
const existingMinimum = (0, semver_1.minVersion)(existing);
|
|
139
|
+
const requiredMinimum = (0, semver_1.minVersion)(required);
|
|
140
|
+
if (!existingMinimum || !requiredMinimum) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
return existingMinimum.compare(requiredMinimum) < 0;
|
|
144
|
+
}
|
|
145
|
+
function sortSection(section) {
|
|
146
|
+
return Object.fromEntries(Object.entries(section).sort(([left], [right]) => left.localeCompare(right)));
|
|
147
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "NgAddSchema",
|
|
4
|
+
"title": "@ojiepermana/angular ng-add options",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skipInstall": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"default": false,
|
|
10
|
+
"description": "Skip installing dependencies after updating package.json."
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|