Skip to content

Commit

Permalink
fix: lint works. removed ipfs-http-client in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Nov 14, 2024
1 parent c61331d commit 02cb6f1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 39 deletions.
25 changes: 14 additions & 11 deletions examples/electron-asar/app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/* eslint no-console: 0 */
'use strict'

// @ts-check
const electron = require('electron')
const { path } = require('kubo')
const { create } = require('kubo-rpc-client')
/**
* @type {import('../../src')}
*/
const { createNode, createServer } = require('../../src')
const app = electron.app
const ipcMain = electron.ipcMain
const BrowserWindow = electron.BrowserWindow

const { createController, createServer } = require('ipfsd-ctl')

app.on('ready', () => {
const win = new BrowserWindow({
title: 'loading',
Expand All @@ -23,17 +26,17 @@ ipcMain.on('start', async ({ sender }) => {
sender.send('message', 'starting disposable IPFS')
try {
const s = createServer({
host: '127.0.0.1',
port: 43134
}, {
type: 'go',
ipfsBin: require('go-ipfs').path(),
ipfsHttpModule: require('ipfs-http-client')
type: 'kubo',
rpc: create,
bin: path()
})
await s.start()
const node = await createController({
type: 'go',
ipfsHttpModule: require('ipfs-http-client')
const node = await createNode({
type: 'kubo',
rpc: create,
bin: path()
})
console.log('get id')
sender.send('message', 'get id')
Expand Down
4 changes: 2 additions & 2 deletions examples/electron-asar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"private": true,
"main": "./app.js",
"dependencies": {
"go-ipfs": "^0.7.0",
"ipfs-http-client": "^47.0.1",
"kubo": "^0.32.0",
"kubo-rpc-client": "^5.0.0",
"ipfsd-ctl": "file:../.."
},
"devDependencies": {
Expand Down
35 changes: 10 additions & 25 deletions examples/id/id.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
/* eslint no-console: 0 */
'use strict'

const { createController } = require('../../src')
const { path } = require('kubo')
const { create } = require('kubo-rpc-client')
/**
* @type {import('../../src')}
*/
const { createNode } = require('../../src')

async function run () {
const node = await createController({
type: 'go',
ipfsBin: require('go-ipfs').path(),
ipfsHttpModule: require('ipfs-http-client')
const node = await createNode({
type: 'kubo',
rpc: create,
bin: path()
})
console.log('alice')
console.log(await node.api.id())
await node.stop()

const nodeJs = await createController({
type: 'js',
ipfsBin: ipfsModule.path(),
ipfsHttpModule
})
console.log('alice')
console.log(await nodeJs.api.id())
await nodeJs.stop()

const nodeProc = await createController({
type: 'proc',
ipfsModule: require('ipfs'),
ipfsHttpModule: require('ipfs-http-client')
})
console.log('bob')
console.log(await nodeProc.api.id())
await nodeProc.stop()
process.exit()
}

Expand Down
1 change: 0 additions & 1 deletion examples/remote-disposable/remote-disposable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint no-console: 0 */
'use strict'

// Start a remote disposable node, and get access to the api
// print the node id, and stop the temporary daemon
Expand Down

0 comments on commit 02cb6f1

Please sign in to comment.