-
Couldn't load subscription status.
- Fork 5.5k
Fixes DJ-2470 #14106
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
Fixes DJ-2470 #14106
Changes from 41 commits
6d24e66
9b7dcf1
975d669
651d41b
71dd92f
ad1804d
4385093
87d8d86
ce22436
d4a8394
1b02d65
0bce50e
075e400
7c7b4ac
ccf848e
9a4af88
faf0f8d
5e85ef5
85748a4
06a17b5
e63a89f
bfbc249
314b644
1a1faf0
0e9866f
cf31cda
fe7a66d
0c20e6c
6d23fb9
2db68e3
aa7fb1a
9999664
89ff7c1
7964dde
3429a92
1886bd9
d27a9b1
e775d04
60ac2da
4695be5
a97736d
003aea7
9525871
0e0b7b3
0f4f1a3
4d89d5c
866efdd
60e9e81
3025cf5
7ec1156
a33b75f
6596349
7994412
0c7ca6f
29ab565
401522c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Run SDK Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited, synchronize] | ||
| paths: | ||
| - 'packages/sdk/**/*.md' | ||
|
|
||
jverce marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
jverce marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Lint markdown files | ||
| uses: DavidAnson/markdownlint-cli2-action@v17 | ||
| with: | ||
| globs: 'packages/sdk/**/*.md' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| nodejs 22.10.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Changelog | ||
|
|
||
| ## [1.0.0-rc.1] - 2024-11-01 | ||
|
|
||
| ### Changed | ||
|
|
||
| - Renamed the server-side client class from `ServerClient` to `BackendClient` to | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you use a Markdown linter locally? I use one in VSCode but it doesn't break after 80 (?) characters like yours does, so when I edit these files, it always overwrites your changes. Happy to keep this formatting for dev readability but just want to make sure it's enforced for everyone. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I use markdownlint in VSCode, which is based off of another engine. I just added a Github workflow to lint the markdown files in this directory, and see if it's useful. |
||
| better indicate its purpose. | ||
| - Removed the `oauthClient` optional argument to the `BackendClient` constructor | ||
| - Renamed the client factory methods so that developers can know exactly the | ||
| kind of client they are creating. | ||
| - Removed project-key-based authentication in favor of a more secure | ||
| token-based authentication using OAuth. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # How to Contribute to the SDK | ||
|
|
||
| ## Local Environment Setup | ||
|
|
||
| ### Global Dependencies | ||
|
|
||
| Clone the repo (ideally your own fork of it) and initialize the global | ||
| dependencies like Node.js, NPM, etc. We use [`asdf`](https://asdf-vm.com/) to | ||
| manage these, so assuming we're located in this directory (i.e. `packages/sdk/`) | ||
| we can run the following command to install them: | ||
|
|
||
| ```shell | ||
| asdf install | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are also some deps at the root There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command should traverse its way up the chain until the root of the repo. |
||
| ``` | ||
|
|
||
| If you prefer to use another tool make sure you use the same versions that are | ||
| specified in the `.tool-versions` files [in this current directory, and | ||
| recursively going up until you reach the root of the | ||
| repo](https://asdf-vm.com/guide/getting-started.html#_6-set-a-version). | ||
|
|
||
| ### Local Dependencies | ||
|
|
||
| You can install the package's dependencies by using `pnpm` or `npm`: | ||
|
|
||
| ```shell | ||
| pnpm install | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have people install root deps, should we do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice yes, cool since that's in |
||
| ``` | ||
|
|
||
| Since other packages in this repository already use `pnpm`, we recommend you use | ||
| it in this case too to keep your `node_modules` footprint low. | ||
|
|
||
| ## Build the Package | ||
|
|
||
| There's a script that you can invoke with `pnpm` to build the package artifacts: | ||
|
|
||
| ```shell | ||
| pnpm build | ||
| ``` | ||
|
|
||
| You can also watch the code for changes, and automatically build a new artifact | ||
| after each change with the `watch` script: | ||
|
|
||
| ```shell | ||
| pnpm watch | ||
| ``` | ||
|
|
||
| ### Use the Package | ||
|
|
||
| You can use PNPM's `link` command to point other code to your local version of | ||
jverce marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| this package during development. This lets you test the SDK in other local apps, | ||
| end-to-end. | ||
|
|
||
| In this `packages/sdk/` directory: | ||
|
|
||
| ```shell | ||
| pnpm link --global | ||
| ``` | ||
|
|
||
| > [!NOTE] | ||
| When using the version of Node.js specified in | ||
| [`.tool-versions`](./.tool-versions) (via `asdf`), the command above will | ||
| install the package in the `asdf` Node.js environment. To use this package | ||
| elsewhere, you'll need to use the same version of Node.js. Please reference the | ||
| latest version of [the `.tool-versions` file](./.tool-versions) and add that to | ||
| the `.tool-versions` file in your local project where you'd like to use the SDK. | ||
|
|
||
| For example, in your app's directory: | ||
|
|
||
| ```shell | ||
| # Replace /path/to/pipedream with the actual path to this repository | ||
| grep nodejs /path/to/pipedream/packages/sdk/.tool-versions >> .tool-versions | ||
| asdf install | ||
| pnpm install @pipedream/sdk | ||
|
Comment on lines
+70
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider automating Node.js version detection The manual path replacement and version copying could be error-prone. Consider providing a script to automate this process. -# Replace /path/to/pipedream with the actual path to this repository
-grep nodejs /path/to/pipedream/packages/sdk/.tool-versions >> .tool-versions
-asdf install
+# Create a setup script (e.g., setup.sh):
+#!/bin/bash
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+SDK_DIR=$(find "$SCRIPT_DIR" -name "packages/sdk" -type d | head -n 1)
+if [ -n "$SDK_DIR" ]; then
+ grep nodejs "$SDK_DIR/.tool-versions" >> .tool-versions
+ asdf install
+else
+ echo "Error: Could not locate SDK directory"
+ exit 1
+fi
|
||
| ``` | ||
|
|
||
| Then, link the SDK package to it's local path: | ||
|
|
||
| ```shell | ||
| pnpm link @pipedream/sdk | ||
| ``` | ||
|
|
||
| To confirm you successfully installed the correct version of the SDK, and that | ||
| it's tied to your local copy of the Pipedream SDK: | ||
|
|
||
| ```shell | ||
| ls -l node_modules/@pipedream | ||
| ``` | ||
|
|
||
| You should see an output like this one (notice the last line): | ||
|
|
||
| ```text | ||
| total 0 | ||
| drwxr-xr-x 9 jay staff 288 30 Oct 14:01 mysql | ||
| drwxr-xr-x 10 jay staff 320 30 Oct 14:01 platform | ||
| lrwxr-xr-x 1 jay staff 31 30 Oct 14:06 sdk -> ../../../pipedream/packages/sdk | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| const fetchMock = require("jest-fetch-mock"); | ||
| fetchMock.enableMocks(); | ||
| global.fetch = fetchMock; | ||
|
|
||
| jest.mock("simple-oauth2"); | ||
jverce marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.