-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.js
26 lines (24 loc) · 908 Bytes
/
deploy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const path = require('path')
const IPFS = require('ipfs-api')
async function main(){
console.log('Adding and Pinning last build to IPFS API running at localhost:5001')
const ipfs = new IPFS('localhost', 5001)
const options = {
recursive: true,
ignore: '*/**/*.map'
}
const result = await ipfs.util.addFromFs(path.resolve(__dirname, './build'), options)
for (const file of result) {
console.log(file.hash, '\t', file.path)
}
const multihash = result[result.length-1].hash
console.log('\n')
console.log('Test the build using https://ipfs.io/ipfs/' + multihash)
console.log('This build has been automatically pinned. You can remove it using ipfs pin rm -r ' + multihash)
console.log('To publish the build, run ipfs name publish /ipfs/' + multihash)
}
main()
.catch(error => {
console.log(error)
process.exit(1)
})