Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SkipFilters to SDK #86

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ name: Node CI

on: [push]


env:
NPM_REGISTRY: npm.pkg.github.com
NPM_SECRET: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 14, 16, 18, 19]
steps:

- name: Checkout Repository
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: npm install, build, and test
run: |
npm ci
Expand All @@ -30,19 +28,32 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install npm-force-resolutions
run: npm install -g npm-force-resolutions

- name: Install dependencies
run: npm install

- name: Build Package
run: npm run build --if-present

- name: Tag Version
run: npm --no-git-tag-version version prerelease --preid=${GITHUB_REF##*/}-${GITHUB_SHA:0:8}

- name: Configure Project-Level .npmrc File
run: npm config set --location=project @adzerk:registry=https://'${NPM_REGISTRY}' //'${NPM_REGISTRY}'/:_authToken='${NPM_SECRET}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these rely on NPM_REGISTRY and NPM_SECRET, don't they? Am I right in assuming that this step won't have those values, as they've been moved into the step below instead of living at the top level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally yes, but what I've done is wrap the shell variables in single quotes as the actual values will be substituted in by npm when npm publish is run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That line creates a file called .npmrc with the contents:

@adzerk:registry=https://${NPM_REGISTRY}
//${NPM_REGISTRY}/:_authToken=${NPM_SECRET}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm publish then substitutes those values in from env variables when run


- name: Publish to GitHub NPM Registry
run: npm publish
run: npm publish
env:
NPM_REGISTRY: npm.pkg.github.com
NPM_SECRET: ${{ secrets.GITHUB_TOKEN }}
17 changes: 12 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,32 @@ on:
release:
types: [published]

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_REGISTRY: registry.npmjs.org
NPM_SECRET: ${{ secrets.NPM_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: 18
registry-url: https://registry.npmjs.org

- name: Install Dependencies
run: npm install

- name: Build SDK
run: npm run build

- name: Configure Project-Level .npmrc File
run: npm config set --location=project @adzerk:registry=https://'${NPM_REGISTRY}' //'${NPM_REGISTRY}'/:_authToken='${NPM_SECRET}'

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_REGISTRY: registry.npmjs.org
NPM_SECRET: ${{ secrets.NPM_TOKEN }}
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
]
},
"dependencies": {
"@adzerk/api-decision-js": "^1.0.10",
"debug": "^4.1.1",
"form-data": "^2.5.1",
"isomorphic-unfetch": "^3.1.0"
Expand Down
6 changes: 3 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
RequestContext,
ResponseContext,
Placement,
} from './generated';
RequiredError,
UserdbApi
} from '@adzerk/api-decision-js';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy that you removed the generated code from the repo! Much cleaner and less confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

import { DecisionRequest, DecisionResponse } from './models';
import { removeUndefinedAndBlocklisted } from './utils';
import { UserdbApi } from './generated/apis/UserdbApi';
import { RequiredError } from './generated/runtime';
import { LoggerFunc } from '.';

(global as any).FormData = (global as any).FormData || FormData;
Expand Down
25 changes: 0 additions & 25 deletions src/generated/.openapi-generator-ignore

This file was deleted.

16 changes: 0 additions & 16 deletions src/generated/.openapi-generator/FILES

This file was deleted.

1 change: 0 additions & 1 deletion src/generated/.openapi-generator/VERSION

This file was deleted.

64 changes: 0 additions & 64 deletions src/generated/apis/DecisionApi.ts

This file was deleted.

Loading