Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 3.04 KB

CONTRIBUTING.md

File metadata and controls

60 lines (44 loc) · 3.04 KB

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

Table of Contents

Howto

  1. Fork the IPFS Examples Project (https://github.com/libp2p/js-libp2p-examples)
  2. Create your Feature Branch (git checkout -b feature/amazing-feature)
  3. Commit your Changes (git commit -a -m 'feat: add some amazing feature')
  4. Push to the Branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

How to add a new example

  1. Decide on a pithy folder name for your example, it should start with js-libp2p-example- and ideally be one or two words that describe what it's about - e.g. js-libp2p-example-transfer-files
  2. Create a folder in this repo under examples, eg. ./examples/js-libp2p-example-transfer-files
  3. Add the files and tests that make up the example
  4. Add the folder name to the project-list lists in the examples and push-changes jobs in this repositories ./github/ci.yml
  5. Create a PR to https://github.com/libp2p/github-mgmt similar to libp2p/github-mgmt#22 to facilitate the addition of your project as an isolated repo.

Examples must

  • Live inside the /examples/ folder
  • Have tests and should make use of test-ipfs-example library
  • Implement the following scripts:
  • clean: used to clean all the unnecessary code (e.g.: files generated by bundlers and package managers)
  • build: used to build the example
  • start: used to start the example
  • test: used to test the example
  • The README.md must have (see example inside example-template):
    • Link to Codesandbox.com for one-click running demonstration
    • References for documentation/tutorials used to build the example
    • Optional: Screenshots, gifs, etc... under img/ folder
  • Update the CI to run the tests of the new example as standalone
    • Edit github/workflows/ci.yml
    • Add the test name to project under matrix

Update js-libp2p to run tests against the repo

Open a PR to the libp2p/js-libp2p project that edits the .github/workflows/examples.yml in order to make sure a libp2p release does not break your new example.

Search .github/workflows/test.yml for the test-examples section and add a block at the end of the example matrix key similar to:

- name: my super fun new example
  repo: https://github.com/libp2p/js-libp2p-my-super-fun-new-example.git
  deps: libp2p@$PWD/packages/libp2p/dist

The value of the deps key will vary depending on which modules from Helia your example uses. Above we override the helia module, but your example may different deps.

Please see the existing setup in .github/workflows/test.yml for how to ensure you are overriding the correct modules.