From 2ca82fb28bf6b9f5d91c4020225c6658a77a80be Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 12 Jun 2024 20:10:19 +0200 Subject: [PATCH] fix(core): update --- npmextra.json | 1 - package.json | 3 +- pnpm-lock.yaml | 295 +++++---------------------------------- readme.md | 235 +++++++++++++++++++++++++++++-- ts/00_commitinfo_data.ts | 2 +- 5 files changed, 265 insertions(+), 271 deletions(-) diff --git a/npmextra.json b/npmextra.json index 5024bc9..590a2ec 100644 --- a/npmextra.json +++ b/npmextra.json @@ -23,7 +23,6 @@ "tool management", "key-value store", "project setup", - "npm scripts", "typescript", "environment setup", "dependencies management", diff --git a/package.json b/package.json index 5e8f429..72747b8 100644 --- a/package.json +++ b/package.json @@ -59,10 +59,9 @@ "tool management", "key-value store", "project setup", - "npm scripts", "typescript", "environment setup", "dependencies management", "npm package enhancement" ] -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 346b28f..3e1947a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,27 +54,18 @@ packages: '@api.global/typedrequest-interfaces@2.0.2': resolution: {integrity: sha512-D+mkr4IiUZ/eUgrdp5jXjBKOW/iuMcl0z2ZLQsLLypKX/psFGD3viZJ58FNRa+/1OSM38JS5wFyoWl8oPEFLrw==} - '@api.global/typedrequest-interfaces@3.0.1': - resolution: {integrity: sha512-eR2Cr01BYRwIq/X2ajOenWhm8l+/YE4A5kK/9V6I8ZnhtEBMFHG6YjF6Fg8npLJWbvhZXhOms+axZ6JKI71o8g==} - '@api.global/typedrequest-interfaces@3.0.19': resolution: {integrity: sha512-uuHUXJeOy/inWSDrwD0Cwax2rovpxYllDhM2RWh+6mVpQuNmZ3uw6IVg6dA2G1rOe24Ebs+Y9SzEogo+jYN7vw==} '@api.global/typedrequest@3.0.30': resolution: {integrity: sha512-Pp3KVr8QHZ/44u2GE9r8JpWbs5yxA+CZLwxXXcrOBnmJ2Pkp+5PWtO7QZbqnshWAdMTJTYD+nXwlqO0XiPiWGg==} - '@api.global/typedrequest@3.0.4': - resolution: {integrity: sha512-8UThH9c3MxdSLiON8UN1CPXooU6Mp0eleFhVS3QB2OUsYqgEGn/EzuMt+cMIv/+ESSS6zcTpHvAhZ8ZMLfpL8A==} - '@api.global/typedserver@3.0.50': resolution: {integrity: sha512-WWZhLVcjqfJO3kq5RB/kYrss7hIiu3yBqBVA/o9cn7jwu3XHaC2DrT/HC7LrcKm1hndk0XbKMgBEb2orSaVl3g==} '@api.global/typedsocket@3.0.1': resolution: {integrity: sha512-xojiAVNXtHoxkpBo8U2HHJG8FrVXXuLvDNndSHXwx4C9VslUwDn5zSCI+PdBl8iAg+ZuBmKjqkpZZ9sL6DC5yQ==} - '@apiglobal/typedrequest-interfaces@2.0.1': - resolution: {integrity: sha512-Oi7pNU4vKo5UvcCJmqkH43Us237Ws/Pp/WDYnwnonRnTmIMd+6QjNfN/gXcPnP6tbamk8r8Xzcz9mgnSDM2ysw==} - '@babel/code-frame@7.24.7': resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} engines: {node: '>=6.9.0'} @@ -278,8 +269,8 @@ packages: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} - '@jridgewell/resolve-uri@3.1.1': - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} '@jridgewell/sourcemap-codec@1.4.15': @@ -352,9 +343,6 @@ packages: '@push.rocks/isounique@1.0.5': resolution: {integrity: sha512-Z0BVqZZOCif1THTbIKWMgg0wxCzt9CyBtBBqQJiZ+jJ0KlQFrQHNHrPt81/LXe/L4x0cxWsn0bpL6W5DNSvNLw==} - '@push.rocks/lik@6.0.12': - resolution: {integrity: sha512-/vzlOZ26gCmXZz67LeM2hJ+aNM49Jxvf3FKxLMXHhJwffd3LcV96MYbMfKzKR/za/bh5Itf3a6UjLL5mmN6Pew==} - '@push.rocks/lik@6.0.15': resolution: {integrity: sha512-rZxln6l4NAU931MTxnsjy1pue+S3AXtDCidHH/tbkqBtrWIzWuXduo6Nz3zYkndbD64Knyta7F60JRvcOe4XqA==} @@ -460,9 +448,6 @@ packages: '@push.rocks/smartpuppeteer@2.0.2': resolution: {integrity: sha512-EcYCT0PX++WjfHp7W5UYX3t8x5gSNpJMMUvhA7SHz8b2t76ItslNWxprRcF0CUQyN1fozbf5StZf7dwdGc/dIA==} - '@push.rocks/smartrequest@2.0.21': - resolution: {integrity: sha512-btk9GbiMNxNcEgJEqTq9qMFJ/6ua6oG4q49v+8ujKAXU50vFn1WQ/H0VAyeu9LMa5GCcRwUhNNDdwpLVGVbrBg==} - '@push.rocks/smartrequest@2.0.22': resolution: {integrity: sha512-EfgmdEsLtDJ8aNOLOh59ca1NMsiiFz54aoHRigQFQ0cuoUs6phxejIY2FdMoPFn68ubTpkztdL2P4L1/cRYyHg==} @@ -472,9 +457,6 @@ packages: '@push.rocks/smartrx@3.0.7': resolution: {integrity: sha512-qCWy0s3RLAgGSnaw/Gu0BNaJ59CsI6RK5OJDCCqxc7P2X/S755vuLtnAR5/0dEjdhCHXHX9ytPZx+o9g/CNiyA==} - '@push.rocks/smartshell@3.0.3': - resolution: {integrity: sha512-S4RXI76ltPetdJ8Gv4HlnlhR/hXDV8QmSU7TdhLEe171ZzfouAyt9XZ4MFDCtjk3VQ4Mw+zz4mSDaACXP/QdlQ==} - '@push.rocks/smartshell@3.0.5': resolution: {integrity: sha512-kHh86kpkrXHM/xgftcFQ2psU+DJrINzbeD1gIKR/I6cEXjWyYfs+I6UnFMhY3Bcpx9FdTElpRy5qVsumWURQSw==} @@ -502,9 +484,6 @@ packages: '@push.rocks/smarttime@4.0.6': resolution: {integrity: sha512-1whOow0YJw/TbN758TedRRxApoZbsvyxCVpoGjXh7DE/fEEgs7RCr4vVF5jYpyXNQuNMLpKJcTsSfyQ6RvH4Aw==} - '@push.rocks/smartunique@3.0.6': - resolution: {integrity: sha512-/fvh5BBHiTvZcCH4km2Oh3f0spfcWKr7e0Dp6lAb3rJq+5KiO7fQmI1UcQ9clADUaaJOn8sPzseiLt+kJ2tajw==} - '@push.rocks/smartunique@3.0.9': resolution: {integrity: sha512-q6DYQgT7/dqdWi9HusvtWCjdsFzLFXY9LTtaZV6IYNJt6teZOonoygxTdNt9XLn6niBSbLYrHSKvJNTRH/uK+g==} @@ -523,18 +502,12 @@ packages: '@push.rocks/taskbuffer@3.1.7': resolution: {integrity: sha512-QktGVJPucqQmW/QNGnscf4FAigT1H7JWKFGFdRuDEaOHKFh9qN+PXG3QY7DtZ4jfXdGLxPN4yAufDuPSAJYFnw==} - '@push.rocks/webrequest@3.0.34': - resolution: {integrity: sha512-3gqJb58ZukPsOcS26ya2M/nAEOP7lMYyc2Syh45ljgwdM3X8PwHquk5pdc1MMdDWAo1aiYrxReEw6BgMCJUlNQ==} - '@push.rocks/webrequest@3.0.37': resolution: {integrity: sha512-fLN7kP6GeHFxE4UH4r9C9pjcQb0QkJxHeAMwXvbOqB9hh0MFNKhtGU7GoaTn8SVRGRMPc9UqZVNwo6u5l8Wn0A==} '@push.rocks/websetup@3.0.19': resolution: {integrity: sha512-iKJDwXdMmQdu5siOIgziPRxM51lN1AU9HOr+yMteu1YMDkZT7HKCyisDAr4gC9WZ9a7FzsG8zgthm4dMeA8NTw==} - '@push.rocks/webstore@2.0.13': - resolution: {integrity: sha512-w5Q3g1TT5SDIXukAAoYVuWud+Y5ysS8qiBqPU00/re895VVZhUOSNJMNU6jyneZigmbWtwSLsxDkZHlsHWpfuA==} - '@push.rocks/webstore@2.0.20': resolution: {integrity: sha512-Z3L4OHGcw/Gs9aXpMUwebEPTh0nK/C7R6YwPfCLcGVu9yd/ZShaQ8QZEYE243Cu9J1Mn+CEtz4jpPLnHiizHQA==} @@ -655,8 +628,8 @@ packages: '@tsclass/tsclass@4.0.55': resolution: {integrity: sha512-zg774JF90/3/rJ7xk4LyGgxcUzxdKIQcwtBVxez4LhvegESxvHiFmX42WL105iBpE53ISJ8sctLWlwG1JQZdlA==} - '@tsconfig/node10@1.0.9': - resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} + '@tsconfig/node10@1.0.11': + resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} '@tsconfig/node12@1.0.11': resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} @@ -853,9 +826,6 @@ packages: '@types/which@2.0.2': resolution: {integrity: sha512-113D3mDkZDjo+EeUEHCFy0qniNc1ZpecGiAU7WSo7YDoSzolZIQKpYFHrPpjkB2nuyahcKfrmLXeQlh7gqJYdw==} - '@types/which@3.0.3': - resolution: {integrity: sha512-2C1+XoY0huExTbs8MQv1DuS5FS86+SEjdM9F/+GS61gg5Hqbtj8ZiDSx8MfWcyei907fIPbfPGCOrNUTnVHY1g==} - '@types/which@3.0.4': resolution: {integrity: sha512-liyfuo/106JdlgSchJzXEQCVArk0CvevqPote8F8HgWgJ3dRCcTHgJIsLDuee0kxk/mhbInzIZk3QWSZJ8R+2w==} @@ -1050,10 +1020,6 @@ packages: resolution: {integrity: sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==} engines: {node: '>=14.16'} - call-bind@1.0.6: - resolution: {integrity: sha512-Mj50FLHtlsoVfRfnHaZvyrooHcrlceNZdL/QBvJJVd9Ta55qCQK0gs4ss2oZDeV9zFCs6ewzYgVE5yfVmfFpVg==} - engines: {node: '>= 0.4'} - call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} @@ -1188,8 +1154,8 @@ packages: resolution: {integrity: sha512-9pSLe+tDJnmNak2JeMkz6ZmTCXP5p6vCxSd4kvDqrTJkqAP62j2uAEIZjf8cPDZIakStujqVzh5Y5MIWH3yYAw==} engines: {node: '>=6.0'} - croner@7.0.5: - resolution: {integrity: sha512-15HLCD7iXnMe5km54yc4LN5BH+Cg9uCQvbkJ0acHxFffE29w3Uvgb9s/l310UCVUgMwGSBNw9BAHsEb5uMgj1g==} + croner@7.0.7: + resolution: {integrity: sha512-05wALDHKjt9zG1JbpziNnWPCwwv9fUKbNf6q0dWaDMJ/eDxW0394Q2R1VAzKvDgoEZBT9FhWSHHFIcgwLgXjcQ==} engines: {node: '>=6.0'} cross-fetch@3.1.5: @@ -1209,9 +1175,6 @@ packages: css.escape@1.5.1: resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} - dayjs@1.11.10: - resolution: {integrity: sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==} - dayjs@1.11.11: resolution: {integrity: sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==} @@ -1266,10 +1229,6 @@ packages: resolution: {integrity: sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==} engines: {node: '>=10'} - define-data-property@1.1.2: - resolution: {integrity: sha512-SRtsSqsDbgpJBbW3pABMCOt6rQyeM8s8RiyeSN8jYG8sYmt/kGJejbydttUsnDs1tadr19tvhT4ShwMyoqAm4g==} - engines: {node: '>= 0.4'} - define-data-property@1.1.4: resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} engines: {node: '>= 0.4'} @@ -1495,10 +1454,6 @@ packages: resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==} engines: {node: '>=8.0.0'} - foreground-child@3.1.1: - resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} - engines: {node: '>=14'} - foreground-child@3.2.0: resolution: {integrity: sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==} engines: {node: '>=14'} @@ -1560,11 +1515,6 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} - glob@10.3.10: - resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} - engines: {node: '>=16 || 14 >=14.17'} - hasBin: true - glob@10.4.1: resolution: {integrity: sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==} engines: {node: '>=16 || 14 >=14.18'} @@ -1602,14 +1552,11 @@ packages: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - has-property-descriptors@1.0.1: - resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} - has-property-descriptors@1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} - has-proto@1.0.1: - resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} + has-proto@1.0.3: + resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} engines: {node: '>= 0.4'} has-symbols@1.0.3: @@ -1620,8 +1567,8 @@ packages: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} - hasown@2.0.0: - resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} hast-util-from-parse5@8.0.1: @@ -1701,9 +1648,6 @@ packages: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} - idb@7.1.1: - resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==} - ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} @@ -1833,10 +1777,6 @@ packages: resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==} engines: {node: '>=8'} - jackspeak@2.3.6: - resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} - engines: {node: '>=14'} - jackspeak@3.4.0: resolution: {integrity: sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==} engines: {node: '>=14'} @@ -1969,10 +1909,6 @@ packages: resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - lru-cache@10.2.0: - resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} - engines: {node: 14 || >=16.14} - lru-cache@10.2.2: resolution: {integrity: sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==} engines: {node: 14 || >=16.14} @@ -2194,18 +2130,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - minimatch@9.0.3: - resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} - engines: {node: '>=16 || 14 >=14.17'} - minimatch@9.0.4: resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==} engines: {node: '>=16 || 14 >=14.17'} - minipass@7.0.4: - resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} - engines: {node: '>=16 || 14 >=14.17'} - minipass@7.1.2: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} @@ -2377,10 +2305,6 @@ packages: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} - path-scurry@1.10.1: - resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} - engines: {node: '>=16 || 14 >=14.17'} - path-scurry@1.11.1: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} @@ -2609,10 +2533,6 @@ packages: resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==} engines: {node: '>= 0.8.0'} - set-function-length@1.2.1: - resolution: {integrity: sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==} - engines: {node: '>= 0.4'} - set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} engines: {node: '>= 0.4'} @@ -2815,8 +2735,8 @@ packages: tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - tslib@2.6.2: - resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + tslib@2.6.3: + resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} tsscmp@1.0.6: resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==} @@ -2985,11 +2905,6 @@ packages: engines: {node: '>= 8'} hasBin: true - which@3.0.1: - resolution: {integrity: sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - hasBin: true - which@4.0.0: resolution: {integrity: sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==} engines: {node: ^16.13.0 || >=18.0.0} @@ -3099,8 +3014,6 @@ snapshots: '@api.global/typedrequest-interfaces@2.0.2': {} - '@api.global/typedrequest-interfaces@3.0.1': {} - '@api.global/typedrequest-interfaces@3.0.19': {} '@api.global/typedrequest@3.0.30': @@ -3115,15 +3028,6 @@ snapshots: '@push.rocks/webrequest': 3.0.37 '@push.rocks/webstream': 1.0.10 - '@api.global/typedrequest@3.0.4': - dependencies: - '@api.global/typedrequest-interfaces': 3.0.1 - '@push.rocks/isounique': 1.0.5 - '@push.rocks/lik': 6.0.12 - '@push.rocks/smartdelay': 3.0.5 - '@push.rocks/smartpromise': 4.0.3 - '@push.rocks/webrequest': 3.0.34 - '@api.global/typedserver@3.0.50': dependencies: '@api.global/typedrequest': 3.0.30 @@ -3185,8 +3089,6 @@ snapshots: - supports-color - utf-8-validate - '@apiglobal/typedrequest-interfaces@2.0.1': {} - '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 @@ -3209,7 +3111,7 @@ snapshots: '@configvault.io/interfaces@1.0.17': dependencies: - '@api.global/typedrequest-interfaces': 3.0.1 + '@api.global/typedrequest-interfaces': 3.0.19 '@cspotcode/source-map-support@0.8.1': dependencies: @@ -3358,7 +3260,7 @@ snapshots: '@git.zone/tsrun@1.2.46(@types/node@20.14.2)': dependencies: '@push.rocks/smartfile': 10.0.41 - '@push.rocks/smartshell': 3.0.3 + '@push.rocks/smartshell': 3.0.5 ts-node: 10.9.2(@types/node@20.14.2)(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -3408,13 +3310,13 @@ snapshots: wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 - '@jridgewell/resolve-uri@3.1.1': {} + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.4.15': {} '@jridgewell/trace-mapping@0.3.9': dependencies: - '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 '@leichtgewicht/ip-codec@2.0.5': {} @@ -3505,17 +3407,6 @@ snapshots: '@push.rocks/isounique@1.0.5': {} - '@push.rocks/lik@6.0.12': - dependencies: - '@push.rocks/smartdelay': 3.0.5 - '@push.rocks/smartmatch': 2.0.0 - '@push.rocks/smartpromise': 4.0.3 - '@push.rocks/smartrx': 3.0.7 - '@push.rocks/smarttime': 4.0.6 - '@types/minimatch': 5.1.2 - '@types/symbol-tree': 3.2.5 - symbol-tree: 3.2.4 - '@push.rocks/lik@6.0.15': dependencies: '@push.rocks/smartdelay': 3.0.5 @@ -3529,7 +3420,7 @@ snapshots: '@push.rocks/qenv@6.0.5': dependencies: - '@api.global/typedrequest': 3.0.4 + '@api.global/typedrequest': 3.0.30 '@configvault.io/interfaces': 1.0.17 '@push.rocks/smartfile': 11.0.20 '@push.rocks/smartlog': 3.0.7 @@ -3606,7 +3497,7 @@ snapshots: '@push.rocks/smartfile@10.0.41': dependencies: - '@push.rocks/lik': 6.0.12 + '@push.rocks/lik': 6.0.15 '@push.rocks/smartdelay': 3.0.5 '@push.rocks/smartfile-interfaces': 1.0.7 '@push.rocks/smarthash': 3.0.4 @@ -3614,13 +3505,13 @@ snapshots: '@push.rocks/smartmime': 1.0.6 '@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpromise': 4.0.3 - '@push.rocks/smartrequest': 2.0.21 + '@push.rocks/smartrequest': 2.0.22 '@push.rocks/smartstream': 2.0.8 '@types/fs-extra': 11.0.4 '@types/glob': 8.1.0 '@types/js-yaml': 4.0.9 fs-extra: 11.2.0 - glob: 10.3.10 + glob: 10.4.1 js-yaml: 4.1.0 '@push.rocks/smartfile@11.0.20': @@ -3780,13 +3671,6 @@ snapshots: - supports-color - utf-8-validate - '@push.rocks/smartrequest@2.0.21': - dependencies: - '@push.rocks/smartpromise': 4.0.3 - '@push.rocks/smarturl': 3.0.7 - agentkeepalive: 4.5.0 - form-data: 4.0.0 - '@push.rocks/smartrequest@2.0.22': dependencies: '@push.rocks/smartpromise': 4.0.3 @@ -3803,15 +3687,6 @@ snapshots: '@push.rocks/smartpromise': 4.0.3 rxjs: 7.8.1 - '@push.rocks/smartshell@3.0.3': - dependencies: - '@pushrocks/smartdelay': 3.0.1 - '@pushrocks/smartexit': 1.0.20 - '@pushrocks/smartpromise': 4.0.2 - '@types/which': 3.0.3 - tree-kill: 1.2.2 - which: 3.0.1 - '@push.rocks/smartshell@3.0.5': dependencies: '@push.rocks/smartdelay': 3.0.5 @@ -3900,20 +3775,14 @@ snapshots: '@push.rocks/smarttime@4.0.6': dependencies: - '@push.rocks/lik': 6.0.12 + '@push.rocks/lik': 6.0.15 '@push.rocks/smartdelay': 3.0.5 '@push.rocks/smartpromise': 4.0.3 - croner: 7.0.5 - dayjs: 1.11.10 + croner: 7.0.7 + dayjs: 1.11.11 is-nan: 1.3.2 pretty-ms: 8.0.0 - '@push.rocks/smartunique@3.0.6': - dependencies: - '@types/uuid': 9.0.8 - nanoid: 4.0.2 - uuid: 9.0.1 - '@push.rocks/smartunique@3.0.9': dependencies: '@types/uuid': 9.0.8 @@ -3948,21 +3817,13 @@ snapshots: '@push.rocks/taskbuffer@3.1.7': dependencies: - '@push.rocks/lik': 6.0.12 + '@push.rocks/lik': 6.0.15 '@push.rocks/smartdelay': 3.0.5 '@push.rocks/smartlog': 3.0.7 '@push.rocks/smartpromise': 4.0.3 '@push.rocks/smartrx': 3.0.7 '@push.rocks/smarttime': 4.0.6 - '@push.rocks/smartunique': 3.0.6 - - '@push.rocks/webrequest@3.0.34': - dependencies: - '@push.rocks/smartdelay': 3.0.5 - '@push.rocks/smartenv': 5.0.12 - '@push.rocks/smartjson': 5.0.20 - '@push.rocks/smartpromise': 4.0.3 - '@push.rocks/webstore': 2.0.13 + '@push.rocks/smartunique': 3.0.9 '@push.rocks/webrequest@3.0.37': dependencies: @@ -3978,17 +3839,6 @@ snapshots: '@pushrocks/smartpromise': 4.0.2 '@tsclass/tsclass': 4.0.55 - '@push.rocks/webstore@2.0.13': - dependencies: - '@apiglobal/typedrequest-interfaces': 2.0.1 - '@push.rocks/lik': 6.0.12 - '@push.rocks/smartenv': 5.0.12 - '@push.rocks/smartjson': 5.0.20 - '@push.rocks/smartpromise': 4.0.3 - '@push.rocks/smartrx': 3.0.7 - fake-indexeddb: 4.0.2 - idb: 7.1.1 - '@push.rocks/webstore@2.0.20': dependencies: '@api.global/typedrequest-interfaces': 3.0.19 @@ -4129,7 +3979,7 @@ snapshots: '@pushrocks/smartdelay': 2.0.13 '@pushrocks/smartpromise': 3.1.10 croner: 4.4.1 - dayjs: 1.11.10 + dayjs: 1.11.11 is-nan: 1.3.2 pretty-ms: 7.0.1 @@ -4167,7 +4017,7 @@ snapshots: dependencies: type-fest: 4.20.0 - '@tsconfig/node10@1.0.9': {} + '@tsconfig/node10@1.0.11': {} '@tsconfig/node12@1.0.11': {} @@ -4384,8 +4234,6 @@ snapshots: '@types/which@2.0.2': {} - '@types/which@3.0.3': {} - '@types/which@3.0.4': {} '@types/ws@7.4.7': @@ -4638,13 +4486,6 @@ snapshots: normalize-url: 8.0.1 responselike: 3.0.0 - call-bind@1.0.6: - dependencies: - es-errors: 1.3.0 - function-bind: 1.1.2 - get-intrinsic: 1.2.4 - set-function-length: 1.2.1 - call-bind@1.0.7: dependencies: es-define-property: 1.0.0 @@ -4772,7 +4613,7 @@ snapshots: croner@5.7.0: {} - croner@7.0.5: {} + croner@7.0.7: {} cross-fetch@3.1.5: dependencies: @@ -4797,8 +4638,6 @@ snapshots: css.escape@1.5.1: {} - dayjs@1.11.10: {} - dayjs@1.11.11: {} debounce@1.2.1: {} @@ -4831,13 +4670,6 @@ snapshots: defer-to-connect@2.0.1: {} - define-data-property@1.1.2: - dependencies: - es-errors: 1.3.0 - get-intrinsic: 1.2.4 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - define-data-property@1.1.4: dependencies: es-define-property: 1.0.0 @@ -4848,8 +4680,8 @@ snapshots: define-properties@1.2.1: dependencies: - define-data-property: 1.1.2 - has-property-descriptors: 1.0.1 + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 object-keys: 1.1.1 delayed-stream@1.0.0: {} @@ -5117,11 +4949,6 @@ snapshots: cross-spawn: 7.0.3 signal-exit: 3.0.7 - foreground-child@3.1.1: - dependencies: - cross-spawn: 7.0.3 - signal-exit: 4.1.0 - foreground-child@3.2.0: dependencies: cross-spawn: 7.0.3 @@ -5165,9 +4992,9 @@ snapshots: dependencies: es-errors: 1.3.0 function-bind: 1.1.2 - has-proto: 1.0.1 + has-proto: 1.0.3 has-symbols: 1.0.3 - hasown: 2.0.0 + hasown: 2.0.2 get-stream@5.2.0: dependencies: @@ -5179,14 +5006,6 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@10.3.10: - dependencies: - foreground-child: 3.1.1 - jackspeak: 2.3.6 - minimatch: 9.0.3 - minipass: 7.0.4 - path-scurry: 1.10.1 - glob@10.4.1: dependencies: foreground-child: 3.2.0 @@ -5258,15 +5077,11 @@ snapshots: has-flag@4.0.0: {} - has-property-descriptors@1.0.1: - dependencies: - get-intrinsic: 1.2.4 - has-property-descriptors@1.0.2: dependencies: es-define-property: 1.0.0 - has-proto@1.0.1: {} + has-proto@1.0.3: {} has-symbols@1.0.3: {} @@ -5274,7 +5089,7 @@ snapshots: dependencies: has-symbols: 1.0.3 - hasown@2.0.0: + hasown@2.0.2: dependencies: function-bind: 1.1.2 @@ -5422,8 +5237,6 @@ snapshots: dependencies: safer-buffer: 2.1.2 - idb@7.1.1: {} - ieee754@1.2.1: {} ignore@5.3.1: {} @@ -5471,7 +5284,7 @@ snapshots: is-nan@1.3.2: dependencies: - call-bind: 1.0.6 + call-bind: 1.0.7 define-properties: 1.2.1 is-number@4.0.0: {} @@ -5515,12 +5328,6 @@ snapshots: html-escaper: 2.0.2 istanbul-lib-report: 3.0.1 - jackspeak@2.3.6: - dependencies: - '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 - jackspeak@3.4.0: dependencies: '@isaacs/cliui': 8.0.2 @@ -5702,8 +5509,6 @@ snapshots: lowercase-keys@3.0.0: {} - lru-cache@10.2.0: {} - lru-cache@10.2.2: {} lru-cache@4.1.5: @@ -6096,16 +5901,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 - minimatch@9.0.3: - dependencies: - brace-expansion: 2.0.1 - minimatch@9.0.4: dependencies: brace-expansion: 2.0.1 - minipass@7.0.4: {} - minipass@7.1.2: {} mkdirp-classic@0.5.3: {} @@ -6223,11 +6022,6 @@ snapshots: path-key@3.1.1: {} - path-scurry@1.10.1: - dependencies: - lru-cache: 10.2.0 - minipass: 7.0.4 - path-scurry@1.11.1: dependencies: lru-cache: 10.2.2 @@ -6466,7 +6260,7 @@ snapshots: rxjs@7.8.1: dependencies: - tslib: 2.6.2 + tslib: 2.6.3 safe-buffer@5.1.2: {} @@ -6507,15 +6301,6 @@ snapshots: transitivePeerDependencies: - supports-color - set-function-length@1.2.1: - dependencies: - define-data-property: 1.1.2 - es-errors: 1.3.0 - function-bind: 1.1.2 - get-intrinsic: 1.2.4 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - set-function-length@1.2.2: dependencies: define-data-property: 1.1.4 @@ -6738,7 +6523,7 @@ snapshots: ts-node@10.9.2(@types/node@20.14.2)(typescript@5.1.6): dependencies: '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.9 + '@tsconfig/node10': 1.0.11 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 @@ -6755,7 +6540,7 @@ snapshots: tslib@1.14.1: {} - tslib@2.6.2: {} + tslib@2.6.3: {} tsscmp@1.0.6: {} @@ -6908,10 +6693,6 @@ snapshots: dependencies: isexe: 2.0.0 - which@3.0.1: - dependencies: - isexe: 2.0.0 - which@4.0.0: dependencies: isexe: 3.1.1 diff --git a/readme.md b/readme.md index da71db8..6b90610 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ # @push.rocks/npmextra -Enhances npm with additional configuration and tool management capabilities. +Enhances npm with additional configuration and tool management capabilities, including a key-value store for project setups. ## Install To install `@push.rocks/npmextra`, use the following npm command: @@ -11,7 +11,7 @@ npm install @push.rocks/npmextra --save This package is available on [npm](https://www.npmjs.com/package/@push.rocks/npmextra) and can be installed into your project as a dependency to enhance npm with additional configuration and tool management capabilities. ## Usage -`@push.rocks/npmextra` is designed to supplement npm functionalities with enhanced configuration and tool management. It facilitates managing project configurations and tool setups in a consolidated manner, enabling a smoother workflow and maintenance process. Below are detailed use cases and examples implemented with ESM syntax and TypeScript. +`@push.rocks/npmextra` is designed to supplement npm functionalities with enhanced configuration and tool management. It facilitates the management of project configurations and tool setups in a consolidated manner, enabling a smoother workflow and maintenance process. Below are detailed use cases and examples implemented with ESM syntax and TypeScript. ### Initial Setup and Configuration To start using npmextra in your project, first include it in your project with an import statement: @@ -27,7 +27,7 @@ const npmExtraInstance = new Npmextra('/path/to/your/project'); ``` ### Managing Tool Configurations with `npmextra.json` -`@push.rocks/npmextra` excels in unifying tool configurations through a single `npmextra.json` file. Instead of scattering configurations across multiple files, `@push.rocks/npmextra` enables you to define tool-specific settings within this centralized configuration file. +`@push.rocks/npmextra` excels in unifying tool configurations through a single `npmextra.json` file. Instead of scattering configurations across multiple files, `@push.rocks/npmextra` enables you to define tool-specific settings within this centralized configuration file, which can then be accessed programmatically. #### Creating and Utilizing `npmextra.json` @@ -49,13 +49,13 @@ For example, to configure a hypothetical tool named `toolname`, define its setti With the configuration defined, you can easily access these settings in your TypeScript code as follows: ```typescript -// import the npmextra module +// Import the npmextra module import { Npmextra } from '@push.rocks/npmextra'; -// create an instance pointing at the current directory +// Create an instance pointing at the current directory const npmExtraInstance = new Npmextra(); -// retrieve the configuration for 'toolname', merging defaults with any found in npmextra.json +// Retrieve the configuration for 'toolname', merging defaults with any found in npmextra.json const toolConfig = npmExtraInstance.dataFor('toolname', { defaultKey1: 'defaultValue1', defaultKey2: 'defaultValue2' @@ -102,12 +102,227 @@ console.log(allData); // Outputs the entire store's contents ``` ### Integrating with Tools -`@push.rocks/npmextra` seamlessly integrates with numerous tools, enabling them to leverage `npmextra.json` for configuration purposes. Tools such as `npmts`, `npmci`, and `npmdocker` are already utilizing this feature for enhanced configuration management. +`@push.rocks/npmextra` seamlessly integrates with numerous tools, enabling them to leverage `npmextra.json` for configuration purposes. Tools such as `npmts`, `npmci`, and `npmdocker` are already utilizing this feature for enhanced configuration management. Below is an example of integrating a fictional tool named `toolname` with `npmextra`. -For tool developers, integrating with `npmextra` requires reading the tool-specific configuration from `npmextra.json` and adjusting the tool's behavior based on these settings. This creates a unified and streamlined configuration process across different tools used within a project. +#### Example: Tool Integration -### Conclusion -By centralizing configuration management and offering a versatile key-value store, `@push.rocks/npmextra` significantly simplifies the setup and management of tools and settings in modern JavaScript and TypeScript projects. Whether you're managing project-wide configurations or need persistent storage for key-value pairs, `@push.rocks/npmextra` provides an efficient and streamlined solution. +Imagine you have a custom tool called `toolname` that requires specific configurations. Here's how you might configure and use it with `npmextra`: + +1. Define the configuration in `npmextra.json`: + +```json +{ + "toolname": { + "configKey1": "configValue1", + "configKey2": "configValue2", + } +} +``` + +2. Access the configuration within your tool: + +```typescript +// Import npmextra +import { Npmextra } from '@push.rocks/npmextra'; + +class ToolName { + config: any; + + constructor() { + const npmExtraInstance = new Npmextra(); + this.config = npmExtraInstance.dataFor('toolname', { + configKey1: 'defaultValue1', + configKey2: 'defaultValue2' + }); + } + + run() { + // Utilize the configuration + console.log(this.config.configKey1); // Outputs: configValue1 + console.log(this.config.configKey2); // Outputs: configValue2 + } +} + +const toolInstance = new ToolName(); +toolInstance.run(); +``` + +### Advanced Key-Value Store Usage +In addition to basic read/write operations, `@push.rocks/npmextra`’s `KeyValueStore` supports advanced usage scenarios, such as mandatory keys and custom file paths. + +#### Example: Mandatory Keys and Custom Paths + +```typescript +import { KeyValueStore } from '@push.rocks/npmextra'; + +interface CustomData { + key1: string; + key2: number; + key3?: boolean; +} + +const kvStore = new KeyValueStore({ + typeArg: 'custom', + identityArg: 'customApp', + customPath: '/custom/path/to/store.json', + mandatoryKeys: ['key1', 'key2'] +}); + +// Ensure all mandatory keys are present +const missingKeys = await kvStore.getMissingMandatoryKeys(); +if (missingKeys.length) { + console.log(`Missing mandatory keys: ${missingKeys.join(', ')}`); +} + +// Use the KeyValueStore +await kvStore.writeKey('key1', 'value1'); +await kvStore.writeKey('key2', 123); + +const key1Value = await kvStore.readKey('key1'); +const allData = await kvStore.readAll(); + +console.log(key1Value); // Outputs: value1 +console.log(allData); // Outputs: { key1: 'value1', key2: 123 } +``` + +### Combining AppData and KeyValueStore +The `AppData` class extends the functionality of `KeyValueStore` by integrating environmental variables and specifying additional configurations. + +#### Example: AppData Usage + +```typescript +import { AppData } from '@push.rocks/npmextra'; + +interface AppSettings { + settingA: string; + settingB: number; + nestedSetting: { + innerSetting: boolean; + } +} + +const appDataInstance = await AppData.createAndInit({ + dirPath: '/custom/path/to/appdata', + requiredKeys: ['settingA', 'settingB'], + envMapping: { + settingA: 'MY_ENV_A', + settingB: 'hard:42', + nestedSetting: { + innerSetting: 'MY_ENV_INNER' + } + } +}); + +const appDataKvStore = await appDataInstance.getKvStore(); + +// Writing values +await appDataKvStore.writeKey('settingA', 'exampleValue'); +await appDataKvStore.writeKey('settingB', 100); +await appDataKvStore.writeKey('nestedSetting', { innerSetting: true }); + +// Reading values +const settingA = await appDataKvStore.readKey('settingA'); +const allSettings = await appDataKvStore.readAll(); + +console.log(settingA); // Outputs: 'exampleValue' +console.log(allSettings); // Outputs: { settingA: 'exampleValue', settingB: 100, nestedSetting: { innerSetting: true } } +``` + +### Error Handling and Debugging +Proper error handling ensures that your integrations with `npmextra` are robust and stable. Below are some strategies for error handling and debugging potential issues. + +#### Example: Error Handling in KeyValueStore + +```typescript +import { KeyValueStore } from '@push.rocks/npmextra'; + +const kvStore = new KeyValueStore('userHomeDir', 'errorHandlingApp'); + +try { + await kvStore.writeKey('importantKey', 'importantValue'); + const value = await kvStore.readKey('importantKey'); + console.log(value); // Outputs: importantValue +} catch (error) { + console.error('Error managing key-value store:', error); +} +``` + +#### Debugging Configuration Issues in `npmextra.json` + +To debug configuration issues, you can utilize conditional logging and checks: + +```typescript +import { Npmextra } from '@push.rocks/npmextra'; + +const npmExtraInstance = new Npmextra(); +const toolConfig = npmExtraInstance.dataFor('toolname', { + configKey1: 'defaultValue1', + configKey2: 'defaultValue2' +}); + +if (!toolConfig.configKey1) { + console.error('configKey1 is missing in npmextra.json'); +} + +console.log(toolConfig); +``` + +### Integration Tests +Writing tests ensures that your integration with `npmextra` works as expected. Below are examples of integration tests for both `Npmextra` and `KeyValueStore`. + +#### Example: Testing `Npmextra` Class + +```typescript +import { expect, tap } from '@push.rocks/tapbundle'; +import { Npmextra } from '@push.rocks/npmextra'; + +let npmExtraInstance: Npmextra; + +tap.test('should create an instance of Npmextra', async () => { + npmExtraInstance = new Npmextra(); + expect(npmExtraInstance).toBeInstanceOf(Npmextra); +}); + +tap.test('should load configuration from npmextra.json', async () => { + const config = npmExtraInstance.dataFor('toolname', { + defaultKey1: 'defaultValue1', + }); + expect(config).toHaveProperty('defaultKey1'); +}); + +tap.start(); +``` + +#### Example: Testing `KeyValueStore` Class + +```typescript +import { expect, tap } from '@push.rocks/tapbundle'; +import { KeyValueStore } from '@push.rocks/npmextra'; + +let kvStore: KeyValueStore<{ key1: string, key2: number }>; + +tap.test('should create a KeyValueStore instance', async () => { + kvStore = new KeyValueStore('userHomeDir', 'testApp'); + expect(kvStore).toBeInstanceOf(KeyValueStore); +}); + +tap.test('should write and read back a value', async () => { + await kvStore.writeKey('key1', 'value1'); + const result = await kvStore.readKey('key1'); + expect(result).toEqual('value1'); +}); + +tap.test('should write and read back multiple values', async () => { + await kvStore.writeAll({ key1: 'updatedValue1', key2: 2 }); + const result = await kvStore.readAll(); + expect(result).toEqual({ key1: 'updatedValue1', key2: 2 }); +}); + +tap.start(); +``` + +### Summary +By centralizing configuration management and offering a versatile key-value store, `@push.rocks/npmextra` significantly simplifies the setup and management of tools and settings in modern JavaScript and TypeScript projects. Whether you're managing project-wide configurations or need persistent storage for key-value pairs, `@push.rocks/npmextra` provides an efficient and streamlined solution. Leveraging these robust features will ensure your project is well-configured and maintainable. ## License and Legal Information diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index e217dbd..47f3138 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/npmextra', - version: '5.0.14', + version: '5.0.15', description: 'Enhances npm with additional configuration and tool management capabilities, including a key-value store for project setups.' }