From a631bee9cc19c91862442ac07666c9cecaf444b9 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Mon, 20 Nov 2023 16:33:43 +0100 Subject: [PATCH] feat(package): add a README to the published package --- package/README.package.md | 55 +++++++++++++++++++++++++++++++++++++ package/generate-package.js | 4 +++ package/package.json | 3 ++ 3 files changed, 62 insertions(+) create mode 100644 package/README.package.md diff --git a/package/README.package.md b/package/README.package.md new file mode 100644 index 0000000000..67080c4a0d --- /dev/null +++ b/package/README.package.md @@ -0,0 +1,55 @@ +# GeoNetwork-UI NPM Package + +## What is it? + +This package contains many of the features available in the [GeoNetwork-UI project](https://github.com/geonetwork/geonetwork-ui). + +Its contents are: + +- all the libraries in the `libs` folder +- all translations +- various configuration files + +This package _does not_ contain: + +- applications (Datahub, etc.) +- unit and E2E tests +- docker composition +- documentation +- anything related to [NX](https://nx.dev/) + +## How can I use it? + +This is what using this package looks like in an Angular application: + +```ts +// ... +import { + UiElementsModule, + UiInputsModule, + UiWidgetsModule, + provideRepositoryUrl, + ThemeService, +} from 'geonetwork-ui' + +@NgModule({ + imports: [ + // ... + UiWidgetsModule, + UiElementsModule, + UiInputsModule, + ], + providers: [ + // ... + provideRepositoryUrl('http://localhost:8080/geonetwork/srv/api'), + ], + bootstrap: [AppComponent], +}) +export class AppModule { + constructor() { + ThemeService.applyCssVariables('#e73f51', '#c2e9dc', '#212029', '#fdfbff') + } +} +``` + +Please read the documentation on [how to create a Custom Application](https://geonetwork.github.io/geonetwork-ui/main/docs/guide/custom-app.html) for more information! diff --git a/package/generate-package.js b/package/generate-package.js index 399e1fb527..825d18538b 100644 --- a/package/generate-package.js +++ b/package/generate-package.js @@ -137,6 +137,10 @@ copySourceDirectories() ) await copyFile(path.join(CURRENT_DIR_PATH, 'style.css'), PACKAGE_DIST_PATH) await copyFile(path.join(CURRENT_DIR_PATH, 'index.ts'), PACKAGE_DIST_PATH) + await fs.cp( + path.join(CURRENT_DIR_PATH, 'README.package.md'), + path.join(PACKAGE_DIST_PATH, 'README.md') + ) await fs.cp(LIBS_DEST_PATH, path.join(PACKAGE_DIST_PATH, 'src/libs'), { recursive: true, }) diff --git a/package/package.json b/package/package.json index e8ecc1896c..f00ea6c0f1 100644 --- a/package/package.json +++ b/package/package.json @@ -10,6 +10,9 @@ "./tailwind.base.config.js": "./tailwind.base.config.js", "./style.css": "./style.css" }, + "repository": { + "url": "https://github.com/geonetwork/geonetwork-ui" + }, "peerDependencies": { "@angular/animations": "16.x || 17.x", "@angular/cdk": "16.x || 17.x",