Skip to content

Commit b1da2ca

Browse files
authored
Use bgipfs for upload (#1039)
1 parent ae1338f commit b1da2ca

File tree

5 files changed

+4655
-112
lines changed

5 files changed

+4655
-112
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"test": "yarn hardhat:test",
4646
"vercel": "yarn workspace @se-2/nextjs vercel",
4747
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo",
48+
"ipfs": "yarn workspace @se-2/nextjs ipfs",
4849
"vercel:login": "yarn workspace @se-2/nextjs vercel:login",
4950
"verify": "yarn hardhat:verify"
5051
},

packages/nextjs/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ yarn-error.log*
3535

3636
# typescript
3737
*.tsbuildinfo
38+
39+
ipfs-upload.config.json

packages/nextjs/next.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@ const nextConfig = {
1616
},
1717
};
1818

19+
const isIpfs = process.env.NEXT_PUBLIC_IPFS_BUILD === "true";
20+
21+
if (isIpfs) {
22+
nextConfig.output = "export";
23+
nextConfig.trailingSlash = true;
24+
nextConfig.images = {
25+
unoptimized: true,
26+
};
27+
}
28+
1929
module.exports = nextConfig;

packages/nextjs/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"start": "next dev",
1313
"vercel": "vercel --build-env YARN_ENABLE_IMMUTABLE_INSTALLS=false --build-env ENABLE_EXPERIMENTAL_COREPACK=1 --build-env VERCEL_TELEMETRY_DISABLED=1",
1414
"vercel:yolo": "vercel --build-env YARN_ENABLE_IMMUTABLE_INSTALLS=false --build-env ENABLE_EXPERIMENTAL_COREPACK=1 --build-env NEXT_PUBLIC_IGNORE_BUILD_ERROR=true --build-env VERCEL_TELEMETRY_DISABLED=1",
15+
"ipfs": "NEXT_PUBLIC_IPFS_BUILD=true yarn build && yarn bgipfs upload config init -u https://upload.bgipfs.com && CID=$(yarn bgipfs upload out | grep -o 'CID: [^ ]*' | cut -d' ' -f2) && [ ! -z \"$CID\" ] && echo '🚀 Upload complete! Your site is now available at: https://community.bgipfs.com/ipfs/'$CID || echo '❌ Upload failed'",
1516
"vercel:login": "vercel login"
1617
},
1718
"dependencies": {
@@ -23,6 +24,7 @@
2324
"blo": "^1.2.0",
2425
"burner-connector": "0.0.9",
2526
"daisyui": "4.12.10",
27+
"kubo-rpc-client": "^5.0.2",
2628
"next": "^14.2.11",
2729
"next-nprogress-bar": "^2.3.13",
2830
"next-themes": "^0.3.0",
@@ -42,6 +44,7 @@
4244
"@types/react": "^18.3.5",
4345
"abitype": "1.0.6",
4446
"autoprefixer": "^10.4.20",
47+
"bgipfs": "^0.0.12",
4548
"eslint": "^8.57.1",
4649
"eslint-config-next": "^14.2.15",
4750
"eslint-config-prettier": "^8.10.0",

0 commit comments

Comments
 (0)