From 26b9a07a7107b97d8760926b3ca57ee0d765a1a9 Mon Sep 17 00:00:00 2001 From: Shaddy Mansour Date: Fri, 17 May 2024 14:46:27 -0400 Subject: [PATCH] add interface. fix npm package workflow. --- .github/workflows/package.yaml | 8 ++++---- package-lock.json | 4 ++-- package.json | 5 +---- src/index.ts | 6 +++++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index dda0ca0..6fb24bd 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -25,9 +25,9 @@ jobs: - name: Build run: npm run build - name: Publish to GitHub Packages - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ${{ github.workspace }}/.npmrc + npm publish npm: runs-on: ubuntu-latest steps: @@ -47,5 +47,5 @@ jobs: run: npm run build - name: Publish to NPM run: | - echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' > ${{ github.workspace }}/.npmrc + echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' > ${{ github.workspace }}/.npmrc npm publish --access public diff --git a/package-lock.json b/package-lock.json index 86abb8e..10bbbb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@shaddyhm/configs", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@shaddyhm/configs", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "app-root-path": "^3.1.0", diff --git a/package.json b/package.json index 8417283..9a7423b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shaddyhm/configs", - "version": "0.1.0", + "version": "0.1.1", "description": "A simple application configuration library", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -55,8 +55,5 @@ "tabWidth": 2, "singleQuote": true, "trailingComma": "all" - }, - "publishConfig": { - "@shaddyhm:registry": "https://npm.pkg.github.com" } } diff --git a/src/index.ts b/src/index.ts index 42a9e87..c9937f2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,11 @@ export type ConfigsOptions = { configsResolver: (env: string) => string[]; }; -export class Configs { +export interface IConfigs { + get: (key?: string) => Promise; +} + +export class Configs implements IConfigs { private static defaultOptions: ConfigsOptions = { fetchData: () => Promise.resolve({}), pathDelimiter: '.',