Skip to content

Commit aa7fb1a

Browse files
committed
Move contributor guide to its own file
1 parent 2db68e3 commit aa7fb1a

File tree

2 files changed

+95
-72
lines changed

2 files changed

+95
-72
lines changed

packages/sdk/CONTRIBUTING.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# How to Contribute to the SDK
2+
3+
## Local Environment Setup
4+
5+
### Global Dependencies
6+
7+
Clone the repo (ideally your own fork of it) and initialize the global
8+
dependencies like Node.js, NPM, etc. We use [`asdf`](https://asdf-vm.com/) to
9+
manage these, so assuming we're located in this directory (i.e. `packages/sdk/`)
10+
we can run the following command to install them:
11+
12+
```shell
13+
asdf install
14+
```
15+
16+
If you prefer to use another tool make sure you use the same versions that are
17+
specified in the `.tool-versions` files [in this current directory, and
18+
recursively going up until you reach the root of the
19+
repo](https://asdf-vm.com/guide/getting-started.html#_6-set-a-version).
20+
21+
### Local Dependencies
22+
23+
You can install the package's dependencies by using `pnpm` or `npm`:
24+
25+
```shell
26+
pnpm install
27+
```
28+
29+
Since other packages in this repository already use `pnpm`, we recommend you use
30+
it in this case too to keep your `node_modules` footprint low.
31+
32+
## Build the Package
33+
34+
There's a script that you can invoke with `pnpm` to build the package artifacts:
35+
36+
```shell
37+
pnpm build
38+
```
39+
40+
You can also watch the code for changes, and automatically build a new artifact
41+
after each change with the `watch` script:
42+
43+
```shell
44+
pnpm watch
45+
```
46+
47+
### Use the Package
48+
49+
You can use PNPM's `link` command to point other code to your local version of
50+
this package during development. This lets you test the SDK in other local apps,
51+
end-to-end.
52+
53+
In this `packages/sdk/` directory:
54+
55+
```shell
56+
pnpm link --global
57+
```
58+
59+
> [!NOTE]
60+
When using the version of Node.js specified in
61+
[`.tool-versions`](./.tool-versions) (via `asdf`), the command above will
62+
install the package in the `asdf` Node.js environment. To use this package
63+
elsewhere, you'll need to use the same version of Node.js. Please reference the
64+
latest version of [the `.tool-versions` file](./.tool-versions) and add that to
65+
the `.tool-versions` file in your local project where you'd like to use the SDK.
66+
67+
For example, in your app's directory:
68+
69+
```shell
70+
grep nodejs ${PIPEDREAM_REPO_PATH}/packages/sdk/.tool-versions >> .tool-versions
71+
asdf install
72+
pnpm install @pipedream/sdk
73+
```
74+
75+
Then, link the SDK package to it's local path:
76+
77+
```shell
78+
pnpm link @pipedream/sdk
79+
```
80+
81+
To confirm you successfully installed the correct version of the SDK, and that
82+
it's tied to your local copy of the Pipedream SDK:
83+
84+
```shell
85+
ls -l node_modules/@pipedream
86+
```
87+
88+
You should see an output like this one (notice the last line):
89+
90+
```text
91+
total 0
92+
drwxr-xr-x 9 jay staff 288 30 Oct 14:01 mysql
93+
drwxr-xr-x 10 jay staff 320 30 Oct 14:01 platform
94+
lrwxr-xr-x 1 jay staff 31 30 Oct 14:06 sdk -> ../../../pipedream/packages/sdk
95+
```

packages/sdk/README.md

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -41,75 +41,3 @@ In browser environments:
4141
```javascript
4242
import { createClient } from "@pipedream/sdk";
4343
```
44-
45-
## Developing on the SDK
46-
47-
### Setting up local package dev with `npm link`
48-
49-
Clone this repo and initialize global dependencies. We use `asdf` to manage these dependencies — [install it here](https://asdf-vm.com/). Then run
50-
51-
```bash
52-
asdf install
53-
```
54-
55-
Install deps locally:
56-
57-
```bash
58-
cd packages/sdk
59-
npm i
60-
```
61-
62-
To build the package:
63-
64-
```bash
65-
npm run build
66-
```
67-
68-
You can use `npm link` to point other code to the local version of the SDK you're developing on. This lets you test the SDK in other local apps, end-to-end.
69-
70-
First run `npm link` in the `sdk` directory:
71-
72-
```bash
73-
npm link
74-
```
75-
76-
Since we're using a fixed version of Node.js (provided by `asdf` above), this will install the package to the `asdf` Node 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](https://github.com/PipedreamHQ/pipedream/blob/master/.tool-versions) and add that either to the `.tool-versions` file in your local project where you'd like to use the SDK.
77-
78-
For example:
79-
80-
```bash
81-
cd your_project_directory
82-
echo "nodejs 22.10.0" >> .tool-versions # Please reference the latest version being used in the Pipedream public repo
83-
asdf install
84-
```
85-
86-
Then, in your local project, run
87-
88-
```bash
89-
npm link @pipedream/sdk
90-
```
91-
92-
To confirm you successfully installed the correct version of the SDK, tied to your local copy of the Pipedream SDK:
93-
94-
```bash
95-
cd node_modules/@pipedream
96-
ls -l
97-
```
98-
99-
and you should see the `sdk` package pointing to your local directory:
100-
101-
```bash
102-
❯ ls -l
103-
total 0
104-
lrwxr-xr-x 1 dylburger staff 34 Oct 29 20:09 sdk -> ../../../../pipedream/packages/sdk
105-
```
106-
107-
### Automatically building the SDK on new changes
108-
109-
To automatically run `npm run build` on changes to the `src/` directory, run:
110-
111-
```bash
112-
npm run watch
113-
```
114-
115-
and start developing. Any changes to `src/**/*.ts` will automatically trigger builds, and any code using the linked package should use the latest version.

0 commit comments

Comments
 (0)