This folder contains the system for generating the geonetwork-ui
NPM package.
It contains:
- a
generate-package.js
node script - an
index.ts
file which serves as an entrypoint for the package compilation - a
ng-package.json
file which is used byng-packagr
- a
package.json
describing the NPM package - a
tsconfig.json
file used for the package compilation
The generate-package.js
file does:
- copy the contents of the
libs
folder in thepackage
directory, keeping only relevant files (ts, css, html...) - transform the import aliases in the TS files back to a relative path using the
paths
property oftsconfig.base.json
; for instance:becomes:import { UiLayoutModule } from '@geonetwork-ui/ui/layout'
(this is needed becauseimport { UiLayoutModule } from '../../../libs/ui/layout'
ng-packagr
does not support Typescript path aliases) - launch a compilation of the copied sources using
ng-packagr
; this is necessary because Angular libraries have to be published according to the Angular Package Format - the compilation output is going to
package/dist
; then the script also copies the sourcelibs
folder there as well so that consumers of the package can be redirected to the source file when inspecting it
To generate the package, simply run:
node package/generate-package.js
Then the package can be published like so, assuming the correct rights are available:
cd package/dist
npm publish
Using the package requires creating a custom GeoNetwork-UI application.