From b5f109d32094e2f2ed37ddd4528f8c4766655867 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Tue, 5 Nov 2024 15:11:01 +0100 Subject: [PATCH] feat(appdata): Add support for overwriting keys using the overwriteObject option in AppData --- changelog.md | 47 ++++++++++++++++++++++++++++++++++ ts/00_commitinfo_data.ts | 4 +-- ts/npmextra.classes.appdata.ts | 6 +++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 changelog.md diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..5d18f7f --- /dev/null +++ b/changelog.md @@ -0,0 +1,47 @@ +# Changelog + +## 2024-11-05 - 5.1.0 - feat(appdata) +Add support for overwriting keys using the overwriteObject option in AppData + +- Introduced the overwriteObject option in IAppDataOptions to allow overwriting specific keys in the AppData class. + +## 2024-06-19 - 5.0.17 - 5.0.23 - Core Updates +Routine maintenance and updates to the core components. + +- Multiple core updates and fixes improving stability + +## 2024-06-12 - 5.0.13 - 5.0.16 - Core Updates +Maintenance focus on core systems with enhancements and problem resolutions. + +- Enhancements and updates in the core functionality + +## 2024-05-29 - 5.0.13 - Documentation Update +Descriptive improvements aligned with current features. + +- Updated core description for better clarity in documentation + +## 2024-04-01 - 5.0.10 - Configuration Update +Improved configuration management for build processes. + +- Updated `npmextra.json` to reflect changes in git repository management + +## 2024-02-12 - 5.0.0 - 5.0.9 - Major Core Enhancements +A series of critical updates with resolved issues in the core components. + +- Introduction of new core features +- Several core system updates + +## 2024-02-12 - 4.0.16 - Major Version Transition +Migration to the new major version with impactful changes. + +- BREAKING CHANGE: Significant updates requiring attention for smooth transition + +## 2023-08-24 - 3.0.9 - 4.0.16 - Organization Updates +Formatted updates with attention to organizational standards and practice. + +- SWITCH to a new organizational scheme + +## 2023-07-11 - 3.0.9 - Organizational Enhancement +Shifts aligning with contemporary structuring and logistics. + +- Strategic realignment with organizational principles diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 1663520..5680f4a 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -1,8 +1,8 @@ /** - * autocreated commitinfo by @pushrocks/commitinfo + * autocreated commitinfo by @push.rocks/commitinfo */ export const commitinfo = { name: '@push.rocks/npmextra', - version: '5.0.23', + version: '5.1.0', description: 'A utility to enhance npm with additional configuration, tool management capabilities, and a key-value store for project setups.' } diff --git a/ts/npmextra.classes.appdata.ts b/ts/npmextra.classes.appdata.ts index f4f8192..c93e391 100644 --- a/ts/npmextra.classes.appdata.ts +++ b/ts/npmextra.classes.appdata.ts @@ -15,6 +15,7 @@ export interface IAppDataOptions { * kvStoreKey: 'MY_ENV_VAR' */ envMapping?: plugins.tsclass.typeFest.PartialDeep; + overwriteObject?: plugins.tsclass.typeFest.PartialDeep; } export class AppData { @@ -175,6 +176,11 @@ export class AppData { for (const key in this.options.envMapping) { await processEnvMapping(key as keyof T, this.options.envMapping[key]); } + + for (const key in Object.keys(this.options.overwriteObject)) { + console.log(`-> heads up: overwriting key ${key} from options.overwriteObject`); + await this.kvStore.writeKey(key as keyof T, this.options.overwriteObject[key]); + } } this.readyDeferred.resolve();