You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constpug=require("pug");constIPFSFactory=require("ipfsd-ctl");constncp=require("ncp").ncp;constfs=require("fs");constpath=require("path");constsrc="app/web_app/src";constout="build/web";letipfsd=IPFSFactory.create();constwalkSync=(dir,filelist=[])=>{fs.readdirSync(dir).forEach(file=>{filelist=fs.statSync(path.join(dir,file)).isDirectory()
? walkSync(path.join(dir,file),filelist)
: filelist.concat(path.join(dir,file));});returnfilelist;};letrmdirSync=(path)=>{if(fs.existsSync(path)){fs.readdirSync(path).forEach((file)=>{letcurPath=path+"/"+file;if(fs.lstatSync(curPath).isDirectory()){// recursermdirSync(curPath);}else{// delete filefs.unlinkSync(curPath);}});fs.rmdirSync(path);}};if(fs.existsSync(out)){console.log("Prebuild cleanup");rmdirSync(out);}console.log("Build start");fs.mkdirSync(out);fs.readdir(src,(err,files)=>{files.forEach(file=>{file=src+"/"+file;letp=path.parse(file);if(file.match(".*\\.pug")){console.log("Rendering "+file);lethtml=pug.renderFile(file);console.log("Writing "+out+"/"+p.name+".html");fs.writeFileSync(out+"/"+p.name+".html",html);}else{console.log("Copying "+file+" to "+out+"/"+p.base);fs.lstat(file,(err,stat)=>{if(stat.isDirectory()){ncp(file,out+"/"+p.base);}else{fs.copyFileSync(file,out+"/"+p.base);}});}});console.log("Build Done!");console.log("Deploying to IPFS");console.log("Starting a IPFS node");ipfsd.spawn((err,ipfsNode)=>{console.log("Starting the IPFS daemon");ipfsNode.start((err,ipfs)=>{console.log("The daemon is up and running!");console.log("Adding files to IPFS...");conststream=ipfs.files.addReadableStream();stream.on("data",function(file){console.log(file.path);console.log(file.hash);});fs.walkSync(out,(err,files)=>{console.log(files.lenght+" files to add");files.forEach(file=>{letp=path.parse(file);stream.write({path: "/"+file.substring(out.length),content: fs.readFileSync(file)});});});stream.end();});});});
It's a build script meant to render all my pug files and then publish the web front end to IPFS.
but node seems to just freeze on ipfsd.spawn()
Output of the script:
Prebuild cleanup
Build start
Copying app/web_app/src/css to build/web/css
Rendering app/web_app/src/index.pug
Writing build/web/index.html
Copying app/web_app/src/js to build/web/js
Build Done!
Deploying to IPFS
Starting an IPFS node
It is worth noting that this happens only in the build script. My electron app doesn't freeze like that
The text was updated successfully, but these errors were encountered:
I have this code:
It's a build script meant to render all my pug files and then publish the web front end to IPFS.
but node seems to just freeze on
ipfsd.spawn()
Output of the script:
It is worth noting that this happens only in the build script. My electron app doesn't freeze like that
The text was updated successfully, but these errors were encountered: