diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml new file mode 100644 index 00000000..76b9ed1f --- /dev/null +++ b/.github/workflows/pr-checks.yaml @@ -0,0 +1,29 @@ +name: pr-checks + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - main + +jobs: + build-test-lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + + - name: Install + run: npm ci + + - name: Lint + run: npm run lint + + - name: Build + run: npm run build + + - name: Test + run: npm run test + + diff --git a/.github/workflows/publish-dev.yaml b/.github/workflows/publish-dev.yaml new file mode 100644 index 00000000..502aaa7e --- /dev/null +++ b/.github/workflows/publish-dev.yaml @@ -0,0 +1,40 @@ +# Publishes a pre-release, incrementing the final integer (ie: 0.0.1-alpha.1 => 0.0.1-alpha.2), if any ts files or the package.json have changed. Pushes package.json changes back to main. + +name: publish-dev + +on: + push: + branches: + - main + paths: + - '**.ts' + - 'package.json' + - 'package-lock.json' + +jobs: + publish-dev: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + + - name: Install + run: npm ci + + - name: Build + run: npm run build + + - name: Version + run: npm version prerelease + + - name: Publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Push Version Update + run: | + git config --global user.name 'openfeature-ci' + git config --global user.email 'openfeature-ci@users.noreply.github.com' + git push diff --git a/README.md b/README.md index bd77848f..1ec7d127 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # node-sdk +[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges) + OpenFeature NodeJS SDK ## Development diff --git a/package.json b/package.json index eec4ca40..76b4d013 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test": "jest", "lint": "eslint ./", "postbuild": "cp ./package.esm.json ./dist/esm/package.json", - "build": "rm -R ./dist && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json" + "build": "rm -f -R ./dist && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json" }, "repository": { "type": "git", diff --git a/src/index.ts b/src/index.ts index 0856ee42..8eaad5ba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ // real code will go here, just scaffolding the project for now. export const greet = (greeting: string): string => { - console.log(`${greeting}, OpenFeature`); - return greeting; + const message = `${greeting}, OpenFeature`; + return message; }; diff --git a/test/index.spec.ts b/test/index.spec.ts index e07c994a..278e84c3 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -3,6 +3,6 @@ import { greet } from '../src/index'; describe('greet', () => { it('should return greeting', () => { const result = greet('hi'); - expect(result).toEqual('hi'); + expect(result).toContain('hi'); }); });