Skip to content

Commit

Permalink
Merge branch 'main' into feat/bun-run
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki authored Oct 24, 2024
2 parents 2a9ed6d + 880b2ce commit 0f6f0a3
Show file tree
Hide file tree
Showing 27 changed files with 110 additions and 66 deletions.
13 changes: 11 additions & 2 deletions examples/helia-101/101-basics.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
/* eslint-disable no-console */

import { createHeliaHTTP } from '@helia/http'
import { unixfs } from '@helia/unixfs'
import { createHelia } from 'helia'

// create a Helia node
const helia = await createHelia()
const helia = await createHeliaHTTP()

// create a filesystem on top of Helia, in this case it's UnixFS
const fs = unixfs(helia)

// add a file and wrap in a directory
const readmeCid = await fs.addFile({
path: './README.md'
}, {
wrapWithDirectory: true
})

console.log('Added README.md file:', readmeCid.toString())

// we will use this TextEncoder to turn strings into Uint8Arrays
const encoder = new TextEncoder()

Expand Down
4 changes: 2 additions & 2 deletions examples/helia-101/301-networking.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function createNode () {
transports: [
tcp()
],
connectionEncryption: [
connectionEncrypters: [
noise()
],
streamMuxers: [
Expand Down Expand Up @@ -63,7 +63,7 @@ const node2 = await createNode()

// connect them together
const multiaddrs = node2.libp2p.getMultiaddrs()
await node1.libp2p.dial(multiaddrs[0])
await node1.libp2p.dial(multiaddrs)

// create a filesystem on top of Helia, in this case it's UnixFS
const fs = unixfs(node1)
Expand Down
4 changes: 2 additions & 2 deletions examples/helia-101/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Running examples](#running-examples)
- [Running Examples](#running-examples)
- [Usage](#usage)
- [101 - Basics](#101---basics)
- [201 - Storage](#201---storage)
Expand Down Expand Up @@ -206,7 +206,7 @@ const libp2p = await createLibp2p({
transports: [
webSockets()
],
connectionEncryption: [
connectionEncrypters: [
noise()
],
streamMuxers: [
Expand Down
21 changes: 11 additions & 10 deletions examples/helia-101/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
"test": "test-node-example test/*"
},
"dependencies": {
"@chainsafe/libp2p-noise": "^15.0.0",
"@chainsafe/libp2p-yamux": "^6.0.1",
"@helia/unixfs": "^3.0.0",
"@libp2p/bootstrap": "^10.0.12",
"@libp2p/identify": "^1.0.14",
"@libp2p/tcp": "^9.0.12",
"blockstore-core": "^4.1.0",
"datastore-core": "^9.1.1",
"helia": "^4.0.1",
"libp2p": "^1.2.0"
"@chainsafe/libp2p-noise": "^16.0.0",
"@chainsafe/libp2p-yamux": "^7.0.1",
"@helia/http": "^2.0.0",
"@helia/unixfs": "^4.0.0",
"@libp2p/bootstrap": "^11.0.7",
"@libp2p/identify": "^3.0.7",
"@libp2p/tcp": "^10.0.8",
"blockstore-core": "^5.0.2",
"datastore-core": "^10.0.2",
"helia": "^5.0.0",
"libp2p": "^2.1.6"
},
"devDependencies": {
"test-ipfs-example": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ⚠️ IMPORTANT ⚠️

# Please do not create a Pull Request for this repository

The contents of this repository are automatically synced from the parent [Helia Examples Project](https://github.com/ipfs-examples/helia-examples) so any changes made to the standalone repository will be lost after the next sync.

Please open a PR against [IPFS Examples](https://github.com/ipfs-examples/helia-examples) instead.

## 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**.

1. Fork the [Helia Examples Project](https://github.com/ipfs-examples/helia-examples)
2. Create your Feature Branch (`git checkout -b feature/amazing-example`)
3. Commit your Changes (`git commit -a -m 'feat: add some amazing example'`)
4. Push to the Branch (`git push origin feature/amazing-example`)
5. Open a Pull Request
19 changes: 19 additions & 0 deletions examples/helia-browser-verified-fetch/.github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pull

on:
workflow_dispatch

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Pull from another repository
uses: ipfs-examples/actions-pull-directory-from-repo@main
with:
source-repo: ipfs-examples/helia-examples
source-folder-path: examples/${{ github.event.repository.name }}
source-branch: main
target-branch: main
git-username: github-actions
git-email: [email protected]
2 changes: 0 additions & 2 deletions examples/helia-browser-verified-fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
<a href="https://helia.io/modules/helia.html">Explore the docs</a>
·
<a href="https://stackblitz.com/github/ipfs-examples/helia-examples/tree/main/examples/helia-browser-verified-fetch">View in Dev Environment</a>
.
<a href="https://verified-fetch.vercel.app/">View Demo</a>
·
<a href="https://github.com/ipfs-examples/helia-examples/issues">Report Bug</a>
·
Expand Down
3 changes: 2 additions & 1 deletion examples/helia-browser-verified-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "helia-browser-verified-fetch",
"private": true,
"version": "0.0.0",
"description": "Browser Verified Retrieval with @helia/verified-fetch",
"type": "module",
"scripts": {
"clean": "rimraf ./dist",
Expand All @@ -12,7 +13,7 @@
"test": "vite build -c ./test/vite.config.js && test-browser-example test"
},
"dependencies": {
"@helia/verified-fetch": "^1.3.2",
"@helia/verified-fetch": "^1.5.0",
"@sgtpooki/file-type": "^1.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/helia-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"test": "test-node-example test/*"
},
"dependencies": {
"@helia/unixfs": "^3.0.0",
"helia": "^4.0.1"
"@helia/unixfs": "^4.0.0",
"helia": "^5.0.0"
},
"devDependencies": {
"test-ipfs-example": "^1.0.0"
Expand Down
8 changes: 4 additions & 4 deletions examples/helia-create-car/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"test": "npm run build && test-browser-example test"
},
"dependencies": {
"@helia/car": "^3.0.0",
"@helia/unixfs": "^3.0.0",
"@helia/car": "^4.0.0",
"@helia/unixfs": "^4.0.0",
"@ipld/car": "^5.1.1",
"helia": "^4.0.1",
"helia": "^5.0.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.0"
"rimraf": "^6.0.1"
},
"devDependencies": {
"@playwright/test": "^1.31.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/helia-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"test": "xvfb-maybe test-node-example test/*"
},
"dependencies": {
"helia": "^4.0.1"
"helia": "^5.0.0"
},
"devDependencies": {
"electron": "^29.1.4",
"electron": "^32.1.2",
"electron-rebuild": "^3.1.1",
"test-ipfs-example": "^1.0.0",
"xvfb-maybe": "^0.2.1"
Expand Down
8 changes: 4 additions & 4 deletions examples/helia-esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
},
"browserslist": "last 1 Chrome version",
"dependencies": {
"@helia/unixfs": "^3.0.0",
"helia": "^4.0.1"
"@helia/unixfs": "^4.0.0",
"helia": "^5.0.0"
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@playwright/test": "^1.12.3",
"esbuild": "^0.20.0",
"esbuild": "^0.24.0",
"playwright": "^1.12.3",
"process": "^0.11.10",
"rimraf": "^5.0.0",
"rimraf": "^6.0.1",
"test-ipfs-example": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/helia-jest-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"dependencies": {
"helia": "^4.0.1"
"helia": "^5.0.0"
},
"devDependencies": {
"@types/jest": "^29.5.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/helia-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"dependencies": {
"helia": "^4.0.1"
"helia": "^5.0.0"
},
"devDependencies": {
"jest": "^29.6.2"
Expand Down
4 changes: 2 additions & 2 deletions examples/helia-lan-discovery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"test2": "npm run client & npm run server"
},
"dependencies": {
"@helia/dag-cbor": "^3.0.0",
"helia": "^4.0.1",
"@helia/dag-cbor": "^4.0.0",
"helia": "^5.0.0",
"it-length-prefixed-stream": "^1.1.6",
"multiformats": "^13.0.1"
}
Expand Down
12 changes: 6 additions & 6 deletions examples/helia-nestjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"helia": "^4.0.1",
"helia": "^5.0.0",
"reflect-metadata": "^0.2.1",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@types/express": "^4.17.17",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/node": "^22.7.4",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"source-map-support": "^0.5.21",
"supertest": "^6.3.3",
"supertest": "^7.0.0",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
Expand Down
1 change: 0 additions & 1 deletion examples/helia-nestjs/tsconfig-check.aegir.json

This file was deleted.

4 changes: 2 additions & 2 deletions examples/helia-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "npm run build && test-browser-example test"
},
"dependencies": {
"helia": "^4.0.1",
"helia": "^5.0.0",
"next": "^14.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand All @@ -25,7 +25,7 @@
"eslint-config-next": "^14.1.0",
"interface-datastore": "^8.2.0",
"playwright": "^1.32.1",
"rimraf": "^5.0.0",
"rimraf": "^6.0.1",
"test-ipfs-example": "^1.0.0"
}
}
6 changes: 3 additions & 3 deletions examples/helia-parcel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
},
"browserslist": "last 1 Chrome version",
"dependencies": {
"@helia/unixfs": "^3.0.0",
"helia": "^4.0.1"
"@helia/unixfs": "^4.0.0",
"helia": "^5.0.0"
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@playwright/test": "^1.12.3",
"parcel": "^2.9.1",
"playwright": "^1.12.3",
"process": "^0.11.10",
"rimraf": "^5.0.0",
"rimraf": "^6.0.1",
"test-ipfs-example": "^1.0.0"
},
"@parcel/resolver-default": {
Expand Down
2 changes: 1 addition & 1 deletion examples/helia-script-tag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@playwright/test": "^1.12.3",
"playwright": "^1.12.3",
"process": "^0.11.10",
"rimraf": "^5.0.0",
"rimraf": "^6.0.1",
"test-ipfs-example": "^1.0.0",
"vite": "^5.0.11"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/helia-ts-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "cross-env NODE_OPTIONS=\"--loader=ts-node/esm\" test-node-example test/*"
},
"dependencies": {
"helia": "^4.0.1"
"helia": "^5.0.0"
},
"devDependencies": {
"cross-env": "^7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/helia-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "npm run build && test-node-example test/*"
},
"dependencies": {
"helia": "^4.0.1"
"helia": "^5.0.0"
},
"devDependencies": {
"test-ipfs-example": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/helia-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"test": "npm run build && test-browser-example test"
},
"dependencies": {
"@helia/unixfs": "^3.0.0",
"helia": "^4.0.1",
"@helia/unixfs": "^4.0.0",
"helia": "^5.0.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.0"
"rimraf": "^6.0.1"
},
"devDependencies": {
"@playwright/test": "^1.31.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/helia-vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Now open your browser at `http://localhost:5173`

## Usage

In this example, you will find a boilerplate you can use to guide yourself into creating a react+vite app with helia, this provides a pattern to reuse the same client across components with the context API and suggests how to integrate it with custom hooks
In this example, you will find a boilerplate you can use to guide yourself into creating a Vue+Vite app with Helia. This provides a pattern to reuse the same client across components using Vue's provide/inject feature and suggests how to integrate it with Vue composables.

You should see the following:

Expand Down Expand Up @@ -112,4 +112,4 @@ Read the [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of

[cid]: https://docs.ipfs.tech/concepts/content-addressing "Content Identifier"
[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
[libp2p]: https://libp2p.io
[libp2p]: https://libp2p.io
6 changes: 3 additions & 3 deletions examples/helia-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"test": "npm run build && test-browser-example test"
},
"dependencies": {
"@helia/unixfs": "^3.0.0",
"helia": "^4.0.1",
"@helia/unixfs": "^4.0.0",
"helia": "^5.0.0",
"it-all": "^3.0.1",
"vue": "^3.2.47"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.3",
"rimraf": "^5.0.0",
"rimraf": "^6.0.1",
"test-ipfs-example": "^1.0.0",
"vite": "^5.0.11"
}
Expand Down
Loading

0 comments on commit 0f6f0a3

Please sign in to comment.