-
Notifications
You must be signed in to change notification settings - Fork 16
docs: created DEVELOPMENT.md with some tips #300
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
base: master
Are you sure you want to change the base?
Changes from all commits
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,89 @@ | ||
| ## Setup | ||
| ```bash | ||
| # Clone and install | ||
| git clone https://github.com/filecoin-project/filecoin-pin | ||
| cd filecoin-pin | ||
| npm install | ||
| ``` | ||
|
|
||
| ## Basic Execution | ||
| ```bash | ||
| # Run the Pinning Server | ||
| npm run dev | ||
|
|
||
| # Run tests | ||
| npm test | ||
|
|
||
| # Compile TypeScript source | ||
| npm run build | ||
|
|
||
| # Run the cli | ||
| # This is the equivalent of running `filecoin-pin` if you had it installed globally (e.g., `npm install filecoin-pin -g`). | ||
| # It's like doing `npx filecoin-pin` that isn't stuck on that version until you `run npm install filecoin-pin -g` again. | ||
| node ./dist/cli.js | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| ```bash | ||
| npm run test # All tests | ||
| npm run test:unit # Unit tests only | ||
| npm run test:integration # Integration tests | ||
| npm run test:browser # Browser tests | ||
| npm run lint:fix # Fix formatting | ||
| ``` | ||
|
|
||
| Below are various tips and suggestions for doing development with `filecoin-pin`. | ||
|
|
||
| ## Tips | ||
| ### Debug Logging | ||
| Prefix your `filecoin-pin` command with `LOG_LEVEL=debug`. | ||
|
|
||
| ### HTTP Tracing on the CLI | ||
|
|
||
| If you want to see the HTTP calls and their response codes when running the `filecoin-pin` CLI, simply set `NODE_DEBUG=fetch`. | ||
|
|
||
| For example: | ||
|
|
||
| ```bash | ||
| NODE_DEBUG=fetch filecoin-pin add $TMPFILE | ||
| ``` | ||
|
|
||
| This will yield log lines like: | ||
|
|
||
| ```bash | ||
| FETCH 84357: connecting to calib2.ezpdpz.net using https:undefined | ||
| FETCH 84357: connected to calib2.ezpdpz.net using https:h1 | ||
| FETCH 84357: sending request to POST https://calib2.ezpdpz.net//pdp/piece/uploads | ||
| FETCH 84357: received response to POST https://calib2.ezpdpz.net//pdp/piece/uploads - HTTP 201 | ||
| FETCH 84357: trailers received from POST https://calib2.ezpdpz.net//pdp/piece/uploads | ||
| ``` | ||
|
|
||
| Note that this doesn't show headers or request/response payloads. | ||
|
|
||
| ### Running CLI changes made to `filecoin-pin` only | ||
|
|
||
| If you want to quickly try out changes via CLI that were made in `filecoin-pin` only (i.e., not relying on unpublished changes in `synapse-sdk`): | ||
|
|
||
| ```bash | ||
| npx tsx src/cli.ts $COMMAND | ||
|
Collaborator
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 works for non-built versions, or you can use |
||
| ``` | ||
|
|
||
| ### Running CLI changes involving `synapse-sdk` | ||
|
|
||
| If you want within the `filecoin-pin` CLI to try out out `synapse-sdk` changes made locally that haven't been published: | ||
|
|
||
| ```bash | ||
| # Commands for building Synapse | ||
| # Commands for adjusting filecoin-pin to use local Synapse | ||
|
Comment on lines
+77
to
+78
Collaborator
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. TODO: I need to fill this in |
||
| npx tsx src/cli.ts $COMMAND | ||
| ``` | ||
|
|
||
| ### Quickly adding unique data | ||
|
|
||
| Because of content addressing, it's valuable to upload unique data to make sure there is no deduplication in the end-to-end store and retrieval flow. Various quick ways to do this: | ||
|
|
||
| 1. Use temp file with the date/time. The file is small, it's very likely to be unique, and it's easy to verify in retrievals rather than random data. | ||
| ```bash | ||
| TMPFILE=$(mktemp) && date > $TMPFILE && filecoin-pin add $TMPFILE | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also run
npx filecoin-pinornpx .to run the local version when you're in the package root. Note thefoobar123in the secondnpx filecoin-pinrun when i'm in the package root.