mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-26 15:04:19 +01:00
wip ipfsd-ctl usage impl
This commit is contained in:
parent
fa02f2da3d
commit
fe70b6517e
37
gulpfile.js
37
gulpfile.js
@ -3,6 +3,7 @@ var webpack = require('webpack-stream')
|
|||||||
var clean = require('gulp-clean')
|
var clean = require('gulp-clean')
|
||||||
var connect = require('gulp-connect')
|
var connect = require('gulp-connect')
|
||||||
var ghPages = require('gulp-gh-pages')
|
var ghPages = require('gulp-gh-pages')
|
||||||
|
var ipfsd = require('ipfsd-ctl')
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
files: {
|
files: {
|
||||||
@ -15,6 +16,12 @@ var config = {
|
|||||||
dest: 'webapp/dist/'
|
dest: 'webapp/dist/'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var server = {
|
||||||
|
root: config.dest,
|
||||||
|
port: 9090,
|
||||||
|
livereload: true
|
||||||
|
}
|
||||||
|
|
||||||
gulp.task('watch',['clean'],function(){
|
gulp.task('watch',['clean'],function(){
|
||||||
var cfg = require('./webpack.config.js')
|
var cfg = require('./webpack.config.js')
|
||||||
cfg.watch = true
|
cfg.watch = true
|
||||||
@ -36,11 +43,7 @@ gulp.task('clean',function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('server',function(){
|
gulp.task('server',function(){
|
||||||
connect.server({
|
connect.server(server)
|
||||||
root: config.dest,
|
|
||||||
port: 9090,
|
|
||||||
livereload: true
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('gh-pages',[ 'build' ],function(){
|
gulp.task('gh-pages',[ 'build' ],function(){
|
||||||
@ -48,6 +51,30 @@ gulp.task('gh-pages',[ 'build' ],function(){
|
|||||||
.pipe(ghPages())
|
.pipe(ghPages())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
gulp.task('ipfs', function(done){
|
||||||
|
console.log(server.port)
|
||||||
|
//'API.HTTPHeaders.Access-Control-Allow-Origin': '*'
|
||||||
|
var opt = {
|
||||||
|
'Addresses.API': '/ip4/127.0.0.1/tcp/5001',
|
||||||
|
'API': {
|
||||||
|
'HTTPHeaders': {
|
||||||
|
'Access-Control-Allow-Origin': [
|
||||||
|
'*'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(opt)
|
||||||
|
ipfsd.disposableApi(opt,(err, ipfs) => {
|
||||||
|
ipfs.id(function (err, id) {
|
||||||
|
if(err) return console.log('Failed to start IPFS:',err)
|
||||||
|
console.log('Started IPFS Daemon')
|
||||||
|
//done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
gulp.task('serve', [ 'watch', 'server' ])
|
gulp.task('serve', [ 'watch', 'server' ])
|
||||||
|
gulp.task('serve-with-ipfs', [ 'serve', 'ipfs' ])
|
||||||
|
|
||||||
gulp.task('default', [ 'build' ])
|
gulp.task('default', [ 'build' ])
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
"html-loader": "^0.4.0",
|
"html-loader": "^0.4.0",
|
||||||
"html-webpack-plugin": "~1.7.0",
|
"html-webpack-plugin": "~1.7.0",
|
||||||
"ipfs-api": "2.9.13",
|
"ipfs-api": "2.9.13",
|
||||||
|
"ipfsd-ctl": "^0.6.3",
|
||||||
"json-loader": "~0.5.4",
|
"json-loader": "~0.5.4",
|
||||||
"lodash.sortedindex": "~3.1.1",
|
"lodash.sortedindex": "~3.1.1",
|
||||||
"markdown-loader": "^0.1.7",
|
"markdown-loader": "^0.1.7",
|
||||||
|
Loading…
Reference in New Issue
Block a user