diff --git a/README-sdk-dev.md b/README-sdk-dev.md index 69057ee..9dac70f 100644 --- a/README-sdk-dev.md +++ b/README-sdk-dev.md @@ -12,7 +12,6 @@ It is intended for BB2 team members or others performing SDK development work. npm recommends install node using nvm (node version manager), for install instruction, check out: https://github.com/nvm-sh/nvm - ``` check nvm version: nvm -v @@ -102,6 +101,7 @@ cd my_proj yarn init ... ``` + Setting npm config global settings will make subsequently created pacakge projects 'private'. Note that publishing package 'private' is a npm option that requires payment. @@ -110,31 +110,78 @@ Note that publishing package 'private' is a npm option that requires payment. 1. Consuming from npm registry: - ``` - mkdir my_proj - cd my_proj - yarn init - yarn add cms-bluebutton-sdk + ``` + mkdir my_proj + cd my_proj + yarn init + yarn add cms-bluebutton-sdk - continue adding other dependencies, e.g. express, ts-node, etc., ... + continue adding other dependencies, e.g. express, ts-node, etc., ... - yarn add express @types/express ts-node - yarn add - ``` + yarn add express @types/express ts-node + yarn add + ``` 2. Consuming from a local SDK repository (as a good test before publishing): - After built and generated typescript types (needed if to be consumed by typescript project), the sdk can be consumed by other projects as shown by below example: + After built and generated typescript types (needed if to be consumed by typescript project), the sdk can be consumed by other projects as shown by below example: + + ``` + mkdir my_proj + cd my_proj + yarn init + yarn add + + continue adding other dependencies, e.g. express, ts-node, etc., ... + + yarn add express @types/express ts-node + yarn add + ``` + +3. Consuming from the sample client + + This process should definitely be reworked for a better dev experience. Currently there are a lot of manual steps. + + Build the project using the instructions below: + + ``` + yarn build + yarn build:types + ``` + + The yarn build:types is to create the index.d.ts, which is used for type checking throughout the project. While during startup, it may not error out, there + can be issues during runtime. It is to ensure that the types of everything used in the project are consistent. + + Copy each file from the dist folder after the build. You will have: + + cms-bluebutton-sdk.cjs.js + cms-bluebutton-sdk.esm.js + cms-bluebutton-sdk.umd.js + index.d.ts + + The three files are used so that the sdk can be used in a variety of projects, such as a module or in a browser. + + In the sample-client, you will then create a folder within the server folder location. Name the folder something like node-sdk. + Copy the entire contents of the dist folder into the newly created node-sdk folder. + Put the .js files into a new dist folder within the node-sdk folder. + Back in this repo (cms-bb2-node-sdk) copy the package.json into the sample client's node-sdk folder. + This entire process is to allow the sdk to be locally referenced while inside the Docker container. Ideally, there would be a more elegant way to do this. + + The folder structure will look like this: - ``` - mkdir my_proj - cd my_proj - yarn init - yarn add + ``` + server + └───node-sdk + │ │ index.d.ts + │ │ package.json (THIS IS THE ONE FROM THIS SDK REPO) + │ └───dist + │ │ cms-bluebutton-sdk.umd.js + │ │ ms-bluebutton-sdk.esm.js + │ │ cms-bluebutton-sdk.cjs.js + ``` - continue adding other dependencies, e.g. express, ts-node, etc., ... + Within the sample client in the server folder, there is another package.json (Note: NOT the one in node-sdk) This package.json will have - yarn add express @types/express ts-node - yarn add - ``` + "cms-bluebutton-sdk": "^{version}", + Replace the version with "file:node-sdk" to use the locally created node-sdk folder from previous steps. This will allow you to see changes to this repo. diff --git a/src/auth.test.ts b/src/auth.test.ts index 7219928..2eebdd8 100644 --- a/src/auth.test.ts +++ b/src/auth.test.ts @@ -58,7 +58,6 @@ test("expect auth method generateTokenPostData() function", () => { client_id: "foo", client_secret: "bar", code: "test-code", - code_challenge: AuthData.codeChallenge, code_verifier: AuthData.verifier, grant_type: "authorization_code", redirect_uri: "http://localhost/callback/", diff --git a/src/auth.ts b/src/auth.ts index a85cf10..6caec62 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -54,7 +54,6 @@ export type TokenPostData = { grant_type: string; redirect_uri: string; code_verifier: string; - code_challenge: string; }; export function generateAuthData(): AuthData { @@ -94,7 +93,6 @@ export function generateTokenPostData( grant_type: "authorization_code", redirect_uri: bb.callbackUrl, code_verifier: authData.verifier, - code_challenge: authData.codeChallenge, }; }