Skip to content

Files

Latest commit

 

History

History
 
 

package

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 20, 2023
Nov 20, 2023
Nov 20, 2023
Nov 20, 2023
Apr 19, 2024
Feb 7, 2024
Jun 7, 2024
Nov 20, 2023
Nov 20, 2023

GeoNetwork-UI NPM Package

Generating the package

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 by ng-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 the package 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 of tsconfig.base.json; for instance:
    import { UiLayoutModule } from '@geonetwork-ui/ui/layout'
    becomes:
    import { UiLayoutModule } from '../../../libs/ui/layout'
    (this is needed because 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 source libs 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

Using the package requires creating a custom GeoNetwork-UI application.

See the documentation website for more information.